[ci skip] spotlessApply with the new settings

This commit is contained in:
Jason Mitchell committed 2023-01-29 10:09:28 -08:00
1 parent a314fccd1b
commit 8f026dad8f
161 files changed
+14073 -12846

No files matched your search

@@ -2,6 +2,6 @@ package com.cricketcraft.chisel.api;
public class ChiselAPIProps {
public static final String VERSION = "0.1.1";
public static String MOD_ID = null; // Set by Chisel
public static final String VERSION = "0.1.1";
public static String MOD_ID = null; // Set by Chisel
}
@@ -3,64 +3,63 @@ package com.cricketcraft.chisel.api;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ChiselTabs {
public static class CustomCreativeTab extends CreativeTabs {
public static class CustomCreativeTab extends CreativeTabs {
private boolean search;
private boolean search;
private ItemStack stack;
private ItemStack stack;
public CustomCreativeTab(String label, boolean searchbar) {
super(label);
this.search = searchbar;
}
public CustomCreativeTab(String label, boolean searchbar) {
super(label);
this.search = searchbar;
}
@Override
public Item getTabIconItem() {
return stack.getItem();
}
@Override
public Item getTabIconItem() {
return stack.getItem();
}
public void setTabIconItemStack(ItemStack stack) {
this.stack = stack;
}
public void setTabIconItemStack(ItemStack stack) {
this.stack = stack;
}
@Override
public ItemStack getIconItemStack() {
return stack;
}
@Override
public ItemStack getIconItemStack() {
return stack;
}
@Override
@SideOnly(Side.CLIENT)
public String getBackgroundImageName() {
@Override
@SideOnly(Side.CLIENT)
public String getBackgroundImageName() {
return search ? "item_search.png" : super.getBackgroundImageName();
}
return search ? "item_search.png" : super.getBackgroundImageName();
}
@Override
public int getSearchbarWidth() {
@Override
public int getSearchbarWidth() {
return 89;
}
return 89;
}
@Override
public boolean hasSearchBar() {
@Override
public boolean hasSearchBar() {
return search;
}
}
public static final CustomCreativeTab tabChisel = new CustomCreativeTab("tabChisel", false);
public static final CustomCreativeTab tabStoneChiselBlocks = new CustomCreativeTab("tabStoneChiselBlocks", true);
public static final CustomCreativeTab tabWoodChiselBlocks = new CustomCreativeTab("tabWoodChiselBlocks", true);
public static final CustomCreativeTab tabMetalChiselBlocks = new CustomCreativeTab("tabMetalChiselBlocks", true);
public static final CustomCreativeTab tabOtherChiselBlocks = new CustomCreativeTab("tabOtherChiselBlocks", true);
public static final CustomCreativeTab tabModdedChiselBlocks = new CustomCreativeTab("tabModdedChiselBlocks", true);
public static final CustomCreativeTab tabStairChiselBlocks = new CustomCreativeTab("tabStairChiselBlocks", true);
return search;
}
}
public static final CustomCreativeTab tabChisel = new CustomCreativeTab("tabChisel", false);
public static final CustomCreativeTab tabStoneChiselBlocks = new CustomCreativeTab("tabStoneChiselBlocks", true);
public static final CustomCreativeTab tabWoodChiselBlocks = new CustomCreativeTab("tabWoodChiselBlocks", true);
public static final CustomCreativeTab tabMetalChiselBlocks = new CustomCreativeTab("tabMetalChiselBlocks", true);
public static final CustomCreativeTab tabOtherChiselBlocks = new CustomCreativeTab("tabOtherChiselBlocks", true);
public static final CustomCreativeTab tabModdedChiselBlocks = new CustomCreativeTab("tabModdedChiselBlocks", true);
public static final CustomCreativeTab tabStairChiselBlocks = new CustomCreativeTab("tabStairChiselBlocks", true);
}
@@ -2,21 +2,22 @@ package com.cricketcraft.chisel.api;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.event.FMLInterModComms;
public class FMPIMC {
public static void registerFMP(Block block) {
registerFMP(block, 0, 15);
}
public static void registerFMP(Block block) {
registerFMP(block, 0, 15);
}
public static void registerFMP(Block block, int minMeta, int maxMeta) {
for (int c = minMeta; c <= maxMeta; c++) {
registerFMP(block, c);
}
}
public static void registerFMP(Block block, int minMeta, int maxMeta) {
for (int c = minMeta; c <= maxMeta; c++) {
registerFMP(block, c);
}
}
public static void registerFMP(Block block, int meta) {
FMLInterModComms.sendMessage("ForgeMicroblock", "microMaterial", new ItemStack(block, 1, meta));
}
public static void registerFMP(Block block, int meta) {
FMLInterModComms.sendMessage("ForgeMicroblock", "microMaterial", new ItemStack(block, 1, meta));
}
}
@@ -9,25 +9,21 @@ import com.cricketcraft.chisel.api.carving.IChiselMode;
*/
public interface IAdvancedChisel {
/**
* Gets the next mode the button in the GUI should switch to given the current mode.
*
* @param stack
* The {@link ItemStack} representing the chisel
* @param current
* The {@link IChiselMode} that is currently active
* @return The next {@link IChiselMode} in the loop
*/
public IChiselMode getNextMode(ItemStack stack, IChiselMode current);
/**
* Gets the next mode the button in the GUI should switch to given the current mode.
*
* @param stack The {@link ItemStack} representing the chisel
* @param current The {@link IChiselMode} that is currently active
* @return The next {@link IChiselMode} in the loop
*/
public IChiselMode getNextMode(ItemStack stack, IChiselMode current);
/**
* Gets an {@link IChiselMode} instance from a String name
*
* @param chisel
* The {@link ItemStack} representing the chisel
* @param name
* The name of the {@link IChiselMode mode}
* @return An {@link IChiselMode} that has the name {@code name}
*/
public IChiselMode getMode(ItemStack chisel, String name);
/**
* Gets an {@link IChiselMode} instance from a String name
*
* @param chisel The {@link ItemStack} representing the chisel
* @param name The name of the {@link IChiselMode mode}
* @return An {@link IChiselMode} that has the name {@code name}
*/
public IChiselMode getMode(ItemStack chisel, String name);
}
@@ -1,44 +1,42 @@
package com.cricketcraft.chisel.api;
import net.minecraft.world.IBlockAccess;
import team.chisel.ctmlib.ICTMBlock;
import team.chisel.ctmlib.ISubmapManager;
import net.minecraft.world.IBlockAccess;
import com.cricketcraft.chisel.api.carving.CarvableHelper;
import com.cricketcraft.chisel.api.carving.IVariationInfo;
/**
* To be implemented on blocks that can be chiseled and need advanced metadata to variation mapping. Currently not very usable without internal classes.
* To be implemented on blocks that can be chiseled and need advanced metadata to variation mapping. Currently not very
* usable without internal classes.
*/
public interface ICarvable extends ICTMBlock<IVariationInfo> {
/**
* Gets a {@link ISubmapManager} from this block, based on metadata.
* <p>
* Typically you can refer this method to {@link CarvableHelper#getVariation(int)} but this method is provided for more complex metadata handling.
*
* @param metadata
* The metadata of the block
* @param world
* {@link IBlockAccess} object, usually a world. Use of {@link IBlockAccess} Is necessary due to this method's use in rendering.
* @param x
* X coord of the block
* @param y
* Y coord of the block
* @param z
* Z coord of the block
* @param metadata
* The metadata of the block
* @return The {@link ISubmapManager} that represents this block in the world.
*/
@Override
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata);
/**
* Gets a {@link ISubmapManager} from this block, based on metadata.
* <p>
* Typically you can refer this method to {@link CarvableHelper#getVariation(int)} but this method is provided for
* more complex metadata handling.
*
* @param metadata The metadata of the block
* @param world {@link IBlockAccess} object, usually a world. Use of {@link IBlockAccess} Is necessary due to
* this method's use in rendering.
* @param x X coord of the block
* @param y Y coord of the block
* @param z Z coord of the block
* @param metadata The metadata of the block
* @return The {@link ISubmapManager} that represents this block in the world.
*/
@Override
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata);
/**
* Gets the {@link ISubmapManager} for this block when it is in item form.
*
* @return A {@link ISubmapManager}
*/
@Override
public IVariationInfo getManager(int meta);
/**
* Gets the {@link ISubmapManager} for this block when it is in item form.
*
* @return A {@link ISubmapManager}
*/
@Override
public IVariationInfo getManager(int meta);
}
@@ -12,74 +12,60 @@ import com.cricketcraft.chisel.api.carving.ICarvingVariation;
*/
public interface IChiselItem {
/**
* Checks whether the chisel can have its GUI opened
*
* @param world
* {@link World} object
* @param player
* The player holding the chisel. It can always be assumed that the player's current item will be this.
* @param chisel
* The {@link ItemStack} representing your chisel
* @return True if the GUI should open. False otherwise.
*/
boolean canOpenGui(World world, EntityPlayer player, ItemStack chisel);
/**
* Checks whether the chisel can have its GUI opened
*
* @param world {@link World} object
* @param player The player holding the chisel. It can always be assumed that the player's current item will be
* this.
* @param chisel The {@link ItemStack} representing your chisel
* @return True if the GUI should open. False otherwise.
*/
boolean canOpenGui(World world, EntityPlayer player, ItemStack chisel);
/**
* Called when an item is chiseled using this chisel
*
* @param world
* {@link World} object
* @param chisel
* The {@link ItemStack} representing the chisel
* @param target
* The {@link ICarvingVariation} representing the target item
* @return True if the chisel should be damaged. False otherwise.
*/
boolean onChisel(World world, ItemStack chisel, ICarvingVariation target);
/**
* Called when an item is chiseled using this chisel
*
* @param world {@link World} object
* @param chisel The {@link ItemStack} representing the chisel
* @param target The {@link ICarvingVariation} representing the target item
* @return True if the chisel should be damaged. False otherwise.
*/
boolean onChisel(World world, ItemStack chisel, ICarvingVariation target);
/**
* Called to check if this {@link ItemStack} can be chiseled in this chisel. If not, there will be no possible variants displayed in the GUI.
* <p>
* It is not necessary to take into account whether this item <i>has</i> any variants, this method will only be called after that check.
*
* @param world
* {@link World} object
* @param chisel
* The {@link ItemStack} representing the chisel
* @param target
* The {@link ICarvingVariation} representing the target item
* @return True if the current target can be chiseled into anything. False otherwise.
*/
boolean canChisel(World world, ItemStack chisel, ICarvingVariation target);
/**
* Called to check if this {@link ItemStack} can be chiseled in this chisel. If not, there will be no possible
* variants displayed in the GUI.
* <p>
* It is not necessary to take into account whether this item <i>has</i> any variants, this method will only be
* called after that check.
*
* @param world {@link World} object
* @param chisel The {@link ItemStack} representing the chisel
* @param target The {@link ICarvingVariation} representing the target item
* @return True if the current target can be chiseled into anything. False otherwise.
*/
boolean canChisel(World world, ItemStack chisel, ICarvingVariation target);
/**
* Allows you to control if your item can chisel this block in the world.
*
* @param world
* World object
* @param player
* {@link EntityPlayer The player} holding the chisel.
* @param x
* X coord of the block being chiseled
* @param y
* Y coord of the block being chiseled
* @param z
* Z coord of the block being chiseled
* @param block
* The {@link Block} being chiseled
* @param metadata
* The blocks' metadata
* @return True if the chiseling should take place. False otherwise.
*/
boolean canChiselBlock(World world, EntityPlayer player, int x, int y, int z, Block block, int metadata);
/**
* Allows you to control if your item can chisel this block in the world.
*
* @param world World object
* @param player {@link EntityPlayer The player} holding the chisel.
* @param x X coord of the block being chiseled
* @param y Y coord of the block being chiseled
* @param z Z coord of the block being chiseled
* @param block The {@link Block} being chiseled
* @param metadata The blocks' metadata
* @return True if the chiseling should take place. False otherwise.
*/
boolean canChiselBlock(World world, EntityPlayer player, int x, int y, int z, Block block, int metadata);
/**
* Allows you to control if your item has chiseling modes.
*
* @param chisel
* The {@link ItemStack} representing the chisel.
* @return True if the chisel supports modes. False otherwise.
*/
boolean hasModes(ItemStack chisel);
/**
* Allows you to control if your item has chiseling modes.
*
* @param chisel The {@link ItemStack} representing the chisel.
* @return True if the chisel supports modes. False otherwise.
*/
boolean hasModes(ItemStack chisel);
}
@@ -7,20 +7,16 @@ import net.minecraft.world.IBlockAccess;
*/
public interface IConnectable {
/**
* Determines whether other CTM blocks can connect to this one.
*
* @param world
* @param x
* The X position of the block that is connecting to this one. NOT the position of your block.
* @param y
* The Y position of the block that is connecting to this one. NOT the position of your block.
* @param z
* The Z position of the block that is connecting to this one. NOT the position of your block.
* @param side
* The side being drawn.
* @return True if a block can connect to this one from the given direction. False otherwise.
*/
boolean canConnectCTM(IBlockAccess world, int x, int y, int z, int side);
/**
* Determines whether other CTM blocks can connect to this one.
*
* @param world
* @param x The X position of the block that is connecting to this one. NOT the position of your block.
* @param y The Y position of the block that is connecting to this one. NOT the position of your block.
* @param z The Z position of the block that is connecting to this one. NOT the position of your block.
* @param side The side being drawn.
* @return True if a block can connect to this one from the given direction. False otherwise.
*/
boolean canConnectCTM(IBlockAccess world, int x, int y, int z, int side);
}
@@ -9,41 +9,31 @@ import net.minecraft.world.World;
*/
public interface IFacade {
/**
* Gets the block this facade is acting as.
*
* @param world
* {@link World}
* @param x
* X coord of your block
* @param y
* Y coord of your block
* @param z
* Z coord of your block
* @param side
* The side being rendered, NOT the side being connected from.
* <p>
* This value can be -1 if no side is specified. Please handle this appropriately.
* @return The block inside of your facade block.
*/
Block getFacade(IBlockAccess world, int x, int y, int z, int side);
/**
* Gets the block this facade is acting as.
*
* @param world {@link World}
* @param x X coord of your block
* @param y Y coord of your block
* @param z Z coord of your block
* @param side The side being rendered, NOT the side being connected from.
* <p>
* This value can be -1 if no side is specified. Please handle this appropriately.
* @return The block inside of your facade block.
*/
Block getFacade(IBlockAccess world, int x, int y, int z, int side);
/**
* Gets the metadata of the block that this facade is acting as.
*
* @param world
* {@link World}
* @param x
* X coord of your block
* @param y
* Y coord of your block
* @param z
* Z coord of your block
* @param side
* The side being rendered, NOT the side being connected from.
* <p>
* This value can be -1 if no side is specified. Please handle this appropriately.
* @return The metadata of your facade block.
*/
int getFacadeMetadata(IBlockAccess world, int x, int y, int z, int side);
}
/**
* Gets the metadata of the block that this facade is acting as.
*
* @param world {@link World}
* @param x X coord of your block
* @param y Y coord of your block
* @param z Z coord of your block
* @param side The side being rendered, NOT the side being connected from.
* <p>
* This value can be -1 if no side is specified. Please handle this appropriately.
* @return The metadata of your facade block.
*/
int getFacadeMetadata(IBlockAccess world, int x, int y, int z, int side);
}
@@ -1,64 +1,69 @@
package com.cricketcraft.chisel.api;
/**
* Use the enum constants (using {@link #key} or calling {@link #toString()}) in this class as keys for IMC messages sent to chisel
* Use the enum constants (using {@link #key} or calling {@link #toString()}) in this class as keys for IMC messages
* sent to chisel
* <p>
* It is also acceptable to copy the Strings in this class to avoid referencing this API.
*/
public enum IMC {
/**
* Adds a variation to a group.
*
* Use this to add a variation to a group. String syntax:
* <p>
* groupname|blockname|meta
* <p>
* An example would be {@code "mygroup|minecraft:dirt|1"} and this will add the vanilla dirt block with metadata 1 to the "mygroup" group, creating that group if need be.
*/
ADD_VARIATION("variation:add"),
/**
* Adds a variation to a group.
*
* Use this to add a variation to a group. String syntax:
* <p>
* groupname|blockname|meta
* <p>
* An example would be {@code "mygroup|minecraft:dirt|1"} and this will add the vanilla dirt block with metadata 1
* to the "mygroup" group, creating that group if need be.
*/
ADD_VARIATION("variation:add"),
/**
* Removes a variation from a group.
*
* Use this to remove a variation from a group. String syntax:
* <p>
* groupname|blockname|meta
* <p>
* An example would be {@code "mygroup|minecraft:dirt|1"} and this will add the vanilla dirt block with metadata 1 to the "mygroup" group, creating that group if need be.
*/
REMOVE_VARIATION("variation:remove"),
/**
* Removes a variation from a group.
*
* Use this to remove a variation from a group. String syntax:
* <p>
* groupname|blockname|meta
* <p>
* An example would be {@code "mygroup|minecraft:dirt|1"} and this will add the vanilla dirt block with metadata 1
* to the "mygroup" group, creating that group if need be.
*/
REMOVE_VARIATION("variation:remove"),
/**
* Registers an oredict name to a group. This can be used to automatically add all blocks with this oredict name to a group. String syntax:
* <p>
* groupname|oredictname
* <p>
* An example would be {@code "mygroup|plankWood"} which will add all blocks registered in the oredict as "plankWood" to your group called "mygroup".
*/
REGISTER_GROUP_ORE("group:ore");
/**
* Registers an oredict name to a group. This can be used to automatically add all blocks with this oredict name to
* a group. String syntax:
* <p>
* groupname|oredictname
* <p>
* An example would be {@code "mygroup|plankWood"} which will add all blocks registered in the oredict as
* "plankWood" to your group called "mygroup".
*/
REGISTER_GROUP_ORE("group:ore");
/**
* The IMC message key for this message type.
*/
public final String key;
/**
* The IMC message key for this message type.
*/
public final String key;
IMC(String key) {
this.key = key;
}
IMC(String key) {
this.key = key;
}
@Override
public String toString() {
return key;
}
@Override
public String toString() {
return key;
}
/**
* The modid of Chisel so you can easily send IMC to this mod.
*/
@Deprecated
public static final String CHISEL_MODID = "chisel";
/**
* The modid of Chisel so you can easily send IMC to this mod.
*/
@Deprecated
public static final String CHISEL_MODID = "chisel";
public static final String getModid() {
return ChiselAPIProps.MOD_ID;
}
public static final String getModid() {
return ChiselAPIProps.MOD_ID;
}
}
@@ -6,10 +6,12 @@ import net.minecraft.util.ChatComponentTranslation;
public class Statistics {
public static StatBase blocksChiseled = (new StatBasic("stat.blockChiseled", new ChatComponentTranslation("stat.blockChiseled", new Object[0])));
public static StatBase blocksChiseled = (new StatBasic(
"stat.blockChiseled",
new ChatComponentTranslation("stat.blockChiseled", new Object[0])));
public static void init() {
blocksChiseled.initIndependentStat();
blocksChiseled.registerStat();
}
public static void init() {
blocksChiseled.initIndependentStat();
blocksChiseled.registerStat();
}
}
@@ -14,6 +14,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.oredict.OreDictionary;
import team.chisel.ctmlib.ISubmapManager;
import com.cricketcraft.chisel.api.ChiselAPIProps;
@@ -27,197 +28,197 @@ import cpw.mods.fml.relauncher.SideOnly;
public class CarvableHelper {
public static Class<? extends ItemBlock> itemCarvableClass = null;
public static Class<? extends ItemBlock> itemCarvableClass = null;
private Block theBlock;
private Block theBlock;
public ArrayList<IVariationInfo> infoList = new ArrayList<IVariationInfo>();
IVariationInfo[] infoMap = new IVariationInfo[16];
public boolean forbidChiseling = false;
public ArrayList<IVariationInfo> infoList = new ArrayList<IVariationInfo>();
IVariationInfo[] infoMap = new IVariationInfo[16];
public boolean forbidChiseling = false;
public CarvableHelper(Block block) {
this.theBlock = block;
}
public CarvableHelper(Block block) {
this.theBlock = block;
}
public void addVariation(String description, int metadata, ISubmapManager manager) {
addVariation(description, metadata, null, manager);
}
public void addVariation(String description, int metadata, ISubmapManager manager) {
addVariation(description, metadata, null, manager);
}
public void addVariation(String description, int metadata, Block bb) {
addVariation(description, metadata, null, bb, 0, ChiselAPIProps.MOD_ID);
}
public void addVariation(String description, int metadata, Block bb) {
addVariation(description, metadata, null, bb, 0, ChiselAPIProps.MOD_ID);
}
public void addVariation(String description, int metadata, Block bb, int blockMeta) {
addVariation(description, metadata, null, bb, blockMeta, ChiselAPIProps.MOD_ID);
}
public void addVariation(String description, int metadata, Block bb, int blockMeta) {
addVariation(description, metadata, null, bb, blockMeta, ChiselAPIProps.MOD_ID);
}
public void addVariation(String description, int metadata, Block bb, int blockMeta, Material material) {
addVariation(description, metadata, null, bb, blockMeta, ChiselAPIProps.MOD_ID);
}
public void addVariation(String description, int metadata, Block bb, int blockMeta, Material material) {
addVariation(description, metadata, null, bb, blockMeta, ChiselAPIProps.MOD_ID);
}
public void addVariation(String description, int metadata, String texture) {
addVariation(description, metadata, texture, (ISubmapManager) null);
}
public void addVariation(String description, int metadata, String texture) {
addVariation(description, metadata, texture, (ISubmapManager) null);
}
public void addVariation(String description, int metadata, String texture, ISubmapManager manager) {
addVariation(description, metadata, texture, null, 0, ChiselAPIProps.MOD_ID, manager, metadata);
}
public void addVariation(String description, int metadata, String texture, ISubmapManager manager) {
addVariation(description, metadata, texture, null, 0, ChiselAPIProps.MOD_ID, manager, metadata);
}
public void addVariation(String description, int metadata, Block bb, String modid) {
addVariation(description, metadata, null, bb, 0, modid);
}
public void addVariation(String description, int metadata, Block bb, String modid) {
addVariation(description, metadata, null, bb, 0, modid);
}
public void addVariation(String description, int metadata, Block bb, int blockMeta, String modid) {
addVariation(description, metadata, null, bb, blockMeta, modid);
}
public void addVariation(String description, int metadata, Block bb, int blockMeta, String modid) {
addVariation(description, metadata, null, bb, blockMeta, modid);
}
public void addVariation(String description, int metadata, Block bb, int blockMeta, Material material, String modid) {
addVariation(description, metadata, null, bb, blockMeta, modid);
}
public void addVariation(String description, int metadata, Block bb, int blockMeta, Material material,
String modid) {
addVariation(description, metadata, null, bb, blockMeta, modid);
}
public void addVariation(String description, int metadata, String texture, String modid) {
addVariation(description, metadata, texture, null, 0, modid);
}
public void addVariation(String description, int metadata, String texture, String modid) {
addVariation(description, metadata, texture, null, 0, modid);
}
public void addVariation(String description, int metadata, String texture, Block block, int blockMeta, String modid) {
addVariation(description, metadata, texture, block, blockMeta, modid, null, metadata);
}
public void addVariation(String description, int metadata, String texture, Block block, int blockMeta,
String modid) {
addVariation(description, metadata, texture, block, blockMeta, modid, null, metadata);
}
public void addVariation(String description, int metadata, String texture, int order) {
addVariation(description, metadata, texture, null, 0, ChiselAPIProps.MOD_ID, (ISubmapManager) null, order);
}
public void addVariation(String description, int metadata, String texture, int order) {
addVariation(description, metadata, texture, null, 0, ChiselAPIProps.MOD_ID, (ISubmapManager) null, order);
}
public void addVariation(String description, int metadata, String texture, Block block, int blockMeta, String modid, ISubmapManager customManager, int order) {
public void addVariation(String description, int metadata, String texture, Block block, int blockMeta, String modid,
ISubmapManager customManager, int order) {
if (infoList.size() >= 16)
return;
if (infoList.size() >= 16) return;
IVariationInfo info = FMLCommonHandler.instance().getSide().isClient() ? getClientInfo(modid, texture, description, metadata, block, blockMeta, customManager, order) : getServerInfo(modid,
texture, description, metadata, block, blockMeta, customManager, order);
IVariationInfo info = FMLCommonHandler.instance().getSide().isClient()
? getClientInfo(modid, texture, description, metadata, block, blockMeta, customManager, order)
: getServerInfo(modid, texture, description, metadata, block, blockMeta, customManager, order);
infoList.add(info);
infoMap[metadata] = info;
}
infoList.add(info);
infoMap[metadata] = info;
}
private IVariationInfo getClientInfo(String modid, String texture, String description, int metadata, Block block, int blockMeta, ISubmapManager customManager, int order) {
ICarvingVariation var = CarvingUtils.getDefaultVariationFor(getBlock(), metadata, order);
TextureType type = TextureType.getTypeFor(this, modid, texture);
if (type == TextureType.CUSTOM && customManager == null && block == null) {
throw new IllegalArgumentException(String.format("Could not find texture %s, and no custom texture manager was provided.", texture));
}
private IVariationInfo getClientInfo(String modid, String texture, String description, int metadata, Block block,
int blockMeta, ISubmapManager customManager, int order) {
ICarvingVariation var = CarvingUtils.getDefaultVariationFor(getBlock(), metadata, order);
TextureType type = TextureType.getTypeFor(this, modid, texture);
if (type == TextureType.CUSTOM && customManager == null && block == null) {
throw new IllegalArgumentException(
String.format("Could not find texture %s, and no custom texture manager was provided.", texture));
}
ISubmapManager manager;
if (customManager != null) {
manager = customManager;
} else if (block != null) {
manager = type.createManagerFor(var, block, blockMeta);
} else {
manager = type.createManagerFor(var, texture);
}
return new VariationInfoBase(var, description, manager, type);
}
ISubmapManager manager;
if (customManager != null) {
manager = customManager;
} else if (block != null) {
manager = type.createManagerFor(var, block, blockMeta);
} else {
manager = type.createManagerFor(var, texture);
}
return new VariationInfoBase(var, description, manager, type);
}
private IVariationInfo getServerInfo(String modid, String texture, String description, int metadata, Block block, int blockMeta, ISubmapManager customManager, int order) {
ICarvingVariation var = CarvingUtils.getDefaultVariationFor(getBlock(), metadata, order);
return new VariationInfoBase(var, description, null);
}
private IVariationInfo getServerInfo(String modid, String texture, String description, int metadata, Block block,
int blockMeta, ISubmapManager customManager, int order) {
ICarvingVariation var = CarvingUtils.getDefaultVariationFor(getBlock(), metadata, order);
return new VariationInfoBase(var, description, null);
}
public IVariationInfo getVariation(int metadata) {
if (metadata < 0 || metadata > 15)
metadata = 0;
public IVariationInfo getVariation(int metadata) {
if (metadata < 0 || metadata > 15) metadata = 0;
IVariationInfo info = infoMap[metadata];
if (info == null)
return null;
IVariationInfo info = infoMap[metadata];
if (info == null) return null;
return info;
}
return info;
}
public IIcon getIcon(int side, int metadata) {
if (metadata < 0 || metadata > 15)
metadata = 0;
public IIcon getIcon(int side, int metadata) {
if (metadata < 0 || metadata > 15) metadata = 0;
IVariationInfo info = infoMap[metadata];
if (info == null)
return getMissingIcon();
IVariationInfo info = infoMap[metadata];
if (info == null) return getMissingIcon();
return info.getIcon(side, metadata);
}
return info.getIcon(side, metadata);
}
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
int metadata = world.getBlockMetadata(x, y, z);
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
int metadata = world.getBlockMetadata(x, y, z);
if (metadata < 0 || metadata > 15)
metadata = 0;
if (metadata < 0 || metadata > 15) metadata = 0;
IVariationInfo info = infoMap[metadata];
if (info == null)
return getMissingIcon();
IVariationInfo info = infoMap[metadata];
if (info == null) return getMissingIcon();
return info.getIcon(world, x, y, z, side);
}
return info.getIcon(world, x, y, z, side);
}
public void registerAll(Block block, String name) {
registerAll(block, name, itemCarvableClass);
}
public void registerAll(Block block, String name) {
registerAll(block, name, itemCarvableClass);
}
public void registerBlock(Block block, String name) {
registerBlock(block, name, itemCarvableClass);
}
public void registerBlock(Block block, String name) {
registerBlock(block, name, itemCarvableClass);
}
void registerBlock(Block block, String name, Class<? extends ItemBlock> cl) {
block.setBlockName("chisel." + name);
GameRegistry.registerBlock(block, cl, name);
}
void registerBlock(Block block, String name, Class<? extends ItemBlock> cl) {
block.setBlockName("chisel." + name);
GameRegistry.registerBlock(block, cl, name);
}
public void registerAll(Block block, String name, Class<? extends ItemBlock> cl) {
registerBlock(block, name, cl);
registerVariations(name);
}
public void registerAll(Block block, String name, Class<? extends ItemBlock> cl) {
registerBlock(block, name, cl);
registerVariations(name);
}
public void registerVariations(String name) {
for (IVariationInfo info : infoList) {
registerVariation(name, info);
}
}
public void registerVariations(String name) {
for (IVariationInfo info : infoList) {
registerVariation(name, info);
}
}
public void registerVariation(String name, IVariationInfo info) {
public void registerVariation(String name, IVariationInfo info) {
Block block = info.getVariation().getBlock();
Block block = info.getVariation().getBlock();
if (block.renderAsNormalBlock() || block.isOpaqueCube() || block.isNormalCube()) {
FMPIMC.registerFMP(block, info.getVariation().getBlockMeta());
}
if (block.renderAsNormalBlock() || block.isOpaqueCube() || block.isNormalCube()) {
FMPIMC.registerFMP(block, info.getVariation().getBlockMeta());
}
if (forbidChiseling)
return;
if (forbidChiseling) return;
CarvingUtils.getChiselRegistry().addVariation(name, info.getVariation());
}
CarvingUtils.getChiselRegistry().addVariation(name, info.getVariation());
}
@SideOnly(Side.CLIENT)
public void registerBlockIcons(String modName, Block block, IIconRegister register) {
for (IVariationInfo info : infoList) {
info.registerIcons(modName, block, register);
}
}
@SideOnly(Side.CLIENT)
public void registerBlockIcons(String modName, Block block, IIconRegister register) {
for (IVariationInfo info : infoList) {
info.registerIcons(modName, block, register);
}
}
public void registerSubBlocks(Block block, CreativeTabs tabs, List<ItemStack> list) {
for (IVariationInfo info : infoList) {
list.add(new ItemStack(block, 1, info.getVariation().getItemMeta()));
}
}
public void registerSubBlocks(Block block, CreativeTabs tabs, List<ItemStack> list) {
for (IVariationInfo info : infoList) {
list.add(new ItemStack(block, 1, info.getVariation().getItemMeta()));
}
}
public void registerOre(String ore) {
OreDictionary.registerOre(ore, getBlock());
}
public void registerOre(String ore) {
OreDictionary.registerOre(ore, getBlock());
}
@SideOnly(Side.CLIENT)
public IIcon getMissingIcon() {
return ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite("missingno");
}
public Block getBlock() {
return theBlock;
}
@SideOnly(Side.CLIENT)
public IIcon getMissingIcon() {
return ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture))
.getAtlasSprite("missingno");
}
public Block getBlock() {
return theBlock;
}
}
@@ -11,166 +11,163 @@ import com.google.common.collect.Lists;
public class CarvingUtils {
/**
* A simple way to compare two {@link ICarvingVariation} objects based on the {@link ICarvingVariation#getOrder() getOrder()} method.
*
* @param v1
* The first {@link ICarvingVariation variation}.
* @param v2
* The second {@link ICarvingVariation variation}.
* @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();
}
/**
* A simple way to compare two {@link ICarvingVariation} objects based on the {@link ICarvingVariation#getOrder()
* getOrder()} method.
*
* @param v1 The first {@link ICarvingVariation variation}.
* @param v2 The second {@link ICarvingVariation variation}.
* @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();
}
/**
* Gets an {@link ItemStack} representing the passed {@link ICarvingVariation}.
*
* @param variation
* An {@link ICarvingVariation}
* @return An {@link ItemStack}
*/
public static ItemStack getStack(ICarvingVariation variation) {
return new ItemStack(variation.getBlock(), 1, variation.getItemMeta());
}
/**
* Gets an {@link ItemStack} representing the passed {@link ICarvingVariation}.
*
* @param variation An {@link ICarvingVariation}
* @return An {@link ItemStack}
*/
public static ItemStack getStack(ICarvingVariation variation) {
return new ItemStack(variation.getBlock(), 1, variation.getItemMeta());
}
public static ICarvingRegistry chisel;
public static ICarvingRegistry chisel;
/**
* @return The instance of the chisel carving registry from the chisel mod.
* <p>
* If chisel is not installed this will return null.
*/
public static ICarvingRegistry getChiselRegistry() {
return chisel;
}
/**
* @return The instance of the chisel carving registry from the chisel mod.
* <p>
* If chisel is not installed this will return null.
*/
public static ICarvingRegistry getChiselRegistry() {
return chisel;
}
/**
* Creates a standard {@link ICarvingVariation} for the given data. Use this if you do not need any custom behavior in your own variation.
*
* @param block
* The block of the variation
* @param metadata
* The metadata of both the block and item
* @param order
* The sorting order.
* @return A standard {@link ICarvingVariation} instance.
*/
public static ICarvingVariation getDefaultVariationFor(Block block, int metadata, int order) {
return new SimpleCarvingVariation(block, metadata, order);
}
/**
* Creates a standard {@link ICarvingVariation} for the given data. Use this if you do not need any custom behavior
* in your own variation.
*
* @param block The block of the variation
* @param metadata The metadata of both the block and item
* @param order The sorting order.
* @return A standard {@link ICarvingVariation} instance.
*/
public static ICarvingVariation getDefaultVariationFor(Block block, int metadata, int order) {
return new SimpleCarvingVariation(block, metadata, order);
}
/**
* Creates a standard {@link ICarvingGroup} for the given name. Use this if you do not need any custom behavior in your own group.
*
* @param name
* The name of the group.
* @return A standard {@link ICarvingGroup} instance.
*/
public static ICarvingGroup getDefaultGroupFor(String name) {
return new SimpleCarvingGroup(name);
}
/**
* Creates a standard {@link ICarvingGroup} for the given name. Use this if you do not need any custom behavior in
* your own group.
*
* @param name The name of the group.
* @return A standard {@link ICarvingGroup} instance.
*/
public static ICarvingGroup getDefaultGroupFor(String name) {
return new SimpleCarvingGroup(name);
}
public static class SimpleCarvingVariation implements ICarvingVariation {
public static class SimpleCarvingVariation implements ICarvingVariation {
private int order;
private Block block;
private int meta;
private int damage;
private int order;
private Block block;
private int meta;
private int damage;
public SimpleCarvingVariation(Block block, int metadata, int order) {
this.order = order;
this.block = block;
this.meta = metadata;
this.damage = metadata;
}
public SimpleCarvingVariation(Block block, int metadata, int order) {
this.order = order;
this.block = block;
this.meta = metadata;
this.damage = metadata;
}
@Override
public Block getBlock() {
return block;
}
@Override
public Block getBlock() {
return block;
}
@Override
public int getBlockMeta() {
return meta;
}
@Override
public int getBlockMeta() {
return meta;
}
@Override
public int getItemMeta() {
return damage;
}
@Override
public int getItemMeta() {
return damage;
}
@Override
public int getOrder() {
return order;
}
}
@Override
public int getOrder() {
return order;
}
}
public static class SimpleCarvingGroup implements ICarvingGroup {
public static class SimpleCarvingGroup implements ICarvingGroup {
private String name;
private String sound;
private String oreName;
private String name;
private String sound;
private String oreName;
private List<ICarvingVariation> variations = Lists.newArrayList();
private List<ICarvingVariation> variations = Lists.newArrayList();
public SimpleCarvingGroup(String name) {
this.name = name;
}
public SimpleCarvingGroup(String name) {
this.name = name;
}
@Override
public List<ICarvingVariation> getVariations() {
return Lists.newArrayList(variations);
}
@Override
public List<ICarvingVariation> getVariations() {
return Lists.newArrayList(variations);
}
@Override
public void addVariation(ICarvingVariation variation) {
variations.add(variation);
Collections.sort(variations, new Comparator<ICarvingVariation>() {
@Override
public void addVariation(ICarvingVariation variation) {
variations.add(variation);
Collections.sort(variations, new Comparator<ICarvingVariation>() {
@Override
public int compare(ICarvingVariation o1, ICarvingVariation o2) {
return CarvingUtils.compare(o1, o2);
}
});
}
@Override
public int compare(ICarvingVariation o1, ICarvingVariation o2) {
return CarvingUtils.compare(o1, o2);
}
});
}
@Override
public boolean removeVariation(ICarvingVariation variation) {
ICarvingVariation toRemove = null;
for (ICarvingVariation v : variations) {
if (v.getBlock() == variation.getBlock() && v.getBlockMeta() == variation.getBlockMeta()) {
toRemove = v;
}
}
return toRemove == null ? false : variations.remove(toRemove);
}
@Override
public boolean removeVariation(ICarvingVariation variation) {
ICarvingVariation toRemove = null;
for (ICarvingVariation v : variations) {
if (v.getBlock() == variation.getBlock() && v.getBlockMeta() == variation.getBlockMeta()) {
toRemove = v;
}
}
return toRemove == null ? false : variations.remove(toRemove);
}
@Override
public String getName() {
return name;
}
@Override
public String getName() {
return name;
}
@Override
public String getSound() {
return sound;
}
@Override
public String getSound() {
return sound;
}
@Override
public void setSound(String sound) {
this.sound = sound;
}
@Override
public void setSound(String sound) {
this.sound = sound;
}
@Override
public String getOreName() {
return oreName;
}
@Override
public String getOreName() {
return oreName;
}
@Override
public void setOreName(String oreName) {
this.oreName = oreName;
}
}
@Override
public void setOreName(String oreName) {
this.oreName = oreName;
}
}
}
@@ -5,70 +5,69 @@ import java.util.List;
/**
* Represents a group of chiselable blocks.
* <p>
* This is an object that contains a collection of {@link ICarvingVariation} objects, and keeps them sorted. You may sort them in any way (or not at all), and {@link ICarvingVariation#getOrder()} will
* likely be of use to do so.
* This is an object that contains a collection of {@link ICarvingVariation} objects, and keeps them sorted. You may
* sort them in any way (or not at all), and {@link ICarvingVariation#getOrder()} will likely be of use to do so.
* <p>
* It also defines what sound and oredict name the group as a whole has.
*/
public interface ICarvingGroup {
/**
* The name of this group. Used for internal identification.
*
* @return A string name for the group
*/
String getName();
/**
* 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();
/**
* 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);
/**
* 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();
/**
* 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);
/**
* 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();
/**
* 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. Do not call this from external code, as it will fail to remove the inverse lookup from the registry.
*
* @param variation
* An {@link ICarvingVariation} to add to this group
*/
void addVariation(ICarvingVariation variation);
/**
* Adds a variation to this group. Do not call this from external code, as it will fail to remove the inverse lookup
* from the registry.
*
* @param variation An {@link ICarvingVariation} to add to this group
*/
void addVariation(ICarvingVariation variation);
/**
* Removes a variation to this group. Do not call this from external code, as it will fail to remove the inverse lookup from the registry.
*
* @param variation
* An {@link ICarvingVariation} to add to this group
*/
boolean removeVariation(ICarvingVariation variation);
/**
* Removes a variation to this group. Do not call this from external code, as it will fail to remove the inverse
* lookup from the registry.
*
* @param variation An {@link ICarvingVariation} to add to this group
*/
boolean removeVariation(ICarvingVariation variation);
}
@@ -14,191 +14,168 @@ import net.minecraft.world.World;
*/
public interface ICarvingRegistry {
/* Getters */
/* Getters */
/**
* Finds the group the block/meta pair belongs to in the registry.
*
* @param block
* The block of the variation
* @param meta
* The metadata of the variation
* @return The {@link ICarvingGroup} that the block/meta pair belongs to
*/
ICarvingGroup getGroup(Block block, int meta);
/**
* Finds the group the block/meta pair belongs to in the registry.
*
* @param block The block of the variation
* @param meta The metadata of the variation
* @return The {@link ICarvingGroup} that the block/meta pair belongs to
*/
ICarvingGroup getGroup(Block block, int meta);
/**
* Gets an {@link ICarvingGroup} by its name.
*
* @param name
* The name of the group
* @return An {@link ICarvingGroup}
*/
ICarvingGroup getGroup(String name);
/**
* Gets an {@link ICarvingGroup} by its name.
*
* @param name The name of the group
* @return An {@link ICarvingGroup}
*/
ICarvingGroup getGroup(String name);
/**
* Gets the {@link ICarvingVariation} instance represented by this block/meta pair.
*
* @param block
* The block of the variatoin
* @param meta
* The metadata of the variation
* @return The {@link ICarvingVariation} containing this block/meta pair
*/
ICarvingVariation getVariation(Block block, int meta);
/**
* Gets the {@link ICarvingVariation} instance represented by this block/meta pair.
*
* @param block The block of the variatoin
* @param meta The metadata of the variation
* @return The {@link ICarvingVariation} containing this block/meta pair
*/
ICarvingVariation getVariation(Block block, int meta);
/**
* Gets the list of {@link ICarvingVariation}s from the group that contains this block/meta pair.
*
* @param block
* The block of the variation
* @param meta
* The metadata of the variation
* @return All of the {@link ICarvingVariation}s in the group that contains this block/meta pair
*/
List<ICarvingVariation> getGroupVariations(Block block, int meta);
/**
* Gets the list of {@link ICarvingVariation}s from the group that contains this block/meta pair.
*
* @param block The block of the variation
* @param meta The metadata of the variation
* @return All of the {@link ICarvingVariation}s in the group that contains this block/meta pair
*/
List<ICarvingVariation> getGroupVariations(Block block, int meta);
/**
* Gets the oredict name for the group that contains this block/meta pair.
*
* @param block
* The block of the variation
* @param meta
* The metadata of the variation
* @return A string oredict name for the group
*/
String getOreName(Block block, int meta);
/**
* Gets the oredict name for the group that contains this block/meta pair.
*
* @param block The block of the variation
* @param meta The metadata of the variation
* @return A string oredict name for the group
*/
String getOreName(Block block, int meta);
/**
* Gets the possible output items for this {@link ItemStack}. To be used for machines/GUIs that chisel items.
*
* @param chiseled
* The {@link ItemStack} being chiseled
* @return A list of stacks that can be chiseled from the passed {@link ItemStack stack}
*/
List<ItemStack> getItemsForChiseling(ItemStack chiseled);
/**
* Gets the possible output items for this {@link ItemStack}. To be used for machines/GUIs that chisel items.
*
* @param chiseled The {@link ItemStack} being chiseled
* @return A list of stacks that can be chiseled from the passed {@link ItemStack stack}
*/
List<ItemStack> getItemsForChiseling(ItemStack chiseled);
/**
* Gets the sound resource string for the group represented by this block/meta pair.
*
* @param block
* The block of the variation
* @param metadata
* The metadata of the variation
* @return The string resource for the sound that can be used in {@link World#playSound(double, double, double, String, float, float, boolean)} and other methods.
*/
public String getVariationSound(Block block, int metadata);
/**
* Gets the sound resource string for the group represented by this block/meta pair.
*
* @param block The block of the variation
* @param metadata The metadata of the variation
* @return The string resource for the sound that can be used in
* {@link World#playSound(double, double, double, String, float, float, boolean)} and other methods.
*/
public String getVariationSound(Block block, int metadata);
/**
* Gets the sound resource string for the group represented by this item/meta pair.
* <p>
* Mostly a convenience for calling {@link #getVariationSound(Block, int)} with {@link Block#getBlockFromItem(Item)}.
*
* @param item
* The item of the variation
* @param metadata
* The metadata of the variation
* @return The string resource for the sound that can be used in {@link World#playSound(double, double, double, String, float, float, boolean)} and other methods.
*/
public String getVariationSound(Item item, int metadata);
/**
* Gets the sound resource string for the group represented by this item/meta pair.
* <p>
* Mostly a convenience for calling {@link #getVariationSound(Block, int)} with
* {@link Block#getBlockFromItem(Item)}.
*
* @param item The item of the variation
* @param metadata The metadata of the variation
* @return The string resource for the sound that can be used in
* {@link World#playSound(double, double, double, String, float, float, boolean)} and other methods.
*/
public String getVariationSound(Item item, int metadata);
/**
* @return A list of all registered group names, sorted alphabetically.
*/
List<String> getSortedGroupNames();
/**
* @return A list of all registered group names, sorted alphabetically.
*/
List<String> getSortedGroupNames();
/* Setters */
/* Setters */
/**
* Adds a variation to the registry.
*
* @param groupName
* The name of the group to add to.
* @param block
* The block of the variation
* @param metadata
* The metadata of the variation
* @param order
* The order of the variation in the list of all variations in the group. Higher numbers are sorted at the end.
*/
void addVariation(String groupName, Block block, int metadata, int order);
/**
* Adds a variation to the registry.
*
* @param groupName The name of the group to add to.
* @param block The block of the variation
* @param metadata The metadata of the variation
* @param order The order of the variation in the list of all variations in the group. Higher numbers are sorted
* at the end.
*/
void addVariation(String groupName, Block block, int metadata, int order);
/**
* Adds a variation to the registry.
*
* @param groupName
* The name of the group to add to
* @param variation
* The {@link ICarvingVariation} to add
*/
void addVariation(String groupName, ICarvingVariation variation);
/**
* Adds a variation to the registry.
*
* @param groupName The name of the group to add to
* @param variation The {@link ICarvingVariation} to add
*/
void addVariation(String groupName, ICarvingVariation variation);
/**
* Adds a group to the registry.
*
* @param group
* The {@link ICarvingGroup} to add.
*/
void addGroup(ICarvingGroup group);
/**
* Adds a group to the registry.
*
* @param group The {@link ICarvingGroup} to add.
*/
void addGroup(ICarvingGroup group);
/**
* Removes a group from the registry.
* <p>
* This in effect removes all variations associated with the group, though they are not explicitly removed from the object. If you maintain a reference to the {@link ICarvingGroup} that is
* removed, it will still contain its variations.
*
* @param groupName
* The name of the group to remove.
* @return The {@link ICarvingGroup} that was removed.
*/
ICarvingGroup removeGroup(String groupName);
/**
* Removes a group from the registry.
* <p>
* This in effect removes all variations associated with the group, though they are not explicitly removed from the
* object. If you maintain a reference to the {@link ICarvingGroup} that is removed, it will still contain its
* variations.
*
* @param groupName The name of the group to remove.
* @return The {@link ICarvingGroup} that was removed.
*/
ICarvingGroup removeGroup(String groupName);
/**
* Removes a varaition with the passed {@link Block} and metadata from the registry. If this variation is registered with mutiple groups, it will remove it from all of them.
*
* @param block
* The {@link Block} of the {@link ICarvingVariation variation}
* @param metadata
* The metadata of the {@link ICarvingVariation variation}
* @return The ICarvingVariation that was removed. Null if nothing was removed.
*/
ICarvingVariation removeVariation(Block block, int metadata);
/**
* Removes a varaition with the passed {@link Block} and metadata from the registry. If this variation is registered
* with mutiple groups, it will remove it from all of them.
*
* @param block The {@link Block} of the {@link ICarvingVariation variation}
* @param metadata The metadata of the {@link ICarvingVariation variation}
* @return The ICarvingVariation that was removed. Null if nothing was removed.
*/
ICarvingVariation removeVariation(Block block, int metadata);
/**
* Removes a varaition with the passed {@link Block} and metadata from the registry, but only from the specified {@link ICarvingGroup} name.
*
* @param block
* The {@link Block} of the {@link ICarvingVariation variation}
* @param metadata
* The metadata of the {@link ICarvingVariation variation}
* @param group
* The name of the group that the variation should be removed from
* @return The ICarvingVariation that was removed. Null if nothing was removed.
*/
ICarvingVariation removeVariation(Block block, int metadata, String group);
/**
* Removes a varaition with the passed {@link Block} and metadata from the registry, but only from the specified
* {@link ICarvingGroup} name.
*
* @param block The {@link Block} of the {@link ICarvingVariation variation}
* @param metadata The metadata of the {@link ICarvingVariation variation}
* @param group The name of the group that the variation should be removed from
* @return The ICarvingVariation that was removed. Null if nothing was removed.
*/
ICarvingVariation removeVariation(Block block, int metadata, String group);
/**
* Registers a group to an oredict name.
* <p>
* Doing this means that all blocks that are registered to this oredict name will act as if they are a part of this group.
*
* @param groupName
* The name of the group
* @param oreName
* The oredict name
*/
void registerOre(String groupName, String oreName);
/**
* Registers a group to an oredict name.
* <p>
* Doing this means that all blocks that are registered to this oredict name will act as if they are a part of this
* group.
*
* @param groupName The name of the group
* @param oreName The oredict name
*/
void registerOre(String groupName, String oreName);
/**
* Sets the sound resource for a group.
* <p>
* This is the sound that is used when a block from this group is chiseled. <br/>
* Does <i>not</i> need to be explicitly set.
*
* @param name
* The name of the group
* @param sound
* The resource string for the sound
*/
void setVariationSound(String name, String sound);
/**
* Sets the sound resource for a group.
* <p>
* This is the sound that is used when a block from this group is chiseled. <br/>
* Does <i>not</i> need to be explicitly set.
*
* @param name The name of the group
* @param sound The resource string for the sound
*/
void setVariationSound(String name, String sound);
}
@@ -8,31 +8,31 @@ import net.minecraft.item.Item;
*/
public interface ICarvingVariation {
/**
* The base block of this variation.
*
* @return A {@link Block} that is the base of this variation
*/
Block getBlock();
/**
* The base block of this variation.
*
* @return A {@link Block} that is the base of this variation
*/
Block getBlock();
/**
* The metadata of this variation
*
* @return An int representing the metadata of this variation's {@link Block} in the world.
*/
int getBlockMeta();
/**
* The metadata of this variation
*
* @return An int representing the metadata of this variation's {@link Block} in the world.
*/
int getBlockMeta();
/**
* The item metadata of this variation
*
* @return An int representing the metadata of this variations's {@link Item}.
*/
int getItemMeta();
/**
* The item metadata of this variation
*
* @return An int representing the metadata of this variations's {@link Item}.
*/
int getItemMeta();
/**
* The "order" of this variation. Represents its position in the list of variations held by a group.
*
* @return An integer to represent the position of this variation in the list of all variations in the group
*/
int getOrder();
/**
* The "order" of this variation. Represents its position in the list of variations held by a group.
*
* @return An integer to represent the position of this variation in the list of all variations in the group
*/
int getOrder();
}
@@ -6,15 +6,17 @@ import net.minecraftforge.common.util.ForgeDirection;
public interface IChiselMode {
/**
* NOTE: This method is responsible for increasing the "Blocks Chiseled" statistic found in the Statistics class.
*/
void chiselAll(EntityPlayer player, World world, int x, int y, int z, ForgeDirection side, ICarvingVariation variation);
/**
* NOTE: This method is responsible for increasing the "Blocks Chiseled" statistic found in the Statistics class.
*/
void chiselAll(EntityPlayer player, World world, int x, int y, int z, ForgeDirection side,
ICarvingVariation variation);
/**
* Implemented implicitly by enums. If your IChiselMode is not an enum constant, this needs to be implemented explicitly.
*
* @return The name of the mode.
*/
String name();
/**
* Implemented implicitly by enums. If your IChiselMode is not an enum constant, this needs to be implemented
* explicitly.
*
* @return The name of the mode.
*/
String name();
}
@@ -6,9 +6,9 @@ import com.cricketcraft.chisel.api.rendering.TextureType;
public interface IVariationInfo extends ISubmapManager {
ICarvingVariation getVariation();
ICarvingVariation getVariation();
String getDescription();
String getDescription();
TextureType getType();
TextureType getType();
}
@@ -1,6 +1,5 @@
package com.cricketcraft.chisel.api.carving;
import team.chisel.ctmlib.ISubmapManager;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -9,70 +8,72 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
import team.chisel.ctmlib.ISubmapManager;
import com.cricketcraft.chisel.api.rendering.TextureType;
public class VariationInfoBase implements IVariationInfo {
private ICarvingVariation variation;
private String unlocDesc;
private ISubmapManager manager;
private TextureType type;
private ICarvingVariation variation;
private String unlocDesc;
private ISubmapManager manager;
private TextureType type;
public VariationInfoBase(ICarvingVariation variation, String unlocDesc, ISubmapManager manager) {
this(variation, unlocDesc, manager, TextureType.CUSTOM);
}
public VariationInfoBase(ICarvingVariation variation, String unlocDesc, ISubmapManager manager) {
this(variation, unlocDesc, manager, TextureType.CUSTOM);
}
public VariationInfoBase(ICarvingVariation variation, String unlocDesc, ISubmapManager manager, TextureType type) {
this.variation = variation;
this.unlocDesc = unlocDesc;
this.manager = manager;
this.type = type;
}
public VariationInfoBase(ICarvingVariation variation, String unlocDesc, ISubmapManager manager, TextureType type) {
this.variation = variation;
this.unlocDesc = unlocDesc;
this.manager = manager;
this.type = type;
}
@Override
public ICarvingVariation getVariation() {
return variation;
}
@Override
public ICarvingVariation getVariation() {
return variation;
}
@Override
public String getDescription() {
return StatCollector.translateToLocal(unlocDesc);
}
@Override
public String getDescription() {
return StatCollector.translateToLocal(unlocDesc);
}
@Override
public TextureType getType() {
return type;
}
@Override
public TextureType getType() {
return type;
}
// ISubmapManager delegation
// ISubmapManager delegation
@Override
public IIcon getIcon(int side, int meta) {
return manager.getIcon(side, meta);
}
@Override
public IIcon getIcon(int side, int meta) {
return manager.getIcon(side, meta);
}
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
return manager.getIcon(world, x, y, z, side);
}
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
return manager.getIcon(world, x, y, z, side);
}
@Override
public void registerIcons(String modName, Block block, IIconRegister register) {
manager.registerIcons(modName, block, register);
}
@Override
public void registerIcons(String modName, Block block, IIconRegister register) {
manager.registerIcons(modName, block, register);
}
@Override
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
return manager.createRenderContext(rendererOld, block, world);
}
@Override
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
return manager.createRenderContext(rendererOld, block, world);
}
@Override
public void preRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
manager.preRenderSide(renderer, world, x, y, z, side);
}
@Override
public void preRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
manager.preRenderSide(renderer, world, x, y, z, side);
}
@Override
public void postRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
manager.postRenderSide(renderer, world, x, y, z, side);
}
@Override
public void postRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
manager.postRenderSide(renderer, world, x, y, z, side);
}
}
@@ -2,6 +2,4 @@
package com.cricketcraft.chisel.api.carving;
import com.cricketcraft.chisel.api.ChiselAPIProps;
import cpw.mods.fml.common.API;
@@ -2,4 +2,3 @@
package com.cricketcraft.chisel.api;
import cpw.mods.fml.common.API;
@@ -2,6 +2,6 @@ package com.cricketcraft.chisel.api.rendering;
public class ClientUtils {
public static int renderCTMId;
public static int renderCTMId;
}
@@ -33,7 +33,7 @@ import cpw.mods.fml.relauncher.SideOnly;
@SuppressWarnings("unchecked")
public enum TextureType {
// @formatter:off
// @formatter:off
TOPBOTSIDE("top", "bottom", "side"){
@Override
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
@@ -2,6 +2,4 @@
package com.cricketcraft.chisel.api.rendering;
import com.cricketcraft.chisel.api.ChiselAPIProps;
import cpw.mods.fml.common.API;