mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-16 18:55:06 +00:00
Begin refactor, make CarvingVariation and CarvingGroup interfaces
This commit is contained in:
1 parent
b268ebeca0
commit
155bc00f0e
12 files changed
+206
-75
No files matched your search
@@ -0,0 +1,17 @@
|
||||
package com.cricketcraft.chisel.api.carving;
|
||||
|
||||
public class CarvingUtils {
|
||||
|
||||
/**
|
||||
* The default implementation of {@link ICarvingVariation#compareTo(ICarvingVariation)}
|
||||
*
|
||||
* @param v1
|
||||
* The first {@link ICarvingVariation variation}. Usually 'this'.
|
||||
* @param v2
|
||||
* The second {@link ICarvingVariation variation}. Usually the parameter to the {@code comapreTo} method.
|
||||
* @return A positive integer if the first's order is greater, a negative integer if the second's is greater, and 0 if they are equal.
|
||||
*/
|
||||
public static int compare(ICarvingVariation v1, ICarvingVariation v2) {
|
||||
return v1.getOrder() - v2.getOrder();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.cricketcraft.chisel.api.carving;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ICarvingGroup {
|
||||
|
||||
/**
|
||||
* The name of this group. Used for internal identification.
|
||||
*
|
||||
* @return A string name for the group
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Can return null. If null, fallback sound will be used (the standard chisel sound).
|
||||
*
|
||||
* @return The string resource path of the sound to use for chiseling items in this group
|
||||
*/
|
||||
String getSound();
|
||||
|
||||
/**
|
||||
* Sets the sound of this group
|
||||
*
|
||||
* @param sound
|
||||
* A string resource path for the sound this group makes when chiseled
|
||||
*/
|
||||
void setSound(String sound);
|
||||
|
||||
/**
|
||||
* The oredict name to match to this group. All items with this oredict name will be assumed to be part of this group.
|
||||
*
|
||||
* @return An ore dictionary name
|
||||
*/
|
||||
String getOreName();
|
||||
|
||||
/**
|
||||
* Sets the oredict name for this group.
|
||||
*
|
||||
* @param oreName
|
||||
* The String oredict name to be associated with this group.
|
||||
*/
|
||||
void setOreName(String oreName);
|
||||
|
||||
/**
|
||||
* Gets all carving variations associated with this group.
|
||||
*
|
||||
* @return A {@link List} of {@link ICarvingVariation}s
|
||||
*/
|
||||
List<ICarvingVariation> getVariations();
|
||||
|
||||
/**
|
||||
* Adds a variation to this group.
|
||||
*
|
||||
* @param variation
|
||||
* An {@link ICarvingVariation} to add to this group
|
||||
*/
|
||||
void addVariation(ICarvingVariation variation);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.cricketcraft.chisel.api.carving;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Represents a variation of a chiselable block.
|
||||
* <p>
|
||||
* Do note that while this interface extends {@link Comparable}, a default implementation of {@link Comparable#compareTo(Object)} is provided in
|
||||
* {@link CarvingUtils#compare(ICarvingVariation, ICarvingVariation)}
|
||||
*/
|
||||
public interface ICarvingVariation extends Comparable<ICarvingVariation> {
|
||||
|
||||
Block getBlock();
|
||||
|
||||
int getBlockMeta();
|
||||
|
||||
int getItemMeta();
|
||||
|
||||
/**
|
||||
* Gets an {@link ItemStack} representing this variation.
|
||||
*
|
||||
* @return An {@link ItemStack} to represent this variation
|
||||
*/
|
||||
ItemStack getStack();
|
||||
|
||||
/**
|
||||
* The "order" of this variation. Represents its position in the list of variations.
|
||||
*
|
||||
* @return An integer to represent the position of this variation in the list of all variations in the group
|
||||
*/
|
||||
int getOrder();
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user