From 7d0a63aba01090935976b2133445fd885ddd79c2 Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 15 Jan 2015 18:10:02 -0500 Subject: [PATCH 01/75] Added forgotten abyssal stone for railcraft --- src/main/java/com/cricketcraft/chisel/Features.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index edbc2fdb..185faa15 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -1723,7 +1723,20 @@ public enum Features { * Dummy feature for all RC subsets */ RAILCRAFT("Railcraft"), + + RC_ABYSSAL_BLOCK(RAILCRAFT.getRequiredMod(), RAILCRAFT) { + @Override + void addBlocks() { + Carving.chisel.addVariation("RCAbyssalBlock", GameRegistry.findBlock("Railcraft", "tile.railcraft.brick.abyssal"), 0, 0); + Carving.chisel.addVariation("RCAbyssalBlock", GameRegistry.findBlock("Railcraft", "tile.railcraft.brick.abyssal"), 1, 1); + Carving.chisel.addVariation("RCAbyssalBlock", GameRegistry.findBlock("Railcraft", "tile.railcraft.brick.abyssal"), 2, 2); + Carving.chisel.addVariation("RCAbyssalBlock", GameRegistry.findBlock("Railcraft", "tile.railcraft.brick.abyssal"), 3, 3); + Carving.chisel.addVariation("RCAbyssalBlock", GameRegistry.findBlock("Railcraft", "tile.railcraft.brick.abyssal"), 4, 4); + Carving.chisel.addVariation("RCAbyssalBlock", GameRegistry.findBlock("Railcraft", "tile.railcraft.brick.abyssal"), 5, 5); + Carving.chisel.registerOre("RCAbyssalBlock", "RCAbyssalBlock"); + }; + }, RC_BLEACHED_BONE(RAILCRAFT.getRequiredMod(), RAILCRAFT) { @Override From 0b9142f3ea2cb6f58ce88a1a8cfbe8141533ef29 Mon Sep 17 00:00:00 2001 From: warlordjones Date: Fri, 16 Jan 2015 13:48:12 +0000 Subject: [PATCH 02/75] Solution for #141. Smashing Rock had the same entity ID as Ball O' Moss --- src/main/java/com/cricketcraft/chisel/Features.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index 185faa15..62b3a8a7 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -1723,7 +1723,7 @@ public enum Features { * Dummy feature for all RC subsets */ RAILCRAFT("Railcraft"), - + RC_ABYSSAL_BLOCK(RAILCRAFT.getRequiredMod(), RAILCRAFT) { @Override @@ -1941,7 +1941,7 @@ public enum Features { @Override void addItems() { ItemSmashingRock smashingrock = (ItemSmashingRock) new ItemSmashingRock().setTextureName("Chisel:smashingrock").setCreativeTab(ChiselTabs.tabChisel); - EntityRegistry.registerModEntity(EntitySmashingRock.class, "SmashingRock", 2, Chisel.instance, 40, 1, true); + EntityRegistry.registerModEntity(EntitySmashingRock.class, "SmashingRock", 3, Chisel.instance, 40, 1, true); GameRegistry.registerItem(smashingrock, "smashingrock"); } From ab2b3e842146c7f5f75a564e219cff09ec138210 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Fri, 16 Jan 2015 22:43:19 -0500 Subject: [PATCH 03/75] Fix crash with Twilight Forest and add helpful exceptions to Carving --- .../java/com/cricketcraft/chisel/Chisel.java | 2 +- .../cricketcraft/chisel/carving/Carving.java | 222 +++++++++--------- 2 files changed, 116 insertions(+), 108 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/Chisel.java b/src/main/java/com/cricketcraft/chisel/Chisel.java index 0b3ec73e..09b60cfb 100644 --- a/src/main/java/com/cricketcraft/chisel/Chisel.java +++ b/src/main/java/com/cricketcraft/chisel/Chisel.java @@ -40,7 +40,7 @@ import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry.Type; -@Mod(modid = Chisel.MOD_ID, name = Chisel.MOD_NAME, version = Chisel.VERSION, guiFactory = "com.cricketcraft.chisel.client.gui.GuiFactory", dependencies = "after:ForgeMultipart;after:Thaumcraft;after:appliedenergistics2;after:Railcraft;after:AWWayofTime") +@Mod(modid = Chisel.MOD_ID, name = Chisel.MOD_NAME, version = Chisel.VERSION, guiFactory = "com.cricketcraft.chisel.client.gui.GuiFactory", dependencies = "after:ForgeMultipart;after:Thaumcraft;after:appliedenergistics2;after:Railcraft;after:AWWayofTime;after:TwilightForest") public class Chisel { public static final String MOD_ID = "chisel"; diff --git a/src/main/java/com/cricketcraft/chisel/carving/Carving.java b/src/main/java/com/cricketcraft/chisel/carving/Carving.java index 6caafb76..84b11c63 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/Carving.java +++ b/src/main/java/com/cricketcraft/chisel/carving/Carving.java @@ -16,144 +16,152 @@ import com.cricketcraft.chisel.api.carving.ICarvingVariation; public class Carving { - GroupList groups = new GroupList(); + GroupList groups = new GroupList(); - public static final Carving chisel = new Carving(); - public static final Carving needle = new Carving(); + public static final Carving chisel = new Carving(); + public static final Carving needle = new Carving(); - private Carving() { - } + private Carving() { + } - public List getVariations(Block block, int metadata) { - ICarvingGroup group = getGroup(block, metadata); - if (group == null) - return null; + public List getVariations(Block block, int metadata) { + ICarvingGroup group = getGroup(block, metadata); + if(group == null) + return null; - return group.getVariations(); - } + return group.getVariations(); + } - public String getOre(Block block, int metadata) { - ICarvingGroup group = getGroup(block, metadata); - if (group == null) - return null; + public String getOre(Block block, int metadata) { + ICarvingGroup group = getGroup(block, metadata); + if(group == null) + return null; - return group.getOreName(); - } + return group.getOreName(); + } - public ArrayList getItems(ItemStack chiseledItem) { - ArrayList items = new ArrayList(); + public ArrayList getItems(ItemStack chiseledItem) { + ArrayList items = new ArrayList(); - int damage = chiseledItem.getItemDamage(); + int damage = chiseledItem.getItemDamage(); - ICarvingGroup group = getGroup(Block.getBlockFromItem(chiseledItem.getItem()), damage); - if (group == null) - return items; + ICarvingGroup group = getGroup(Block.getBlockFromItem(chiseledItem.getItem()), damage); + if(group == null) + return items; - HashMap mapping = new HashMap(); + HashMap mapping = new HashMap(); - List variations = group.getVariations(); + List variations = group.getVariations(); - if (!group.getVariations().isEmpty()) { - for (ICarvingVariation v : variations) { + if(!group.getVariations().isEmpty()) { + for (ICarvingVariation v : variations) { - String key = Block.getIdFromBlock(v.getBlock()) + "|" + v.getItemMeta(); - if (mapping.containsKey(key)) - continue; - mapping.put(key, 1); + String key = Block.getIdFromBlock(v.getBlock()) + "|" + v.getItemMeta(); + if(mapping.containsKey(key)) + continue; + mapping.put(key, 1); - items.add(new ItemStack(v.getBlock(), 1, v.getItemMeta())); - } - } + items.add(new ItemStack(v.getBlock(), 1, v.getItemMeta())); + } + } - ArrayList ores; - String oreName = group.getOreName(); - if (oreName != null && ((ores = OreDictionary.getOres(oreName)) != null)) { - for (ItemStack stack : ores) { + ArrayList ores; + String oreName = group.getOreName(); + if(oreName != null && ((ores = OreDictionary.getOres(oreName)) != null)) { + for (ItemStack stack : ores) { - String key = Item.getIdFromItem(stack.getItem()) + "|" + stack.getItemDamage(); - if (mapping.containsKey(key)) - continue; - mapping.put(key, 2); + String key = Item.getIdFromItem(stack.getItem()) + "|" + stack.getItemDamage(); + if(mapping.containsKey(key)) + continue; + mapping.put(key, 2); - items.add(stack); - } - } + items.add(stack); + } + } - return items; - } + return items; + } - public ICarvingGroup getGroup(Block block, int metadata) { - int[] ids = OreDictionary.getOreIDs(new ItemStack(block, metadata)); - if (ids.length > 0) { - for (int id : ids) { - ICarvingGroup oreGroup = groups.getGroupByOre(OreDictionary.getOreName(id)); - if (oreGroup != null) { - return oreGroup; - } - } - } + public ICarvingGroup getGroup(Block block, int metadata) { + int[] ids = OreDictionary.getOreIDs(new ItemStack(block, metadata)); + if(ids.length > 0) { + for (int id : ids) { + ICarvingGroup oreGroup = groups.getGroupByOre(OreDictionary.getOreName(id)); + if(oreGroup != null) { + return oreGroup; + } + } + } - return groups.getGroup(block, metadata); - } + return groups.getGroup(block, metadata); + } - public ICarvingGroup getGroup(String name) { - return groups.getGroupByName(name); - } + public ICarvingGroup getGroup(String name) { + return groups.getGroupByName(name); + } - public void addVariation(String groupName, Block block, int metadata, int order) { + public void addVariation(String groupName, Block block, int metadata, int order) { + if(block == null) { + throw new NullPointerException("Cannot add variation in group " + groupName + " for null block."); + } - ICarvingVariation variation = new CarvingVariation(block, metadata, order); - addVariation(groupName, variation); - } + ICarvingVariation variation = new CarvingVariation(block, metadata, order); + addVariation(groupName, variation); + } - public void addVariation(String groupName, ICarvingVariation variation) { + public void addVariation(String groupName, ICarvingVariation variation) { + if(groupName == null) { + throw new NullPointerException("Cannot add variation to null group name."); + } else if(variation == null) { + throw new NullPointerException("Cannot add variation in group " + groupName + " for null variation."); + } - ICarvingGroup group = groups.getGroupByName(groupName); + ICarvingGroup group = groups.getGroupByName(groupName); - if (group == null) { - group = new CarvingGroup(groupName); - addGroup(group); - } + if(group == null) { + group = new CarvingGroup(groupName); + addGroup(group); + } - groups.addVariation(groupName, variation); - } + groups.addVariation(groupName, variation); + } - public void addGroup(ICarvingGroup group) { - groups.add(group); - } + public void addGroup(ICarvingGroup group) { + groups.add(group); + } - public void registerOre(String name, String oreName) { - ICarvingGroup group = groups.getGroupByName(name); - if (group != null) { - group.setOreName(oreName); - } else { - throw new NullPointerException("Cannot register ore name for group " + name + ", as it does not exist."); - } - } + public void registerOre(String name, String oreName) { + ICarvingGroup group = groups.getGroupByName(name); + if(group != null) { + group.setOreName(oreName); + } else { + throw new NullPointerException("Cannot register ore name for group " + name + ", as it does not exist."); + } + } - public void setVariationSound(String name, String sound) { - ICarvingGroup group = groups.getGroupByName(name); - if (group != null) { - group.setSound(sound); - } else { - throw new NullPointerException("Cannot set sound for group " + name + ", as it does not exist."); - } - } + public void setVariationSound(String name, String sound) { + ICarvingGroup group = groups.getGroupByName(name); + if(group != null) { + group.setSound(sound); + } else { + throw new NullPointerException("Cannot set sound for group " + name + ", as it does not exist."); + } + } - public String getVariationSound(Block block, int metadata) { - return getVariationSound(Item.getItemFromBlock(block), metadata); - } + public String getVariationSound(Block block, int metadata) { + return getVariationSound(Item.getItemFromBlock(block), metadata); + } - public String getVariationSound(Item item, int metadata) { - ICarvingGroup group = groups.getGroup(Block.getBlockFromItem(item), metadata); - String sound = group == null ? null : group.getSound(); - return sound == null ? Chisel.MOD_ID + ":chisel.fallback" : sound; - } + public String getVariationSound(Item item, int metadata) { + ICarvingGroup group = groups.getGroup(Block.getBlockFromItem(item), metadata); + String sound = group == null ? null : group.getSound(); + return sound == null ? Chisel.MOD_ID + ":chisel.fallback" : sound; + } - public List getSortedGroupNames() { - List names = new ArrayList(); - names.addAll(groups.getNames()); - Collections.sort(names); - return names; - } + public List getSortedGroupNames() { + List names = new ArrayList(); + names.addAll(groups.getNames()); + Collections.sort(names); + return names; + } } From 63af23ebffbf4b4defa776debac9e9f8dfb8b770 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Fri, 16 Jan 2015 22:45:57 -0500 Subject: [PATCH 04/75] Fix formatting issues in last commit --- .../com/cricketcraft/chisel/Features.java | 17 +- .../cricketcraft/chisel/carving/Carving.java | 230 +++++++++--------- 2 files changed, 126 insertions(+), 121 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index 62b3a8a7..b3e776fc 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -694,8 +694,10 @@ public enum Features { // TODO Overlay is WIP @Override void addBlocks() { - BlockCarvable futura = (BlockCarvable) new BlockCarvable(Material.rock/* , "futura/screenOverlay-ctm" */).setCreativeTab(ChiselTabs.tabMetalChiselBlocks).setHardness(2.0F) - .setResistance(10F); + BlockCarvable futura = (BlockCarvable) new BlockCarvable(Material.rock/* + * , + * "futura/screenOverlay-ctm" + */).setCreativeTab(ChiselTabs.tabMetalChiselBlocks).setHardness(2.0F).setResistance(10F); futura.carverHelper.addVariation("tile.futura.0.desc", 0, "futura/WIP/screenMetallicWIP"); futura.carverHelper.addVariation("tile.futura.1.desc", 1, "futura/WIP/screenCyanWIP"); futura.carverHelper.addVariation("tile.futura.2.desc", 2, "futura/WIP/controllerWIP"); @@ -1481,7 +1483,8 @@ public enum Features { BlockCarvable nether_brick = (BlockCarvable) new BlockCarvable(Material.rock).setCreativeTab(ChiselTabs.tabStoneChiselBlocks).setHardness(2.0F).setResistance(10.0F) .setStepSound(Block.soundTypeStone); Carving.chisel.addVariation("nether_brick", Blocks.nether_brick, 0, 0); - // netherBrick.carverHelper.addVariation("Nether brick", 0, Blocks.nether_brick); + // netherBrick.carverHelper.addVariation("Nether brick", 0, + // Blocks.nether_brick); nether_brick.carverHelper.addVariation("tile.netherBrick.1.desc", 1, "netherbrick/a1-netherbrick-brinstar"); nether_brick.carverHelper.addVariation("tile.netherBrick.2.desc", 2, "netherbrick/a1-netherbrick-classicspatter"); nether_brick.carverHelper.addVariation("tile.netherBrick.3.desc", 3, "netherbrick/a1-netherbrick-guts"); @@ -1724,7 +1727,7 @@ public enum Features { */ RAILCRAFT("Railcraft"), - RC_ABYSSAL_BLOCK(RAILCRAFT.getRequiredMod(), RAILCRAFT) { + RC_ABYSSAL_BLOCK(RAILCRAFT.getRequiredMod(), RAILCRAFT) { @Override void addBlocks() { @@ -1896,7 +1899,8 @@ public enum Features { @Override void addRecipes() { if (meta == 0) { - // The following recipe is due to bugs with Chisel 1.5.1 to 1.5.6a + // The following recipe is due to bugs with Chisel 1.5.1 to + // 1.5.6a GameRegistry.addRecipe(new ItemStack(Blocks.sandstone, 1, 0), "X", 'X', new ItemStack(ChiselBlocks.sandstone, 1, 0)); // The following recipe is due to bug with Chisel 1.5.6b GameRegistry.addRecipe(new ItemStack(Blocks.sandstone, 1, 1), "X", 'X', new ItemStack(ChiselBlocks.sandstone, 1, 1)); @@ -1994,7 +1998,8 @@ public enum Features { GameRegistry.registerBlock(obsidian_snakestone, ItemCarvable.class, "obsidian_snakestone"); Carving.chisel.addVariation("obsidian", obsidian_snakestone, 1, 16); Carving.chisel.addVariation("obsidian", obsidian_snakestone, 13, 17); - // Carving.chisel.registerOre("obsidianSnakestone", "obsidianSnakestone"); + // Carving.chisel.registerOre("obsidianSnakestone", + // "obsidianSnakestone"); } }, diff --git a/src/main/java/com/cricketcraft/chisel/carving/Carving.java b/src/main/java/com/cricketcraft/chisel/carving/Carving.java index 84b11c63..fa585da2 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/Carving.java +++ b/src/main/java/com/cricketcraft/chisel/carving/Carving.java @@ -16,152 +16,152 @@ import com.cricketcraft.chisel.api.carving.ICarvingVariation; public class Carving { - GroupList groups = new GroupList(); + GroupList groups = new GroupList(); - public static final Carving chisel = new Carving(); - public static final Carving needle = new Carving(); + public static final Carving chisel = new Carving(); + public static final Carving needle = new Carving(); - private Carving() { - } + private Carving() { + } - public List getVariations(Block block, int metadata) { - ICarvingGroup group = getGroup(block, metadata); - if(group == null) - return null; + public List getVariations(Block block, int metadata) { + ICarvingGroup group = getGroup(block, metadata); + if (group == null) + return null; - return group.getVariations(); - } + return group.getVariations(); + } - public String getOre(Block block, int metadata) { - ICarvingGroup group = getGroup(block, metadata); - if(group == null) - return null; + public String getOre(Block block, int metadata) { + ICarvingGroup group = getGroup(block, metadata); + if (group == null) + return null; - return group.getOreName(); - } + return group.getOreName(); + } - public ArrayList getItems(ItemStack chiseledItem) { - ArrayList items = new ArrayList(); + public ArrayList getItems(ItemStack chiseledItem) { + ArrayList items = new ArrayList(); - int damage = chiseledItem.getItemDamage(); + int damage = chiseledItem.getItemDamage(); - ICarvingGroup group = getGroup(Block.getBlockFromItem(chiseledItem.getItem()), damage); - if(group == null) - return items; + ICarvingGroup group = getGroup(Block.getBlockFromItem(chiseledItem.getItem()), damage); + if (group == null) + return items; - HashMap mapping = new HashMap(); + HashMap mapping = new HashMap(); - List variations = group.getVariations(); + List variations = group.getVariations(); - if(!group.getVariations().isEmpty()) { - for (ICarvingVariation v : variations) { + if (!group.getVariations().isEmpty()) { + for (ICarvingVariation v : variations) { - String key = Block.getIdFromBlock(v.getBlock()) + "|" + v.getItemMeta(); - if(mapping.containsKey(key)) - continue; - mapping.put(key, 1); + String key = Block.getIdFromBlock(v.getBlock()) + "|" + v.getItemMeta(); + if (mapping.containsKey(key)) + continue; + mapping.put(key, 1); - items.add(new ItemStack(v.getBlock(), 1, v.getItemMeta())); - } - } + items.add(new ItemStack(v.getBlock(), 1, v.getItemMeta())); + } + } - ArrayList ores; - String oreName = group.getOreName(); - if(oreName != null && ((ores = OreDictionary.getOres(oreName)) != null)) { - for (ItemStack stack : ores) { + ArrayList ores; + String oreName = group.getOreName(); + if (oreName != null && ((ores = OreDictionary.getOres(oreName)) != null)) { + for (ItemStack stack : ores) { - String key = Item.getIdFromItem(stack.getItem()) + "|" + stack.getItemDamage(); - if(mapping.containsKey(key)) - continue; - mapping.put(key, 2); + String key = Item.getIdFromItem(stack.getItem()) + "|" + stack.getItemDamage(); + if (mapping.containsKey(key)) + continue; + mapping.put(key, 2); - items.add(stack); - } - } + items.add(stack); + } + } - return items; - } + return items; + } - public ICarvingGroup getGroup(Block block, int metadata) { - int[] ids = OreDictionary.getOreIDs(new ItemStack(block, metadata)); - if(ids.length > 0) { - for (int id : ids) { - ICarvingGroup oreGroup = groups.getGroupByOre(OreDictionary.getOreName(id)); - if(oreGroup != null) { - return oreGroup; - } - } - } + public ICarvingGroup getGroup(Block block, int metadata) { + int[] ids = OreDictionary.getOreIDs(new ItemStack(block, metadata)); + if (ids.length > 0) { + for (int id : ids) { + ICarvingGroup oreGroup = groups.getGroupByOre(OreDictionary.getOreName(id)); + if (oreGroup != null) { + return oreGroup; + } + } + } - return groups.getGroup(block, metadata); - } + return groups.getGroup(block, metadata); + } - public ICarvingGroup getGroup(String name) { - return groups.getGroupByName(name); - } + public ICarvingGroup getGroup(String name) { + return groups.getGroupByName(name); + } - public void addVariation(String groupName, Block block, int metadata, int order) { - if(block == null) { - throw new NullPointerException("Cannot add variation in group " + groupName + " for null block."); - } + public void addVariation(String groupName, Block block, int metadata, int order) { + if (block == null) { + throw new NullPointerException("Cannot add variation in group " + groupName + " for null block."); + } - ICarvingVariation variation = new CarvingVariation(block, metadata, order); - addVariation(groupName, variation); - } + ICarvingVariation variation = new CarvingVariation(block, metadata, order); + addVariation(groupName, variation); + } - public void addVariation(String groupName, ICarvingVariation variation) { - if(groupName == null) { - throw new NullPointerException("Cannot add variation to null group name."); - } else if(variation == null) { - throw new NullPointerException("Cannot add variation in group " + groupName + " for null variation."); - } + public void addVariation(String groupName, ICarvingVariation variation) { + if (groupName == null) { + throw new NullPointerException("Cannot add variation to null group name."); + } else if (variation == null) { + throw new NullPointerException("Cannot add variation in group " + groupName + " for null variation."); + } - ICarvingGroup group = groups.getGroupByName(groupName); + ICarvingGroup group = groups.getGroupByName(groupName); - if(group == null) { - group = new CarvingGroup(groupName); - addGroup(group); - } + if (group == null) { + group = new CarvingGroup(groupName); + addGroup(group); + } - groups.addVariation(groupName, variation); - } + groups.addVariation(groupName, variation); + } - public void addGroup(ICarvingGroup group) { - groups.add(group); - } + public void addGroup(ICarvingGroup group) { + groups.add(group); + } - public void registerOre(String name, String oreName) { - ICarvingGroup group = groups.getGroupByName(name); - if(group != null) { - group.setOreName(oreName); - } else { - throw new NullPointerException("Cannot register ore name for group " + name + ", as it does not exist."); - } - } + public void registerOre(String name, String oreName) { + ICarvingGroup group = groups.getGroupByName(name); + if (group != null) { + group.setOreName(oreName); + } else { + throw new NullPointerException("Cannot register ore name for group " + name + ", as it does not exist."); + } + } - public void setVariationSound(String name, String sound) { - ICarvingGroup group = groups.getGroupByName(name); - if(group != null) { - group.setSound(sound); - } else { - throw new NullPointerException("Cannot set sound for group " + name + ", as it does not exist."); - } - } + public void setVariationSound(String name, String sound) { + ICarvingGroup group = groups.getGroupByName(name); + if (group != null) { + group.setSound(sound); + } else { + throw new NullPointerException("Cannot set sound for group " + name + ", as it does not exist."); + } + } - public String getVariationSound(Block block, int metadata) { - return getVariationSound(Item.getItemFromBlock(block), metadata); - } + public String getVariationSound(Block block, int metadata) { + return getVariationSound(Item.getItemFromBlock(block), metadata); + } - public String getVariationSound(Item item, int metadata) { - ICarvingGroup group = groups.getGroup(Block.getBlockFromItem(item), metadata); - String sound = group == null ? null : group.getSound(); - return sound == null ? Chisel.MOD_ID + ":chisel.fallback" : sound; - } + public String getVariationSound(Item item, int metadata) { + ICarvingGroup group = groups.getGroup(Block.getBlockFromItem(item), metadata); + String sound = group == null ? null : group.getSound(); + return sound == null ? Chisel.MOD_ID + ":chisel.fallback" : sound; + } - public List getSortedGroupNames() { - List names = new ArrayList(); - names.addAll(groups.getNames()); - Collections.sort(names); - return names; - } + public List getSortedGroupNames() { + List names = new ArrayList(); + names.addAll(groups.getNames()); + Collections.sort(names); + return names; + } } From 90279aea2781815a087bd48bf78a6d5dde6d5bbd Mon Sep 17 00:00:00 2001 From: Anton Date: Sat, 17 Jan 2015 10:39:05 +0300 Subject: [PATCH 05/75] Update ru_RU.lang --- .../resources/assets/chisel/lang/ru_RU.lang | 185 +++++++++--------- 1 file changed, 91 insertions(+), 94 deletions(-) diff --git a/src/main/resources/assets/chisel/lang/ru_RU.lang b/src/main/resources/assets/chisel/lang/ru_RU.lang index 71e12246..27e806f6 100644 --- a/src/main/resources/assets/chisel/lang/ru_RU.lang +++ b/src/main/resources/assets/chisel/lang/ru_RU.lang @@ -1,8 +1,15 @@ # Key localizations # Item localizations -item.chisel.name=Стамеска -item.chisel.desc=ПКМ, чтобы открыть интерфейс +item.chisel.chisel_iron.name=Стамеска + +item.chisel.chisel.desc.0=ПКМ, чтобы открыть интерфейс +item.chisel.chisel.desc.1=ЛКМ, чтобы менять блоки прямо в мире +item.chisel.chisel.desc.2=Может ориентироваться на блок в инвентаре + +item.chisel.chisel_diamond.name=Алмазная стамеска +item.chisel.chisel_diamond.desc=Обладает разными режимами для обработки. В разработке. + item.ballMoss.name=Шарик мха item.ballMoss.desc=ПКМ, чтобы кинуть. Превратить булыжник в замшелый булыжник при столкновении. item.cloudBottle.name=Облако в бутылке @@ -22,6 +29,25 @@ item.upgrade_stack.desc=Позволяет стамеске обрабатыва #Chisel 2 +#AntiBlocks +tile.antiBlock.name=Антиблок +tile.antiBlock.black.desc=Чёрный антиблок +tile.antiBlock.blue.desc=Синий антиблок +tile.antiBlock.brown.desc=Коричневый антиблок +tile.antiBlock.cyan.desc=Бирюзовый антиблок +tile.antiBlock.green.desc=Зелёный антиблок +tile.antiBlock.light_blue.desc=Светло-синий антиблок +tile.antiBlock.silver.desc=Светло-серый антиблок +tile.antiBlock.lime.desc=Лаймовый антиблок +tile.antiBlock.magenta.desc=Сиреневый антиблок +tile.antiBlock.orange.desc=Оранжевый антиблок +tile.antiBlock.pink.desc=Розовый антиблок +tile.antiBlock.purple.desc=Фиолетовый антиблок +tile.antiBlock.red.desc=Красный антиблок +tile.antiBlock.white.desc=Белый антиблок +tile.antiBlock.yellow.desc=Жёлтый антиблок +tile.antiBlock.gray.desc=Серый антиблок + #Diorite tile.diorite.name=Диорит tile.diorite.0.desc=Генерируется в Вашем мире @@ -37,12 +63,10 @@ tile.granite.name=Гранит tile.granite.0.desc=Генерируется в Вашем мире tile.granite.1.desc=Гладкий гранит -#Diamond Chisel -item.diamondChisel.name=Алмазная стамеска -item.diamondChisel.desc=Нажмите ЛКМ и она изменит блок! - #Auto Chisel tile.autoChisel.name=Автоматическая стамеска +autochisel.slot.chisel.tooltip=Слот стамески +autochisel.slot.target.tooltip=Слот блока #Leaves tile.leaves.6.desc=Мёртвая листва @@ -53,14 +77,6 @@ tile.leaves.10.desc=Белая роза tile.leaves.11.desc=Рождественские шары tile.leaves.12.desc=Рождественские огни -#Bone -tile.bone.name=Костный блок -tile.bone.0.desc=Сжатая кость -tile.bone.1.desc=Черепная кучка -tile.bone.2.desc=Кучка костей -tile.bone.3.desc=Скошенная сжатая кость -tile.bone.4.desc=Кирпич из сжатой кости - #Void Stone Blocks tile.voidstone.name=Пустотный камень tile.voidstone.0.desc=Необработанный пустотный камень @@ -76,6 +92,23 @@ tile.voidstone.7.desc=Скошенный пустотный камень tile.voidstonePillar.name=Колонна из пустотного камня tile.voidstonePillar.0.desc=Полосатая колонна из пустотного камня +#Warning +tile.warningSign.name=Предупреждающая табличка +tile.warningSign.0.desc=Радиация +tile.warningSign.1.desc=Биологическая опасность +tile.warningSign.2.desc=Огонь +tile.warningSign.3.desc=Взрывчатка +tile.warningSign.4.desc=Смерть +tile.warningSign.5.desc=Падающие объекты +tile.warningSign.6.desc=Опасность проваливания +tile.warningSign.7.desc=Высокое напряжение +tile.warningSign.8.desc=Общее предупреждение +tile.warningSign.9.desc=Опасные химикаты +tile.warningSign.10.desc=В стадии строительства +tile.warningSign.11.desc=Громкие звуки +tile.warningSign.12.desc=Вход запрещён +tile.warningSign.13.desc=В ходе криогенной заморозки + #Energised Void Stone Blocks tile.voidstone2.name=Заряженный пустотный камень tile.voidstone2.0.desc=Необработанный заряженный пустотный камень @@ -92,7 +125,7 @@ tile.voidstonePillar2.name=Колонна из заряженного пусто tile.voidstonePillar2.0.desc=Полосатая колонна из заряженного пустотного камня #Arcane -tile.arcane.name=Тайный каменный блок +tile.arcane.name=Магический каменный блок tile.arcane.0.desc=Выгравированная Луна tile.arcane.1.desc=Светящаяся Луна tile.arcane.2.desc=Скошенная плитка @@ -103,11 +136,33 @@ tile.arcane.6.desc=Временной канал tile.arcane.7.desc=Мозгииии tile.arcane.8.desc=Пространственный канал +#Thaumium +tile.thaumium.name=Таумический блок +tile.thaumium.0.desc=Декоративный шаблон +tile.thaumium.1.desc=Изображения тотемов +tile.thaumium.2.desc=Кирпичи +tile.thaumium.3.desc=Маленькие плитки + +#Tallow +tile.tallow.name=Блок жира +tile.tallow.0.desc=Гладкий блок жира +tile.tallow.1.desc=Оживлённый блок жира + +#Blood Rune +tile.bloodRune.name=Кровавая руна +tile.bloodRune.0.desc=Обработанная кровавая руна +tile.bloodRune.1.desc=Кирпичи из кровавой руны +tile.bloodRune.2.desc=Резная кровавая руна +tile.bloodRune.3.desc=Лучеобразная резная кровавая руна +tile.bloodRune.4.desc=Классическая панель из кровавой руны +tile.bloodRune.5.desc=Плитки из кровавой руны + #Futura tile.futura.name=Футура-блок tile.futura.0.desc=Светящийся экран с металлическими гранями tile.futura.1.desc=Светящийся экран с бирюзовыми гранями tile.futura.2.desc=Прикладные лабиринтовые неоновые полосы +tile.futura.3.desc=Радужный поп-тарт #Waterstone tile.waterstone.name=Водный камень @@ -121,22 +176,22 @@ tile.waterstone.6.desc=Декоративная водная панель #Hex Plating tile.hexPlating.name=Ведьмино покрытие -tile.hexPlating.0.desc=Чёрное покрытие -tile.hexPlating.1.desc=Синее покрытие -tile.hexPlating.2.desc=Коричневое покрытие -tile.hexPlating.3.desc=Бирюзовое покрытие -tile.hexPlating.4.desc=Зелёное покрытие -tile.hexPlating.5.desc=Светло-синее покрытие -tile.hexPlating.6.desc=Светло-серое покрытие -tile.hexPlating.7.desc=Лаймовое покрытие -tile.hexPlating.8.desc=Сиреневое покрытие -tile.hexPlating.9.desc=Оранжевое покрытие -tile.hexPlating.10.desc=Розовое покрытие -tile.hexPlating.11.desc=Фиолетовое покрытие -tile.hexPlating.12.desc=Красное покрытие -tile.hexPlating.13.desc=Белое покрытие -tile.hexPlating.14.desc=Жёлтое покрытие -tile.hexPlating.15.desc=Серое покрытие +tile.hexPlating.black.desc=Чёрное покрытие +tile.hexPlating.blue.desc=Синее покрытие +tile.hexPlating.brown.desc=Коричневое покрытие +tile.hexPlating.cyan.desc=Бирюзовое покрытие +tile.hexPlating.green.desc=Зелёное покрытие +tile.hexPlating.light_blue.desc=Светло-синее покрытие +tile.hexPlating.silver.desc=Светло-серое покрытие +tile.hexPlating.lime.desc=Лаймовое покрытие +tile.hexPlating.magenta.desc=Сиреневое покрытие +tile.hexPlating.orange.desc=Оранжевое покрытие +tile.hexPlating.pink.desc=Розовое покрытие +tile.hexPlating.purple.desc=Фиолетовое покрытие +tile.hexPlating.red.desc=Красное покрытие +tile.hexPlating.white.desc=Белое покрытие +tile.hexPlating.yellow.desc=Жёлтое покрытие +tile.hexPlating.gray.desc=Серое покрытие #Grimstone tile.grimstone.name=Мрачный камень @@ -183,31 +238,6 @@ tile.present.1.desc=§9Синий подарок tile.present.2.desc=§aЗелёный подарок tile.present.3.desc=§eЖёлтый подарок -#Scorching -tile.scorching.name=Пылающий блок -tile.scorching.0.desc=Затвердевший огонь -tile.scorching.1.desc=Окантованный затвердевший огонь -tile.scorching.2.desc=Скошенный затвердевший огонь -tile.scorching.3.desc=Сгоревший камень, заключённый в затвердевший огонь -tile.scorching.4.desc=Блок глубокого ядра - -#Warning -tile.warningSign.name=Предупреждающая табличка -tile.warningSign.0.desc=Радиация -tile.warningSign.1.desc=Биологическая опасность -tile.warningSign.2.desc=Огонь -tile.warningSign.3.desc=Взрывчатка -tile.warningSign.4.desc=Смерть -tile.warningSign.5.desc=Падающие объекты -tile.warningSign.6.desc=Опасность проваливания -tile.warningSign.7.desc=Высокое напряжение -tile.warningSign.8.desc=Общее предупреждение -tile.warningSign.9.desc=Опасные химикаты -tile.warningSign.10.desc=В стадии строительства -tile.warningSign.11.desc=Громкие звуки -tile.warningSign.12.desc=Вход запрещён -tile.warningSign.13.desc=В ходе криогенной заморозки - #Brick tile.brickCustom.name=Блок кирпича tile.brickCustom.1.desc=Большие кирпичи @@ -541,6 +571,10 @@ tile.concrete.10.desc=Асфальт #Road Line tile.roadLine.name=Дорожные линии +tile.roadLine.0.desc=Белые +tile.roadLine.1.desc=Жёлтые +tile.roadLine.2.desc=Двойные белые +tile.roadLine.3.desc=Двойные жёлтые #Iron Blocks tile.iron_block.name=Железный блок @@ -1186,43 +1220,6 @@ tile.laboratory.13.desc=Консоль направления (Правая) tile.laboratory.14.desc=Консоль направления (Левая) tile.laboratory.15.desc=Информационная консоль -#mat -tile.mat.name=mat-блок -tile.mat.0.desc=Белый(Толстый) -tile.mat.1.desc=Белый(Тонкий) -tile.mat.2.desc=Оранжевый(Толстый) -tile.mat.3.desc=Оранжевый(Тонкий) -tile.mat.4.desc=Сиреневый(Толстый) -tile.mat.5.desc=Сиреневый(Тонкий) -tile.mat.6.desc=Светло-синий(Толстый) -tile.mat.7.desc=Светло-синий(Тонкий) -tile.mat.8.desc=Жёлтый(Толстый) -tile.mat.9.desc=Жёлтый(Тонкий) -tile.mat.10.desc=Лаймовый(Толстый) -tile.mat.11.desc=Лаймовый(Тонкий) -tile.mat.12.desc=Розовый(Толстый) -tile.mat.13.desc=Розовый(Тонкий) -tile.mat.14.desc=Серый(Толстый) -tile.mat.15.desc=Серый(Тонкий) -#mat2 -tile.mat2.name=mat-блок -tile.mat2.0.desc=Светло-серый(Толстый) -tile.mat2.1.desc=Светло-серый(Тонкий) -tile.mat2.2.desc=Бирюзовый(Толстый) -tile.mat2.3.desc=Бирюзовый(Тонкий) -tile.mat2.4.desc=Фиолетовый(Толстый) -tile.mat2.5.desc=Фиолетовый(Тонкий) -tile.mat2.6.desc=Синий(Толстый) -tile.mat2.7.desc=Синий(Тонкий) -tile.mat2.8.desc=Коричневый(Толстый) -tile.mat2.9.desc=Коричневый(Тонкий) -tile.mat2.10.desc=Зелёный(Толстый) -tile.mat2.11.desc=Зелёный(Тонкий) -tile.mat2.12.desc=Красный(Толстый) -tile.mat2.13.desc=Красный(Тонкий) -tile.mat2.14.desc=Чёрный(Толстый) -tile.mat2.15.desc=Чёрный(Тонкий) - # Creative Tab localizations itemGroup.tabOtherChiselBlocks=Chisel: Остальные блоки itemGroup.tabStoneChiselBlocks=Chisel: Каменные блоки @@ -1234,4 +1231,4 @@ itemGroup.tabChisel=Chisel: Предметы #Container container.chisel=Стамеска container.chisel.title=Обработка блоков -container.chisel.titleShort=Обработка \ No newline at end of file +container.chisel.titleShort=Обработка From 2778bbbbd22f75d1498f8c6406c83b3d6d432af9 Mon Sep 17 00:00:00 2001 From: warlordjones Date: Sat, 17 Jan 2015 14:07:13 +0000 Subject: [PATCH 06/75] Full Block Version of Paperwall, as requested --- .../java/com/cricketcraft/chisel/Features.java | 17 ++++++++++++++++- .../resources/assets/chisel/lang/en_US.lang | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index b3e776fc..701b9e1d 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -1640,7 +1640,7 @@ public enum Features { @Override void addBlocks() { - BlockCarvablePane paperwall = (BlockCarvablePane) new BlockCarvablePane(Material.ground, true).setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(0.5F).setResistance(10F); + BlockCarvablePane paperwall = (BlockCarvablePane) new BlockCarvablePane(Material.ground, true).setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(0.5F).setResistance(0.5F); paperwall.carverHelper.setChiselBlockName("Paper Wall"); paperwall.carverHelper.addVariation("tile.paperwall.0.desc", 0, "paper/box"); paperwall.carverHelper.addVariation("tile.paperwall.1.desc", 1, "paper/throughMiddle"); @@ -1654,6 +1654,21 @@ public enum Features { paperwall.carverHelper.registerAll(paperwall, "paperwall"); Carving.chisel.registerOre("paperwall", "paperwall"); + + BlockCarvable paperwall_block = (BlockCarvable) new BlockCarvable(Material.ground).setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(0.5F).setResistance(0.5F); + paperwall_block.carverHelper.setChiselBlockName("Paper Wall Block"); + paperwall_block.carverHelper.addVariation("tile.paperwall.0.desc", 0, "paper/box"); + paperwall_block.carverHelper.addVariation("tile.paperwall.1.desc", 1, "paper/throughMiddle"); + paperwall_block.carverHelper.addVariation("tile.paperwall.2.desc", 2, "paper/cross"); + paperwall_block.carverHelper.addVariation("tile.paperwall.3.desc", 3, "paper/sixSections"); + paperwall_block.carverHelper.addVariation("tile.paperwall.4.desc", 4, "paper/vertical"); + paperwall_block.carverHelper.addVariation("tile.paperwall.5.desc", 5, "paper/horizontal"); + paperwall_block.carverHelper.addVariation("tile.paperwall.6.desc", 6, "paper/floral"); + paperwall_block.carverHelper.addVariation("tile.paperwall.7.desc", 7, "paper/plain"); + paperwall_block.carverHelper.addVariation("tile.paperwall.8.desc", 8, "paper/door"); + + paperwall_block.carverHelper.registerAll(paperwall_block, "paperwall_block"); + Carving.chisel.registerOre("paperwall_block", "paperwall_block"); } @Override diff --git a/src/main/resources/assets/chisel/lang/en_US.lang b/src/main/resources/assets/chisel/lang/en_US.lang index 1eaf045e..cc922f41 100644 --- a/src/main/resources/assets/chisel/lang/en_US.lang +++ b/src/main/resources/assets/chisel/lang/en_US.lang @@ -1153,6 +1153,7 @@ tile.fantasyblock2.15.desc=Worn Fantasy Bricks in disarray #Paperwall tile.paperwall.name=Paperwall +tile.paperwall_block.name=Paperwall Block tile.paperwall.0.desc=Boxed Paperwall tile.paperwall.1.desc=Middle Striked Paperwall tile.paperwall.2.desc=Crossed Paperwall From 3596538387e459bfd675a685f4b8cf65802dc90c Mon Sep 17 00:00:00 2001 From: warlordjones Date: Sat, 17 Jan 2015 14:20:42 +0000 Subject: [PATCH 07/75] Update Ice pillar descs --- .../resources/assets/chisel/lang/en_US.lang | 44 +++++-------------- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/src/main/resources/assets/chisel/lang/en_US.lang b/src/main/resources/assets/chisel/lang/en_US.lang index cc922f41..741b4087 100644 --- a/src/main/resources/assets/chisel/lang/en_US.lang +++ b/src/main/resources/assets/chisel/lang/en_US.lang @@ -758,22 +758,12 @@ tile.ice.15.desc=Ice Poison Block #Ice Pillars tile.ice_pillar.name=Ice Pillar -tile.icePillar.0.desc=Ice Pillar -tile.icePillar.1.desc=Ice Pillar Capstone -tile.icePillar.2.desc=Ice Pillar Base -tile.icePillar.3.desc=Small Ice Pillar -tile.icePillar.4.desc=Carved Ice Pillar -tile.icePillar.5.desc=Ornamental Ice Pillar -tile.icePillar.6.desc=Greek Ice Pillar -tile.icePillar.7.desc=Plain Ice Pillar -tile.icePillar.8.desc=Greek Ice Pillar Capstone -tile.icePillar.9.desc=Plain Ice Pillar Capstone -tile.icePillar.10.desc=Greek Ice Pillar Base -tile.icePillar.11.desc=Plain Ice Pillar Base -tile.icePillar.12.desc=Greek Ice Pillar Ornate Capstone -tile.icePillar.13.desc=Plain Ice Pillar Ornate Capstone -tile.icePillar.14.desc=Greek Ice Pillar Ornate Base -tile.icePillar.15.desc=Plain Ice Pillar Ornate Base +tile.icePillar.0.desc=Plain Ice Pillar with Plain Capstone +tile.icePillar.1.desc=Plain Ice Pillar with Greek Capstone +tile.icePillar.2.desc=Greek Ice Pillar with Plain Capstone +tile.icePillar.3.desc=Greek Ice Pillar with Greek Capstone +tile.icePillar.4.desc=Carved Ice Pillar Capstone +tile.icePillar.5.desc=Ornamental Ice Pillar Capstone #Ice Stairs tile.ice_stairs.name=Ice Stairs @@ -822,22 +812,12 @@ tile.packedice.15.desc=Packed Ice Poison Block #Packed Ice Pillars tile.packedice_pillar.name=Packed Ice Pillar -tile.packedicePillar.0.desc=Packed Ice Pillar -tile.packedicePillar.1.desc=Packed Ice Pillar Capstone -tile.packedicePillar.2.desc=Packed Ice Pillar Base -tile.packedicePillar.3.desc=Small Packed Ice Pillar -tile.packedicePillar.4.desc=Carved Packed Ice Pillar -tile.packedicePillar.5.desc=Ornamental Packed Ice Pillar -tile.packedicePillar.6.desc=Greek Packed Ice Pillar -tile.packedicePillar.7.desc=Plain Packed Ice Pillar -tile.packedicePillar.8.desc=Greek Packed Ice Pillar Capstone -tile.packedicePillar.9.desc=Plain Packed Ice Pillar Capstone -tile.packedicePillar.10.desc=Greek Packed Ice Pillar Base -tile.packedicePillar.11.desc=Plain Packed Ice Pillar Base -tile.packedicePillar.12.desc=Greek Packed Ice Pillar Ornate Capstone -tile.packedicePillar.13.desc=Plain Packed Ice Pillar Ornate Capstone -tile.packedicePillar.14.desc=Greek Packed Ice Pillar Ornate Base -tile.packedicePillar.15.desc=Plain Packed Ice Pillar Ornate Base +tile.packedice_pillar.0.desc=Plain Packed Ice Pillar with Plain Capstone +tile.packedice_pillar.1.desc=Plain Packed Ice Pillar with Greek Capstone +tile.packedice_pillar.2.desc=Greek Packed Ice Pillar with Plain Capstone +tile.packedice_pillar.3.desc=Greek Packed Ice Pillar with Greek Capstone +tile.packedice_pillar.4.desc=Carved Packed Ice Pillar Capstone +tile.packedice_pillar.5.desc=Ornamental Packed Ice Pillar Capstone #Packed Ice Stairs tile.packedice_stairs.name=Packed Ice Stairs From eb325e6c9e13f1acb97a767e8e0aaa527968f540 Mon Sep 17 00:00:00 2001 From: warlordjones Date: Sat, 17 Jan 2015 14:21:47 +0000 Subject: [PATCH 08/75] Full Block Paperwall Recipe --- src/main/java/com/cricketcraft/chisel/Features.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index 701b9e1d..ac9f4c0c 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -1674,6 +1674,7 @@ public enum Features { @Override void addRecipes() { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.paperwall, 8), "ppp", "psp", "ppp", ('p'), Items.paper, ('s'), "stickWood")); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.paperwall, 4), "pp", "pp", "ppp", ('p'), paperwall)); } }, From c5578680feeb65ca5247a5835893ddf9697ba68f Mon Sep 17 00:00:00 2001 From: warlordjones Date: Sat, 17 Jan 2015 14:51:29 +0000 Subject: [PATCH 09/75] Add requested O2 warning sign --- .../java/com/cricketcraft/chisel/Features.java | 3 ++- src/main/resources/assets/chisel/lang/en_US.lang | 1 + .../chisel/textures/blocks/warning/oxygen.png | Bin 0 -> 3520 bytes 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100755 src/main/resources/assets/chisel/textures/blocks/warning/oxygen.png diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index ac9f4c0c..b04053a3 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -1674,7 +1674,7 @@ public enum Features { @Override void addRecipes() { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.paperwall, 8), "ppp", "psp", "ppp", ('p'), Items.paper, ('s'), "stickWood")); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.paperwall, 4), "pp", "pp", "ppp", ('p'), paperwall)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.paperwall_block, 4), "pp", "pp", "ppp", ('p'), ChiselBlocks.paperwall)); } }, @@ -2364,6 +2364,7 @@ public enum Features { warningSign.carverHelper.addVariation("tile.warningSign.11.desc", 11, "warning/sound"); warningSign.carverHelper.addVariation("tile.warningSign.12.desc", 12, "warning/noentry"); warningSign.carverHelper.addVariation("tile.warningSign.13.desc", 13, "warning/cryogenic"); + warningSign.carverHelper.addVariation("tile.warningSign.14.desc", 14, "warning/oxygen"); warningSign.carverHelper.registerAll(warningSign, "warningSign"); Carving.chisel.registerOre("warningSign", "warningSign"); } diff --git a/src/main/resources/assets/chisel/lang/en_US.lang b/src/main/resources/assets/chisel/lang/en_US.lang index 741b4087..f48deee5 100644 --- a/src/main/resources/assets/chisel/lang/en_US.lang +++ b/src/main/resources/assets/chisel/lang/en_US.lang @@ -108,6 +108,7 @@ tile.warningSign.10.desc=Under Construction tile.warningSign.11.desc=Loud Sounds tile.warningSign.12.desc=No Entry tile.warningSign.13.desc=Cryogenic Freezing in progress +tile.warningSign.14.desc=Oxygen Required #Energised Void Stone Blocks tile.voidstone2.name=Energised Voidstone diff --git a/src/main/resources/assets/chisel/textures/blocks/warning/oxygen.png b/src/main/resources/assets/chisel/textures/blocks/warning/oxygen.png new file mode 100755 index 0000000000000000000000000000000000000000..27f6e41efce2f259705b7be2a926d1d96d997d42 GIT binary patch literal 3520 zcmV;x4L|aUP)EX>4Tx07%E3mUmQC*A|D*y?1({%`nm#dXp|Nfb=dP9RyJrW(F9_0K*JTY>22p zL=h1IMUbF?0i&TvtcYSED5zi$NDxqBFp8+CWJcCXe0h2A<>mLsz2Dkr?{oLrd!Mx~ z03=TzE-wX^0w9?u;0Jm*(^rK@(6Rjh26%u0rT{Qm>8ZX!?!iDLFE@L0LWj&=4?(nOT_siPRbOditRHZrp6?S8AgejFG^6va$=5K z|`EW#NwP&*~x4%_lS6VhL9s-#7D#h8C*`Lh;NHnGf9}t74chfY%+(L z4giWIwhK6{coCb3n8XhbbP@4#0C1$ZFF5847I3lz;zPNlq-OKEaq$AWE=!MYYHiJ+ zdvY?9I0Av8Ka-Wn(gPeepdb@piwLhwjRWWeSr7baCBSDM=|pK0Q5^$>Pur z|2)M1IPkCYSQ^NQ`z*pYmq4Rp8z$= z2uR(a0_5jDfT9oq5_wSE_22vEgAWDbn-``!u{igi1^xT3aEbVl&W-yV=Mor9X9@Wk zi)-R*3DAH5Bmou30~MeFbb%o-16IHmI084Y0{DSo5DwM?7KjJQfDbZ3F4znTKoQsl z_JT@K1L{E|XaOfc2RIEbfXm=IxC!on2Vew@gXdrdyaDqN1YsdEM1kZXRY(gmfXpBU zWDmJPK2RVO4n;$85DyYUxzHA<2r7jtp<1XB`W89`U4X7a1JFHa6qn9`(3jA6(BtSg7z~Dn(ZN_@JTc*z z1k5^2G3EfK6>}alfEmNgVzF3xtO3>z>xX4x1=s@Ye(W*qIqV>I9QzhW#Hr%UaPGJW z91oX=E5|kA&f*4f6S#T26kZE&gZIO;@!9wid_BGke*-^`pC?EYbO?5YU_t_6Gogae zLbybDNO(mg64i;;!~i0fxQSRnJWjkq93{RZ$&mC(E~H43khGI@gmj*CkMxR6CTo)& z$q{4$c_+D%e3AT^{8oY@VI<)t!Is!4Q6EtGo7CCWGzL)D>rQ4^>|)NiQ$)EQYB*=4e!vRSfKvS(yRXb4T4=0!`QmC#Pm zhG_4XC@*nZ!dbFoNz0PKC3A9$a*lEwxk9;CxjS<2<>~Tn@`>`hkG4N# zKjNU~z;vi{c;cwx$aZXSoN&@}N^m;n^upQ1neW`@Jm+HLvfkyqE8^^jVTFG14;RpP@{Py@g^4IZC^Zz~o6W||E74S6BG%z=?H;57x71R{; zCfGT+B=|vyZiq0XJ5(|>GPE&tF3dHoG;Cy*@v8N!u7@jxbHh6$uo0mV4H2`e-B#~i zJsxQhSr9q2MrTddnyYIS)+Vhz6D1kNj5-;Ojt+}%ivGa#W7aWeW4vOjV`f+`tbMHK zY)5t(dx~SnDdkMW+QpW}PR7~A?TMR;cZe^KpXR!7E4eQdJQHdX<`Vr9k0dT6g(bBn zMJ7e%MIVY;#n-+v{i@=tg`KfG`%5fK4(`J2;_VvR?Xdf3sdQ;h>DV6M zJ?&-mvcj_0d!zPVEnik%vyZS(xNoGwr=oMe=Kfv#KUBt7-l=k~YOPkP-cdbwfPG-_ zpyR=o8s(azn)ipehwj#T)V9}Y*Oec}9L_lWv_7=H_iM)2jSUJ7MGYU1@Q#ce4LsV@ zXw}%*q|{W>3^xm#r;bG)yZMdlH=QkpEw!z*)}rI!xbXP1Z==5*I^lhy`y}IJ%XeDe zRku;v3frOf?DmPgz@Xmo#D^7KH*><&kZ}k0<(`u)y&d8oAIZHU3e|F(q&bit1 zspqFJ#9bKcj_Q7Jan;4!Jpn!am%J}sx$J)VVy{#0xhr;8PG7aTdg>bETE}(E>+O9O zeQiHj{Lt2K+24M{>PF{H>ziEz%LmR5It*U8<$CM#ZLizc@2tEtFcdO$cQ|r*xkvZnNio#z9&IX9*nWZp8u5o(}(f= zr{t&Q6RH!9lV+2rr`)G*K3n~4{CVp0`RRh6rGKt|q5I;yUmSnwn^`q8{*wQ4;n(6< z@~@7(UiP|s)_?Z#o8&k1bA@l^-yVI(c-Q+r?ES=i<_GMDijR69yFPh;dbp6hu<#rA zg!B8%JG^WF000JJOGiWi{{a60|De66lK=n!32;bRa{vGf5&!@T5&_cPe*6Fc00(qQ zO+^Ra0TB)!3@s2t?f?J-5=lfsR9M5+mrYCKP!xvWD@miM1YP)1gjPh+pRaK@h8yg$!`uZBBQVDZ&b9MKDVHmi( zyTkGEF~15d%Yr0Hn4O))^78VRAzas`;o)J3qKK`ntuM*=-QzfwN>O)rH)L7H!@~o1 zcXvNqkX{{U3b-``);`AgX$2m+d$n-PshYe|yHBpn?c z)!q*d4rpmFFu`ZjAlSo6+InAqj$jg@pyyh%M)eY&J{1y}giSnSIO6=*1PWhGf`C+~40* uI-N#3okp=(L_8kH>gp={X8`}r<@5)U>dP0X?}Oj~0000 Date: Sat, 17 Jan 2015 14:51:54 +0000 Subject: [PATCH 10/75] Oops --- src/main/java/com/cricketcraft/chisel/Features.java | 2 +- src/main/java/com/cricketcraft/chisel/init/ChiselBlocks.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index b04053a3..01979c2f 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -1674,7 +1674,7 @@ public enum Features { @Override void addRecipes() { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.paperwall, 8), "ppp", "psp", "ppp", ('p'), Items.paper, ('s'), "stickWood")); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.paperwall_block, 4), "pp", "pp", "ppp", ('p'), ChiselBlocks.paperwall)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.paperwall_block, 4), "pp", "pp", ('p'), ChiselBlocks.paperwall)); } }, diff --git a/src/main/java/com/cricketcraft/chisel/init/ChiselBlocks.java b/src/main/java/com/cricketcraft/chisel/init/ChiselBlocks.java index 3dc56a73..545aa927 100644 --- a/src/main/java/com/cricketcraft/chisel/init/ChiselBlocks.java +++ b/src/main/java/com/cricketcraft/chisel/init/ChiselBlocks.java @@ -89,6 +89,7 @@ public final class ChiselBlocks { public static final BlockCarvable mossy_templeblock = null; public static final BlockCarvable factoryblock = null; public static final BlockCarvablePane paperwall = null; + public static final BlockCarvable paperwall_block = null; public static final BlockCarvable woolen_clay = null; public static final BlockCarvable laboratoryblock = null; @@ -111,7 +112,7 @@ public final class ChiselBlocks { public static final BlockCarvable bloodRune = null; public static final BlockCarvable bloodBrick = null; - + // Arrays can't be final because of how @ObjectHolder works public static BlockCarvableStairs[] marbleStairs = new BlockCarvableStairs[8]; public static BlockCarvableStairs[] limestoneStairs = new BlockCarvableStairs[8]; From 2db7249358b8cff693e512d44d4ed2f9ba9da4b8 Mon Sep 17 00:00:00 2001 From: warlordjones Date: Sat, 17 Jan 2015 19:25:11 +0000 Subject: [PATCH 11/75] Workaround to prevent crashing with rendering ice pillars that no longer have a variation. --- .../render/BlockMarblePillarRenderer.java | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/client/render/BlockMarblePillarRenderer.java b/src/main/java/com/cricketcraft/chisel/client/render/BlockMarblePillarRenderer.java index ac2ca31a..eb83808d 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/BlockMarblePillarRenderer.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/BlockMarblePillarRenderer.java @@ -48,15 +48,22 @@ public class BlockMarblePillarRenderer implements ISimpleBlockRenderingHandler { int metadata = world.getBlockMetadata(x, y, z); - if (block.carverHelper.variations.get(metadata).kind != CarvableHelper.CTMV) { - block.sides[0] = block.carverHelper.getIcon(0, metadata); - block.sides[1] = block.carverHelper.getIcon(1, metadata); - block.sides[2] = block.carverHelper.getIcon(2, metadata); - block.sides[3] = block.carverHelper.getIcon(3, metadata); - block.sides[4] = block.carverHelper.getIcon(4, metadata); - block.sides[5] = block.carverHelper.getIcon(5, metadata); + //Probably not the best way to handle this... + if(metadata > block.carverHelper.variations.size()) + { + metadata = block.carverHelper.variations.size() - 1; + } + else { + if (block.carverHelper.variations.get(metadata).kind != CarvableHelper.CTMV) { + block.sides[0] = block.carverHelper.getIcon(0, metadata); + block.sides[1] = block.carverHelper.getIcon(1, metadata); + block.sides[2] = block.carverHelper.getIcon(2, metadata); + block.sides[3] = block.carverHelper.getIcon(3, metadata); + block.sides[4] = block.carverHelper.getIcon(4, metadata); + block.sides[5] = block.carverHelper.getIcon(5, metadata); - return renderer.renderStandardBlock(block, x, y, z); + return renderer.renderStandardBlock(block, x, y, z); + } } boolean yp = connected(world, x, y + 1, z, block, metadata); From 469ae5828bb97fee138661bb21926edc0f751df1 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sun, 18 Jan 2015 12:22:53 -0500 Subject: [PATCH 12/75] Fix #150 Chisel breaking after single use --- .../com/cricketcraft/chisel/item/chisel/ItemChisel.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java index 2eed31dc..e10fe28d 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java @@ -39,7 +39,6 @@ public class ItemChisel extends Item implements IChiselItem { super(); this.type = type; setMaxStackSize(1); - setHasSubtypes(true); setTextureName(Chisel.MOD_ID + ":chisel_" + type.name().toLowerCase()); MinecraftForge.EVENT_BUS.register(this); } @@ -97,14 +96,15 @@ public class ItemChisel extends Item implements IChiselItem { public void onChisel(World world, IInventory inv, int slot, ItemStack chisel, ItemStack target) { if (Configurations.allowChiselDamage) { chisel.setItemDamage(chisel.getItemDamage() + 1); + if (chisel.getItemDamage() >= chisel.getMaxDamage()) { + inv.decrStackSize(slot, 1); + } } if (world.isRemote) { String sound = carving.getVariationSound(target.getItem(), target.getItemDamage()); EntityPlayer player = Chisel.proxy.getClientPlayer(); GeneralClient.playChiselSound(world, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ), sound); - } else if (chisel.getItemDamage() >= chisel.getMaxDamage()) { - inv.decrStackSize(slot, 1); } } From 86713ab44909094855d234389f0baf6be99fe756 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sun, 18 Jan 2015 13:05:25 -0500 Subject: [PATCH 13/75] Remove IChiselMode --- .../java/com/cricketcraft/chisel/api/IChiselItem.java | 6 ++++-- .../java/com/cricketcraft/chisel/api/IChiselMode.java | 8 -------- 2 files changed, 4 insertions(+), 10 deletions(-) delete mode 100644 src/main/java/com/cricketcraft/chisel/api/IChiselMode.java diff --git a/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java b/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java index 72e6fca9..8063cf74 100644 --- a/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java +++ b/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java @@ -6,10 +6,12 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import com.cricketcraft.chisel.api.carving.ICarvingVariation; + /** * Implement this on items which can be used to chisel blocks. */ -public interface IChiselItem extends IChiselMode { +public interface IChiselItem { /** * Checks whether the chisel can have its GUI opened @@ -38,7 +40,7 @@ public interface IChiselItem extends IChiselMode { * @param target * The {@link ItemStack} representing the target item */ - void onChisel(World world, IInventory inv, int slot, ItemStack chisel, ItemStack target); + void onChisel(World world, IInventory inv, int slot, 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. diff --git a/src/main/java/com/cricketcraft/chisel/api/IChiselMode.java b/src/main/java/com/cricketcraft/chisel/api/IChiselMode.java deleted file mode 100644 index 198f84b3..00000000 --- a/src/main/java/com/cricketcraft/chisel/api/IChiselMode.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.cricketcraft.chisel.api; - -import net.minecraft.item.ItemStack; - -public interface IChiselMode { - - public ChiselMode getChiselMode(ItemStack itemStack); -} From 89299f6e2776ce9cbfbe3f8e70332f4a5355de00 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sun, 18 Jan 2015 14:40:39 -0500 Subject: [PATCH 14/75] Begin chisel mode implementation --- .../cricketcraft/chisel/api/ChiselMode.java | 72 ++++++++++++++++++- .../chisel/api/carving/CarvingUtils.java | 2 + .../tileentity/TileEntityAutoChisel.java | 4 +- .../cricketcraft/chisel/carving/Carving.java | 12 ++++ .../chisel/inventory/SlotChiselSelection.java | 3 +- .../chisel/item/chisel/ChiselController.java | 43 +++++------ .../chisel/item/chisel/ItemChisel.java | 10 +-- .../cricketcraft/chisel/utils/General.java | 28 +++++++- 8 files changed, 141 insertions(+), 33 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/api/ChiselMode.java b/src/main/java/com/cricketcraft/chisel/api/ChiselMode.java index 8686c0d1..8a578641 100644 --- a/src/main/java/com/cricketcraft/chisel/api/ChiselMode.java +++ b/src/main/java/com/cricketcraft/chisel/api/ChiselMode.java @@ -1,6 +1,76 @@ package com.cricketcraft.chisel.api; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +import com.cricketcraft.chisel.api.carving.ICarvingVariation; +import com.cricketcraft.chisel.network.PacketHandler; +import com.cricketcraft.chisel.network.message.MessageChiselSound; + public enum ChiselMode { - SINGLE, CIRCLETHREE, COLLUM, SIDEWAYS + SINGLE { + + @Override + public void chiselAll(EntityPlayer player, World world, int x, int y, int z, ForgeDirection side, ICarvingVariation variation) { + setVariation(player, world, x, y, z, world.getBlock(x, y, z), world.getBlockMetadata(x, y, z), variation); + } + }, + PANEL { + + @Override + public void chiselAll(EntityPlayer player, World world, int x, int y, int z, ForgeDirection side, ICarvingVariation variation) { + Block block = world.getBlock(x, y, z); + int meta = world.getBlockMetadata(x, y, z); + for (int dx = -1; dx <= 1; dx++) { + for (int dy = -1; dy <= 1; dy++) { + if (side == ForgeDirection.UP || side == ForgeDirection.DOWN) { + setVariation(player, world, x + dx, y, z + dy, block, meta, variation); + } else if (side == ForgeDirection.EAST || side == ForgeDirection.WEST) { + setVariation(player, world, x, y + dy, z + dx, block, meta, variation); + } else { + setVariation(player, world, x + dx, y + dy, z, block, meta, variation); + } + } + } + } + }, + COLUMN { + + @Override + public void chiselAll(EntityPlayer player, World world, int x, int y, int z, ForgeDirection side, ICarvingVariation variation) { + Block block = world.getBlock(x, y, z); + int meta = world.getBlockMetadata(x, y, z); + if (side != ForgeDirection.DOWN && side != ForgeDirection.UP) { + setVariation(player, world, x, y, z, block, meta, variation); + setVariation(player, world, x, y + 1, z, block, meta, variation); + setVariation(player, world, x, y - 1, z, block, meta, variation); + } else { + // TODO top/bottom + } + } + }; // TODO SIDEWAYS + + public abstract void chiselAll(EntityPlayer player, World world, int x, int y, int z, ForgeDirection side, ICarvingVariation variation); + + /** + * Assumes that the player is holding a chisel + */ + private static void setVariation(EntityPlayer player, World world, int x, int y, int z, Block origBlock, int origMeta, ICarvingVariation v) { + Block block = world.getBlock(x, y, z); + int meta = world.getBlockMetadata(x, y, z); + if (block == v.getBlock() && meta == v.getBlockMeta()) { + return; // don't chisel to the same thing + } + if (origBlock != block || origMeta != meta) { + return; // don't chisel if this doesn't match the target block (for the AOE modes) + } + + PacketHandler.INSTANCE.sendTo(new MessageChiselSound(x, y, z, v), (EntityPlayerMP) player); + world.setBlock(x, y, z, v.getBlock(), v.getBlockMeta(), 3); + ((IChiselItem) player.getCurrentEquippedItem().getItem()).onChisel(world, player.inventory, player.inventory.currentItem, player.getCurrentEquippedItem(), v); + } } diff --git a/src/main/java/com/cricketcraft/chisel/api/carving/CarvingUtils.java b/src/main/java/com/cricketcraft/chisel/api/carving/CarvingUtils.java index 317c75b8..c219b3b0 100644 --- a/src/main/java/com/cricketcraft/chisel/api/carving/CarvingUtils.java +++ b/src/main/java/com/cricketcraft/chisel/api/carving/CarvingUtils.java @@ -1,5 +1,7 @@ package com.cricketcraft.chisel.api.carving; +import com.cricketcraft.chisel.carving.Carving; + import net.minecraft.item.ItemStack; public class CarvingUtils { diff --git a/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java b/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java index 11a14ec5..33e229db 100644 --- a/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java +++ b/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java @@ -15,12 +15,14 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.StatCollector; import com.cricketcraft.chisel.api.IChiselItem; +import com.cricketcraft.chisel.api.carving.CarvingUtils; import com.cricketcraft.chisel.carving.Carving; import com.cricketcraft.chisel.client.GeneralChiselClient; import com.cricketcraft.chisel.init.ChiselItems; import com.cricketcraft.chisel.network.PacketHandler; import com.cricketcraft.chisel.network.message.MessageAutoChisel; import com.cricketcraft.chisel.network.message.MessageSlotUpdate; +import com.cricketcraft.chisel.utils.General; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -207,7 +209,7 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory /** Calls IChiselItem#onChisel() and sends the chisel packet for sound/animation */ private void chiselItem(int chiseled) { if (!worldObj.isRemote) { - ((IChiselItem) inventory[CHISEL].getItem()).onChisel(worldObj, this, CHISEL, inventory[CHISEL], inventory[TARGET]); + ((IChiselItem) inventory[CHISEL].getItem()).onChisel(worldObj, this, CHISEL, inventory[CHISEL], General.getVariation(inventory[TARGET])); PacketHandler.INSTANCE.sendToDimension(new MessageAutoChisel(this, chiseled, true), worldObj.provider.dimensionId); } else { GeneralChiselClient.spawnAutoChiselFX(this, lastBase != null ? lastBase : inventory[BASE]); diff --git a/src/main/java/com/cricketcraft/chisel/carving/Carving.java b/src/main/java/com/cricketcraft/chisel/carving/Carving.java index fa585da2..4a4a51b6 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/Carving.java +++ b/src/main/java/com/cricketcraft/chisel/carving/Carving.java @@ -24,6 +24,18 @@ public class Carving { private Carving() { } + public ICarvingVariation getVariation(Block block, int metadata) { + ICarvingGroup g = getGroup(block, metadata); + if (g != null) { + for (ICarvingVariation v : g.getVariations()) { + if (v.getBlock() == block && v.getBlockMeta() == metadata) { + return v; + } + } + } + return null; + } + public List getVariations(Block block, int metadata) { ICarvingGroup group = getGroup(block, metadata); if (group == null) diff --git a/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java b/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java index 9c2a53db..6a476c37 100644 --- a/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java +++ b/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java @@ -6,6 +6,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import com.cricketcraft.chisel.api.IChiselItem; +import com.cricketcraft.chisel.utils.General; public class SlotChiselSelection extends Slot { @@ -55,7 +56,7 @@ public class SlotChiselSelection extends Slot { selInventory.updateItems(); - ((IChiselItem)container.chisel.getItem()).onChisel(player.worldObj, player.inventory, player.inventory.currentItem, container.chisel, crafted); + ((IChiselItem)container.chisel.getItem()).onChisel(player.worldObj, player.inventory, player.inventory.currentItem, container.chisel, General.getVariation(crafted)); /* * ItemStack stack=player.inventory.getItemStack(); diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java index 19fe29f0..08b575ce 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java @@ -3,20 +3,18 @@ package com.cricketcraft.chisel.item.chisel; import java.util.List; import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; -import net.minecraft.world.World; +import net.minecraft.util.ChatComponentText; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import com.cricketcraft.chisel.Chisel; +import com.cricketcraft.chisel.api.ChiselMode; import com.cricketcraft.chisel.api.IChiselItem; import com.cricketcraft.chisel.api.carving.ICarvingVariation; import com.cricketcraft.chisel.carving.Carving; import com.cricketcraft.chisel.carving.CarvingVariation; -import com.cricketcraft.chisel.network.PacketHandler; -import com.cricketcraft.chisel.network.message.MessageChiselSound; import com.cricketcraft.chisel.utils.General; import cpw.mods.fml.common.eventhandler.SubscribeEvent; @@ -24,6 +22,8 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent; public final class ChiselController { public static final ChiselController INSTANCE = new ChiselController(); + + private long lastTickClick = 0; private ChiselController() { } @@ -60,11 +60,13 @@ public final class ChiselController { if (chisel.canChiselBlock(event.world, x, y, z, block, metadata)) { ItemStack target = General.getChiselTarget(held); + ChiselMode mode = General.getChiselMode(held); + ForgeDirection sideHit = ForgeDirection.VALID_DIRECTIONS[event.face]; if (target != null) { for (ICarvingVariation v : variations) { if (v.getBlock() == Block.getBlockFromItem(target.getItem()) && v.getBlockMeta() == target.getItemDamage()) { - setVariation(event.entityPlayer, event.world, x, y, z, v, target); + mode.chiselAll(event.entityPlayer, event.world, x, y, z, sideHit, v); } } } else { @@ -77,13 +79,26 @@ public final class ChiselController { } ICarvingVariation newVar = variations[idx]; - setVariation(event.entityPlayer, event.world, x, y, z, newVar, new ItemStack(newVar.getBlock(), 1, newVar.getItemMeta())); + mode.chiselAll(event.entityPlayer, event.world, x, y, z, sideHit, newVar); event.entityPlayer.inventory.currentItem = slot; } } break; case RIGHT_CLICK_AIR: case RIGHT_CLICK_BLOCK: + // Make sure we have not responded this tick + if (event.world.getTotalWorldTime() == lastTickClick) { + break; + } else { + lastTickClick = event.world.getTotalWorldTime(); + } + + if (!event.world.isRemote && event.entityPlayer.isSneaking()) { + ChiselMode mode = General.getChiselMode(held); + General.setChiselMode(held, ChiselMode.values()[(mode.ordinal() + 1) % 3]); + event.entityPlayer.addChatMessage(new ChatComponentText(General.getChiselMode(held).toString())); + break; + } if (!event.world.isRemote && chisel.canOpenGui(event.world, event.entityPlayer, held)) { event.entityPlayer.openGui(Chisel.instance, 0, event.world, 0, 0, 0); } @@ -91,18 +106,4 @@ public final class ChiselController { } } - /** - * Assumes that the player is holding a chisel - */ - private void setVariation(EntityPlayer player, World world, int x, int y, int z, ICarvingVariation v, ItemStack target) { - Block block = world.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - if (block == v.getBlock() && meta == v.getBlockMeta()) { - return; // don't chisel to the same thing - } - - PacketHandler.INSTANCE.sendTo(new MessageChiselSound(x, y, z, v), (EntityPlayerMP) player); - world.setBlock(x, y, z, v.getBlock(), v.getBlockMeta(), 3); - ((IChiselItem) player.getCurrentEquippedItem().getItem()).onChisel(world, player.inventory, player.inventory.currentItem, player.getCurrentEquippedItem(), target); - } } diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java index e10fe28d..a05a8766 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java @@ -15,6 +15,7 @@ import net.minecraftforge.common.MinecraftForge; import com.cricketcraft.chisel.Chisel; import com.cricketcraft.chisel.api.ChiselMode; import com.cricketcraft.chisel.api.IChiselItem; +import com.cricketcraft.chisel.api.carving.ICarvingVariation; import com.cricketcraft.chisel.carving.Carving; import com.cricketcraft.chisel.config.Configurations; import com.cricketcraft.chisel.utils.GeneralClient; @@ -77,11 +78,6 @@ public class ItemChisel extends Item implements IChiselItem { return true; } - @Override - public ChiselMode getChiselMode(ItemStack itemStack) { - return ChiselMode.SINGLE; - } - @Override public boolean canOpenGui(World world, EntityPlayer player, ItemStack chisel) { return true; @@ -93,7 +89,7 @@ public class ItemChisel extends Item implements IChiselItem { } @Override - public void onChisel(World world, IInventory inv, int slot, ItemStack chisel, ItemStack target) { + public void onChisel(World world, IInventory inv, int slot, ItemStack chisel, ICarvingVariation target) { if (Configurations.allowChiselDamage) { chisel.setItemDamage(chisel.getItemDamage() + 1); if (chisel.getItemDamage() >= chisel.getMaxDamage()) { @@ -102,7 +98,7 @@ public class ItemChisel extends Item implements IChiselItem { } if (world.isRemote) { - String sound = carving.getVariationSound(target.getItem(), target.getItemDamage()); + String sound = carving.getVariationSound(target.getBlock(), target.getItemMeta()); EntityPlayer player = Chisel.proxy.getClientPlayer(); GeneralClient.playChiselSound(world, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ), sound); } diff --git a/src/main/java/com/cricketcraft/chisel/utils/General.java b/src/main/java/com/cricketcraft/chisel/utils/General.java index 572c14fe..1671284d 100644 --- a/src/main/java/com/cricketcraft/chisel/utils/General.java +++ b/src/main/java/com/cricketcraft/chisel/utils/General.java @@ -2,6 +2,7 @@ package com.cricketcraft.chisel.utils; import java.util.Random; +import joptsimple.internal.Strings; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -14,6 +15,10 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; +import com.cricketcraft.chisel.api.ChiselMode; +import com.cricketcraft.chisel.api.carving.ICarvingVariation; +import com.cricketcraft.chisel.carving.Carving; + public class General { public static Random rand = new Random(); @@ -98,8 +103,8 @@ public class General { public static final String[] sGNames = new String[] { "White", "Orange", "Magenta", "Light Blue", "Yellow", "Lime", "Pink", "Gray", "Light Gray", "Cyan", "Purple", "Blue", "Brown", "Green", "Red", "Black" }; - public static final String[] featureColors = new String[] { "white", "orange", "magenta", "lightblue", "yellow", "lime", "pink", "darkgray", "lightgray", "cyan", "purple", "blue", "brown", "green", - "red", "black" }; + public static final String[] featureColors = new String[] { "white", "orange", "magenta", "lightblue", "yellow", "lime", "pink", "darkgray", "lightgray", "cyan", "purple", "blue", "brown", + "green", "red", "black" }; public static void setChiselTarget(ItemStack chisel, ItemStack target) { initTag(chisel); @@ -115,4 +120,23 @@ public class General { stack.setTagCompound(new NBTTagCompound()); } } + + private static final String MODE_KEY = "chiselMode"; + public static ChiselMode getChiselMode(ItemStack chisel) { + if (chisel.stackTagCompound == null || Strings.isNullOrEmpty(chisel.stackTagCompound.getString(MODE_KEY))) { + initTag(chisel); + chisel.stackTagCompound.setString(MODE_KEY, ChiselMode.SINGLE.name()); + } + + return Enum.valueOf(ChiselMode.class, chisel.stackTagCompound.getString(MODE_KEY)); + } + + public static void setChiselMode(ItemStack chisel, ChiselMode mode) { + initTag(chisel); + chisel.stackTagCompound.setString(MODE_KEY, mode.name()); + } + + public static ICarvingVariation getVariation(ItemStack stack) { + return Carving.chisel.getVariation(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage()); + } } From a3f8c357e37ed849e843e05c0997f1081f775a6f Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sun, 18 Jan 2015 15:58:13 -0500 Subject: [PATCH 15/75] Finish chisel modes --- .../cricketcraft/chisel/api/ChiselMode.java | 49 ++++++++++++++++--- .../chisel/client/gui/GuiChisel.java | 37 +++++++++++++- .../chisel/network/PacketHandler.java | 2 + .../network/message/MessageChiselMode.java | 46 +++++++++++++++++ .../resources/assets/chisel/lang/en_US.lang | 5 ++ 5 files changed, 131 insertions(+), 8 deletions(-) create mode 100644 src/main/java/com/cricketcraft/chisel/network/message/MessageChiselMode.java diff --git a/src/main/java/com/cricketcraft/chisel/api/ChiselMode.java b/src/main/java/com/cricketcraft/chisel/api/ChiselMode.java index 8a578641..a0da6f00 100644 --- a/src/main/java/com/cricketcraft/chisel/api/ChiselMode.java +++ b/src/main/java/com/cricketcraft/chisel/api/ChiselMode.java @@ -3,6 +3,7 @@ package com.cricketcraft.chisel.api; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -44,15 +45,44 @@ public enum ChiselMode { public void chiselAll(EntityPlayer player, World world, int x, int y, int z, ForgeDirection side, ICarvingVariation variation) { Block block = world.getBlock(x, y, z); int meta = world.getBlockMetadata(x, y, z); - if (side != ForgeDirection.DOWN && side != ForgeDirection.UP) { - setVariation(player, world, x, y, z, block, meta, variation); - setVariation(player, world, x, y + 1, z, block, meta, variation); - setVariation(player, world, x, y - 1, z, block, meta, variation); - } else { - // TODO top/bottom + int facing = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + for (int i = -1; i <= 1; i++) { + if (side != ForgeDirection.DOWN && side != ForgeDirection.UP) { + setVariation(player, world, x, y + i, z, block, meta, variation); + } else { + if (facing == 0 || facing == 2) { + setVariation(player, world, x, y, z + i, block, meta, variation); + } else { + setVariation(player, world, x + i, y, z, block, meta, variation); + } + } } } - }; // TODO SIDEWAYS + }, + ROW { + + @Override + public void chiselAll(EntityPlayer player, World world, int x, int y, int z, ForgeDirection side, ICarvingVariation variation) { + Block block = world.getBlock(x, y, z); + int meta = world.getBlockMetadata(x, y, z); + int facing = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + for (int i = -1; i <= 1; i++) { + if (side != ForgeDirection.DOWN && side != ForgeDirection.UP) { + if (side == ForgeDirection.EAST || side == ForgeDirection.WEST) { + setVariation(player, world, x, y, z + i, block, meta, variation); + } else { + setVariation(player, world, x + i, y, z, block, meta, variation); + } + } else { + if (facing == 0 || facing == 2) { + setVariation(player, world, x + i, y, z, block, meta, variation); + } else { + setVariation(player, world, x, y, z + i, block, meta, variation); + } + } + } + } + }; public abstract void chiselAll(EntityPlayer player, World world, int x, int y, int z, ForgeDirection side, ICarvingVariation variation); @@ -73,4 +103,9 @@ public enum ChiselMode { world.setBlock(x, y, z, v.getBlock(), v.getBlockMeta(), 3); ((IChiselItem) player.getCurrentEquippedItem().getItem()).onChisel(world, player.inventory, player.inventory.currentItem, player.getCurrentEquippedItem(), v); } + + public ChiselMode next() { + ChiselMode[] values = values(); + return values[(ordinal() + 1) % values.length]; + } } diff --git a/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java b/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java index 38353a33..a7c4e765 100644 --- a/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java +++ b/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java @@ -1,22 +1,29 @@ package com.cricketcraft.chisel.client.gui; +import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; +import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11; +import com.cricketcraft.chisel.api.ChiselMode; import com.cricketcraft.chisel.inventory.ContainerChisel; import com.cricketcraft.chisel.inventory.InventoryChiselSelection; import com.cricketcraft.chisel.inventory.SlotChiselInput; +import com.cricketcraft.chisel.network.PacketHandler; +import com.cricketcraft.chisel.network.message.MessageChiselMode; +import com.cricketcraft.chisel.utils.General; import com.cricketcraft.chisel.utils.GeneralClient; public class GuiChisel extends GuiContainer { public EntityPlayer player; public ContainerChisel container; + private ChiselMode currentMode; public GuiChisel(InventoryPlayer iinventory, InventoryChiselSelection menu) { super(new ContainerChisel(iinventory, menu)); @@ -33,12 +40,30 @@ public class GuiChisel extends GuiContainer { inventorySlots.onContainerClosed(player); } + @SuppressWarnings("unchecked") + @Override + public void initGui() { + super.initGui(); + currentMode = General.getChiselMode(container.chisel); + + int x = this.width / 2 - 120; + int y = this.height / 2 - 6; + buttonList.add(new GuiButton(0, x, y, 53, 20, "")); + setButtonText(); + } + + private void setButtonText() { + ((GuiButton) buttonList.get(0)).displayString = I18n.format(container.inventory.getInventoryName() + ".mode." + currentMode.name().toLowerCase()); + } + @Override protected void drawGuiContainerForegroundLayer(int j, int i) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); String line = I18n.format(this.container.inventory.getInventoryName() + ".title"); fontRendererObj.drawSplitString(line, 50 - fontRendererObj.getStringWidth(line) / 2, 60, 40, 0x404040); + line = I18n.format(this.container.inventory.getInventoryName() + ".mode"); + fontRendererObj.drawString(line, fontRendererObj.getStringWidth(line) / 2 + 6, 85, 0x404040); } @Override @@ -56,13 +81,23 @@ public class GuiChisel extends GuiContainer { int x = (width - xSize) / 2; int y = (height - ySize) / 2; - + Slot main = (Slot) container.inventorySlots.get(InventoryChiselSelection.normalSlots); if (main.getStack() == null) { GuiAutoChisel.drawSlotOverlay(this, x + 14, y + 14, main, 0, ySize, 60); } } + @Override + protected void actionPerformed(GuiButton button) { + if (button.id == 0) { + PacketHandler.INSTANCE.sendToServer(new MessageChiselMode(currentMode)); + currentMode = currentMode.next(); + setButtonText(); + } + super.actionPerformed(button); + } + @Override protected void func_146977_a(Slot slot) { if (slot instanceof SlotChiselInput) { diff --git a/src/main/java/com/cricketcraft/chisel/network/PacketHandler.java b/src/main/java/com/cricketcraft/chisel/network/PacketHandler.java index ffbb42de..44e742a3 100644 --- a/src/main/java/com/cricketcraft/chisel/network/PacketHandler.java +++ b/src/main/java/com/cricketcraft/chisel/network/PacketHandler.java @@ -2,6 +2,7 @@ package com.cricketcraft.chisel.network; import com.cricketcraft.chisel.Chisel; import com.cricketcraft.chisel.network.message.MessageAutoChisel; +import com.cricketcraft.chisel.network.message.MessageChiselMode; import com.cricketcraft.chisel.network.message.MessageChiselSound; import com.cricketcraft.chisel.network.message.MessageSlotUpdate; @@ -18,5 +19,6 @@ public class PacketHandler { INSTANCE.registerMessage(MessageChiselSound.Handler.class, MessageChiselSound.class, id++, Side.CLIENT); INSTANCE.registerMessage(MessageSlotUpdate.Handler.class, MessageSlotUpdate.class, id++, Side.CLIENT); INSTANCE.registerMessage(MessageAutoChisel.Handler.class, MessageAutoChisel.class, id++, Side.CLIENT); + INSTANCE.registerMessage(MessageChiselMode.Handler.class, MessageChiselMode.class, id++, Side.SERVER); } } \ No newline at end of file diff --git a/src/main/java/com/cricketcraft/chisel/network/message/MessageChiselMode.java b/src/main/java/com/cricketcraft/chisel/network/message/MessageChiselMode.java new file mode 100644 index 00000000..0bde806e --- /dev/null +++ b/src/main/java/com/cricketcraft/chisel/network/message/MessageChiselMode.java @@ -0,0 +1,46 @@ +package com.cricketcraft.chisel.network.message; + +import io.netty.buffer.ByteBuf; +import net.minecraft.item.ItemStack; + +import com.cricketcraft.chisel.api.ChiselMode; +import com.cricketcraft.chisel.api.IChiselItem; +import com.cricketcraft.chisel.utils.General; + +import cpw.mods.fml.common.network.ByteBufUtils; +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; + + +public class MessageChiselMode implements IMessage { + + public MessageChiselMode(){ + } + + private String mode; + + public MessageChiselMode(ChiselMode current) { + this.mode = current.next().name(); + } + + public void toBytes(ByteBuf buf) { + ByteBufUtils.writeUTF8String(buf, mode); + } + + @Override + public void fromBytes(ByteBuf buf) { + this.mode = ByteBufUtils.readUTF8String(buf); + } + + public static class Handler implements IMessageHandler { + @Override + public IMessage onMessage(MessageChiselMode message, MessageContext ctx) { + ItemStack stack = ctx.getServerHandler().playerEntity.getCurrentEquippedItem(); + if (stack != null && stack.getItem() instanceof IChiselItem) { + General.setChiselMode(stack, ChiselMode.valueOf(message.mode)); + } + return null; + } + } +} diff --git a/src/main/resources/assets/chisel/lang/en_US.lang b/src/main/resources/assets/chisel/lang/en_US.lang index f48deee5..8585f0a2 100644 --- a/src/main/resources/assets/chisel/lang/en_US.lang +++ b/src/main/resources/assets/chisel/lang/en_US.lang @@ -1214,3 +1214,8 @@ itemGroup.tabChisel=Chisel Items container.chisel=Chisel container.chisel.title=Carve blocks container.chisel.titleShort=Carve +container.chisel.mode=Mode: +container.chisel.mode.single=Single +container.chisel.mode.panel=Panel +container.chisel.mode.column=Column +container.chisel.mode.row=Row From 4de7ef8190f21437baef73bb82cdee9e48a24cf5 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sun, 18 Jan 2015 16:17:04 -0500 Subject: [PATCH 16/75] IChiselItem items no longer need to worry about playing the sound fx. Remove ChiselMode from API packages --- .../com/cricketcraft/chisel/client/gui/GuiChisel.java | 3 +-- .../chisel/inventory/SlotChiselSelection.java | 9 +++++++++ .../chisel/item/chisel/ChiselController.java | 1 - .../chisel/{api => item/chisel}/ChiselMode.java | 3 ++- .../com/cricketcraft/chisel/item/chisel/ItemChisel.java | 7 ------- .../chisel/network/message/MessageChiselMode.java | 2 +- src/main/java/com/cricketcraft/chisel/utils/General.java | 2 +- 7 files changed, 14 insertions(+), 13 deletions(-) rename src/main/java/com/cricketcraft/chisel/{api => item/chisel}/ChiselMode.java (97%) diff --git a/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java b/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java index a7c4e765..3eab093c 100644 --- a/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java +++ b/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java @@ -6,14 +6,13 @@ import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; -import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11; -import com.cricketcraft.chisel.api.ChiselMode; import com.cricketcraft.chisel.inventory.ContainerChisel; import com.cricketcraft.chisel.inventory.InventoryChiselSelection; import com.cricketcraft.chisel.inventory.SlotChiselInput; +import com.cricketcraft.chisel.item.chisel.ChiselMode; import com.cricketcraft.chisel.network.PacketHandler; import com.cricketcraft.chisel.network.message.MessageChiselMode; import com.cricketcraft.chisel.utils.General; diff --git a/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java b/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java index 6a476c37..481ba578 100644 --- a/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java +++ b/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java @@ -4,9 +4,13 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import com.cricketcraft.chisel.Chisel; import com.cricketcraft.chisel.api.IChiselItem; +import com.cricketcraft.chisel.carving.Carving; import com.cricketcraft.chisel.utils.General; +import com.cricketcraft.chisel.utils.GeneralClient; public class SlotChiselSelection extends Slot { @@ -58,6 +62,11 @@ public class SlotChiselSelection extends Slot { ((IChiselItem)container.chisel.getItem()).onChisel(player.worldObj, player.inventory, player.inventory.currentItem, container.chisel, General.getVariation(crafted)); + if (player.worldObj.isRemote) { + String sound = Carving.chisel.getVariationSound(crafted.getItem(), crafted.getItemDamage()); + GeneralClient.playChiselSound(player.worldObj, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ), sound); + } + /* * ItemStack stack=player.inventory.getItemStack(); * diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java index 08b575ce..eb4770fd 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java @@ -10,7 +10,6 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import com.cricketcraft.chisel.Chisel; -import com.cricketcraft.chisel.api.ChiselMode; import com.cricketcraft.chisel.api.IChiselItem; import com.cricketcraft.chisel.api.carving.ICarvingVariation; import com.cricketcraft.chisel.carving.Carving; diff --git a/src/main/java/com/cricketcraft/chisel/api/ChiselMode.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselMode.java similarity index 97% rename from src/main/java/com/cricketcraft/chisel/api/ChiselMode.java rename to src/main/java/com/cricketcraft/chisel/item/chisel/ChiselMode.java index a0da6f00..43bf16b2 100644 --- a/src/main/java/com/cricketcraft/chisel/api/ChiselMode.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselMode.java @@ -1,4 +1,4 @@ -package com.cricketcraft.chisel.api; +package com.cricketcraft.chisel.item.chisel; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; @@ -7,6 +7,7 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import com.cricketcraft.chisel.api.IChiselItem; import com.cricketcraft.chisel.api.carving.ICarvingVariation; import com.cricketcraft.chisel.network.PacketHandler; import com.cricketcraft.chisel.network.message.MessageChiselSound; diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java index a05a8766..f740e6e0 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java @@ -13,7 +13,6 @@ import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import com.cricketcraft.chisel.Chisel; -import com.cricketcraft.chisel.api.ChiselMode; import com.cricketcraft.chisel.api.IChiselItem; import com.cricketcraft.chisel.api.carving.ICarvingVariation; import com.cricketcraft.chisel.carving.Carving; @@ -96,12 +95,6 @@ public class ItemChisel extends Item implements IChiselItem { inv.decrStackSize(slot, 1); } } - - if (world.isRemote) { - String sound = carving.getVariationSound(target.getBlock(), target.getItemMeta()); - EntityPlayer player = Chisel.proxy.getClientPlayer(); - GeneralClient.playChiselSound(world, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ), sound); - } } @Override diff --git a/src/main/java/com/cricketcraft/chisel/network/message/MessageChiselMode.java b/src/main/java/com/cricketcraft/chisel/network/message/MessageChiselMode.java index 0bde806e..db2ab62f 100644 --- a/src/main/java/com/cricketcraft/chisel/network/message/MessageChiselMode.java +++ b/src/main/java/com/cricketcraft/chisel/network/message/MessageChiselMode.java @@ -3,8 +3,8 @@ package com.cricketcraft.chisel.network.message; import io.netty.buffer.ByteBuf; import net.minecraft.item.ItemStack; -import com.cricketcraft.chisel.api.ChiselMode; import com.cricketcraft.chisel.api.IChiselItem; +import com.cricketcraft.chisel.item.chisel.ChiselMode; import com.cricketcraft.chisel.utils.General; import cpw.mods.fml.common.network.ByteBufUtils; diff --git a/src/main/java/com/cricketcraft/chisel/utils/General.java b/src/main/java/com/cricketcraft/chisel/utils/General.java index 1671284d..99ab77ac 100644 --- a/src/main/java/com/cricketcraft/chisel/utils/General.java +++ b/src/main/java/com/cricketcraft/chisel/utils/General.java @@ -15,9 +15,9 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import com.cricketcraft.chisel.api.ChiselMode; import com.cricketcraft.chisel.api.carving.ICarvingVariation; import com.cricketcraft.chisel.carving.Carving; +import com.cricketcraft.chisel.item.chisel.ChiselMode; public class General { From 5188e39b5745269cc23d2e4302acc303274b64f1 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Mon, 19 Jan 2015 10:01:08 -0500 Subject: [PATCH 17/75] Fix up issues with breaking chisels (Fixes #162) --- .../cricketcraft/chisel/api/IChiselItem.java | 3 ++- .../block/tileentity/TileEntityAutoChisel.java | 7 ++++++- .../chisel/carving/CarvableHelper.java | 3 --- .../chisel/inventory/SlotChiselSelection.java | 7 ++++++- .../chisel/item/chisel/ChiselController.java | 8 -------- .../chisel/item/chisel/ChiselMode.java | 17 ++++++++++++++--- .../chisel/item/chisel/ItemChisel.java | 11 ++--------- .../network/message/MessageChiselSound.java | 13 +++++++++++-- 8 files changed, 41 insertions(+), 28 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java b/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java index 8063cf74..f3015a93 100644 --- a/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java +++ b/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java @@ -39,8 +39,9 @@ public interface IChiselItem { * The {@link ItemStack} representing the chisel * @param target * The {@link ItemStack} representing the target item + * @return True if the chisel should be damaged. False otherwise. */ - void onChisel(World world, IInventory inv, int slot, ItemStack chisel, ICarvingVariation target); + boolean onChisel(World world, IInventory inv, int slot, 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. diff --git a/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java b/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java index 33e229db..d330dd1f 100644 --- a/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java +++ b/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java @@ -209,7 +209,12 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory /** Calls IChiselItem#onChisel() and sends the chisel packet for sound/animation */ private void chiselItem(int chiseled) { if (!worldObj.isRemote) { - ((IChiselItem) inventory[CHISEL].getItem()).onChisel(worldObj, this, CHISEL, inventory[CHISEL], General.getVariation(inventory[TARGET])); + if (((IChiselItem) inventory[CHISEL].getItem()).onChisel(worldObj, this, CHISEL, inventory[CHISEL], General.getVariation(inventory[TARGET]))) { + inventory[CHISEL].setItemDamage(inventory[CHISEL].getItemDamage() - 1); + if (inventory[CHISEL].getItemDamage() >= inventory[CHISEL].getMaxDamage()) { + inventory[CHISEL] = null; + } + } PacketHandler.INSTANCE.sendToDimension(new MessageAutoChisel(this, chiseled, true), worldObj.provider.dimensionId); } else { GeneralChiselClient.spawnAutoChiselFX(this, lastBase != null ? lastBase : inventory[BASE]); diff --git a/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java b/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java index 7b37b1cc..cbbc938e 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java +++ b/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java @@ -38,9 +38,6 @@ public class CarvableHelper { public static final int V4 = 7; public static final int CTMX = 8; - public CarvableHelper() { - } - public ArrayList variations = new ArrayList(); CarvableVariation[] map = new CarvableVariation[16]; public boolean forbidChiseling = false; diff --git a/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java b/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java index 481ba578..f40f4c0f 100644 --- a/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java +++ b/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java @@ -60,7 +60,12 @@ public class SlotChiselSelection extends Slot { selInventory.updateItems(); - ((IChiselItem)container.chisel.getItem()).onChisel(player.worldObj, player.inventory, player.inventory.currentItem, container.chisel, General.getVariation(crafted)); + if (((IChiselItem) container.chisel.getItem()).onChisel(player.worldObj, player.inventory, player.inventory.currentItem, container.chisel, General.getVariation(crafted))) { + container.chisel.damageItem(1, player); + if (container.chisel.stackSize <= 0) { + player.inventory.mainInventory[player.inventory.currentItem] = null; + } + } if (player.worldObj.isRemote) { String sound = Carving.chisel.getVariationSound(crafted.getItem(), crafted.getItemDamage()); diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java index eb4770fd..4df6578c 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java @@ -4,7 +4,6 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; -import net.minecraft.util.ChatComponentText; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.event.entity.player.PlayerInteractEvent; @@ -91,13 +90,6 @@ public final class ChiselController { } else { lastTickClick = event.world.getTotalWorldTime(); } - - if (!event.world.isRemote && event.entityPlayer.isSneaking()) { - ChiselMode mode = General.getChiselMode(held); - General.setChiselMode(held, ChiselMode.values()[(mode.ordinal() + 1) % 3]); - event.entityPlayer.addChatMessage(new ChatComponentText(General.getChiselMode(held).toString())); - break; - } if (!event.world.isRemote && chisel.canOpenGui(event.world, event.entityPlayer, held)) { event.entityPlayer.openGui(Chisel.instance, 0, event.world, 0, 0, 0); } diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselMode.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselMode.java index 43bf16b2..6efcab48 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselMode.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselMode.java @@ -3,6 +3,7 @@ package com.cricketcraft.chisel.item.chisel; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -93,6 +94,7 @@ public enum ChiselMode { private static void setVariation(EntityPlayer player, World world, int x, int y, int z, Block origBlock, int origMeta, ICarvingVariation v) { Block block = world.getBlock(x, y, z); int meta = world.getBlockMetadata(x, y, z); + ItemStack held = player.getCurrentEquippedItem(); if (block == v.getBlock() && meta == v.getBlockMeta()) { return; // don't chisel to the same thing } @@ -100,9 +102,18 @@ public enum ChiselMode { return; // don't chisel if this doesn't match the target block (for the AOE modes) } - PacketHandler.INSTANCE.sendTo(new MessageChiselSound(x, y, z, v), (EntityPlayerMP) player); - world.setBlock(x, y, z, v.getBlock(), v.getBlockMeta(), 3); - ((IChiselItem) player.getCurrentEquippedItem().getItem()).onChisel(world, player.inventory, player.inventory.currentItem, player.getCurrentEquippedItem(), v); + if (held != null && held.getItem() instanceof IChiselItem) { + world.setBlock(x, y, z, v.getBlock(), v.getBlockMeta(), 3); + boolean breakChisel = false; + if (((IChiselItem) player.getCurrentEquippedItem().getItem()).onChisel(world, player.inventory, player.inventory.currentItem, player.getCurrentEquippedItem(), v)) { + player.getCurrentEquippedItem().damageItem(1, player); + if (player.getCurrentEquippedItem().stackSize <= 0) { + player.inventory.mainInventory[player.inventory.currentItem] = null; + breakChisel = true; + } + } + PacketHandler.INSTANCE.sendTo(new MessageChiselSound(x, y, z, v, breakChisel), (EntityPlayerMP) player); + } } public ChiselMode next() { diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java index f740e6e0..7d14dd67 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java @@ -7,7 +7,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.MathHelper; import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; @@ -17,7 +16,6 @@ import com.cricketcraft.chisel.api.IChiselItem; import com.cricketcraft.chisel.api.carving.ICarvingVariation; import com.cricketcraft.chisel.carving.Carving; import com.cricketcraft.chisel.config.Configurations; -import com.cricketcraft.chisel.utils.GeneralClient; public class ItemChisel extends Item implements IChiselItem { @@ -88,13 +86,8 @@ public class ItemChisel extends Item implements IChiselItem { } @Override - public void onChisel(World world, IInventory inv, int slot, ItemStack chisel, ICarvingVariation target) { - if (Configurations.allowChiselDamage) { - chisel.setItemDamage(chisel.getItemDamage() + 1); - if (chisel.getItemDamage() >= chisel.getMaxDamage()) { - inv.decrStackSize(slot, 1); - } - } + public boolean onChisel(World world, IInventory inv, int slot, ItemStack chisel, ICarvingVariation target) { + return Configurations.allowChiselDamage; } @Override diff --git a/src/main/java/com/cricketcraft/chisel/network/message/MessageChiselSound.java b/src/main/java/com/cricketcraft/chisel/network/message/MessageChiselSound.java index 781e3da6..a910eda5 100644 --- a/src/main/java/com/cricketcraft/chisel/network/message/MessageChiselSound.java +++ b/src/main/java/com/cricketcraft/chisel/network/message/MessageChiselSound.java @@ -2,9 +2,10 @@ package com.cricketcraft.chisel.network.message; import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import com.cricketcraft.chisel.Chisel; import com.cricketcraft.chisel.api.carving.ICarvingVariation; -import com.cricketcraft.chisel.carving.CarvingVariation; import com.cricketcraft.chisel.client.GeneralChiselClient; import com.cricketcraft.chisel.item.chisel.ItemChisel; import com.cricketcraft.chisel.network.message.base.MessageCoords; @@ -21,11 +22,13 @@ public class MessageChiselSound extends MessageCoords { private int block; private byte meta; + private boolean breakChisel; - public MessageChiselSound(int x, int y, int z, ICarvingVariation v) { + public MessageChiselSound(int x, int y, int z, ICarvingVariation v, boolean breakChisel) { super(x, y, z); this.block = Block.getIdFromBlock(v.getBlock()); this.meta = (byte) v.getBlockMeta(); + this.breakChisel = breakChisel; } @Override @@ -33,6 +36,7 @@ public class MessageChiselSound extends MessageCoords { super.toBytes(buf); buf.writeInt(block); buf.writeByte(meta); + buf.writeBoolean(breakChisel); } @Override @@ -40,6 +44,7 @@ public class MessageChiselSound extends MessageCoords { super.fromBytes(buf); block = buf.readInt(); meta = buf.readByte(); + breakChisel = buf.readBoolean(); } public static class Handler implements IMessageHandler { @@ -48,6 +53,10 @@ public class MessageChiselSound extends MessageCoords { public IMessage onMessage(MessageChiselSound message, MessageContext ctx) { String sound = ItemChisel.carving.getVariationSound(Block.getBlockById(message.block), message.meta); GeneralChiselClient.spawnChiselEffect(message.x, message.y, message.z, sound); + if (message.breakChisel) { + EntityPlayer player = Chisel.proxy.getClientPlayer(); + player.renderBrokenItemStack(player.getCurrentEquippedItem()); + } return null; } } From 5b4af2ee49abe451127fd6f17d5703f6168cd261 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Mon, 19 Jan 2015 11:23:11 -0500 Subject: [PATCH 18/75] Allow only the diamond chisel to have modes. Fix breaking sounds up more --- .../cricketcraft/chisel/api/IChiselItem.java | 9 +++++++ .../tileentity/TileEntityAutoChisel.java | 23 ++++++++++------ .../chisel/client/gui/GuiAutoChisel.java | 2 -- .../chisel/client/gui/GuiChisel.java | 25 +++++++++++++----- .../client/render/tile/RenderAutoChisel.java | 3 --- .../chisel/config/Configurations.java | 17 +++++++----- .../chisel/inventory/ContainerAutoChisel.java | 2 +- .../chisel/item/chisel/ItemChisel.java | 26 ++++++++++++------- .../network/message/MessageAutoChisel.java | 9 ++++--- .../resources/assets/chisel/lang/en_US.lang | 8 +++--- 10 files changed, 81 insertions(+), 43 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java b/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java index f3015a93..6c2af1c9 100644 --- a/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java +++ b/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java @@ -80,4 +80,13 @@ public interface IChiselItem { * @return True if the chiseling should take place. False otherwise. */ boolean canChiselBlock(World world, 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); } diff --git a/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java b/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java index d330dd1f..93f84d80 100644 --- a/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java +++ b/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java @@ -60,7 +60,7 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory public static final int maxRot = 60; public static final int rotAmnt = 15; public float chiselRot; - public boolean chiseling = false; + public boolean chiseling = false, breakChisel = false;; public int toChisel = 1; private ItemStack lastBase; @@ -166,6 +166,7 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory } } } else if (worldObj.isRemote) { + System.out.println(chiseling + " " + chiselRot); if (chiseling) { chiselRot += rotAmnt; if (chiselRot >= maxRot) { @@ -209,14 +210,19 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory /** Calls IChiselItem#onChisel() and sends the chisel packet for sound/animation */ private void chiselItem(int chiseled) { if (!worldObj.isRemote) { + boolean breakChisel = false; if (((IChiselItem) inventory[CHISEL].getItem()).onChisel(worldObj, this, CHISEL, inventory[CHISEL], General.getVariation(inventory[TARGET]))) { - inventory[CHISEL].setItemDamage(inventory[CHISEL].getItemDamage() - 1); + inventory[CHISEL].setItemDamage(inventory[CHISEL].getItemDamage() + 1); if (inventory[CHISEL].getItemDamage() >= inventory[CHISEL].getMaxDamage()) { - inventory[CHISEL] = null; + setInventorySlotContents(CHISEL, null); + breakChisel = true; } } - PacketHandler.INSTANCE.sendToDimension(new MessageAutoChisel(this, chiseled, true), worldObj.provider.dimensionId); + PacketHandler.INSTANCE.sendToDimension(new MessageAutoChisel(this, chiseled, true, breakChisel), worldObj.provider.dimensionId); } else { + if (breakChisel) { + worldObj.playSound(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "random.break", 0.8F, 0.8F + worldObj.rand.nextFloat() * 0.4F, false); + } GeneralChiselClient.spawnAutoChiselFX(this, lastBase != null ? lastBase : inventory[BASE]); chiseling = false; if (lastBase != null) { @@ -276,7 +282,7 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory if (stack != null && stack.stackSize > getInventoryStackLimit()) { stack.stackSize = getInventoryStackLimit(); } - + if (worldObj.isRemote && slot == BASE && stack != null) { lastBase = stack.copy(); } @@ -368,7 +374,7 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory } else if (inventory[slot] == null) { return null; } else { - ghostItem.setEntityItemStack(new ItemStack(inventory[slot].getItem(), 1, inventory[slot].getItemDamage())); + ghostItem.setEntityItemStack(inventory[slot].copy()); return ghostItem; } } @@ -408,14 +414,15 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory } } - public void doChiselAnim(ItemStack lastChiseled, int chiseled, boolean playSound) { + public void doChiselAnim(ItemStack lastChiseled, int chiseled, boolean playSound, boolean breakChisel) { this.lastBase = lastChiseled == null ? null : lastChiseled.copy(); this.toChisel = chiseled; if (playSound) { this.chiseling = true; } + this.breakChisel = breakChisel; } - + public ItemStack getLastBase() { return lastBase == null ? null : lastBase.copy(); } diff --git a/src/main/java/com/cricketcraft/chisel/client/gui/GuiAutoChisel.java b/src/main/java/com/cricketcraft/chisel/client/gui/GuiAutoChisel.java index 4584664e..6d20815f 100644 --- a/src/main/java/com/cricketcraft/chisel/client/gui/GuiAutoChisel.java +++ b/src/main/java/com/cricketcraft/chisel/client/gui/GuiAutoChisel.java @@ -2,12 +2,10 @@ package com.cricketcraft.chisel.client.gui; import java.util.List; -import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; diff --git a/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java b/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java index 3eab093c..a1c54edd 100644 --- a/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java +++ b/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java @@ -9,6 +9,7 @@ import net.minecraft.inventory.Slot; import org.lwjgl.opengl.GL11; +import com.cricketcraft.chisel.api.IChiselItem; import com.cricketcraft.chisel.inventory.ContainerChisel; import com.cricketcraft.chisel.inventory.InventoryChiselSelection; import com.cricketcraft.chisel.inventory.SlotChiselInput; @@ -45,24 +46,36 @@ public class GuiChisel extends GuiContainer { super.initGui(); currentMode = General.getChiselMode(container.chisel); - int x = this.width / 2 - 120; - int y = this.height / 2 - 6; - buttonList.add(new GuiButton(0, x, y, 53, 20, "")); - setButtonText(); + if (showMode()) { + int x = this.width / 2 - 120; + int y = this.height / 2 - 6; + buttonList.add(new GuiButton(0, x, y, 53, 20, "")); + setButtonText(); + } } private void setButtonText() { ((GuiButton) buttonList.get(0)).displayString = I18n.format(container.inventory.getInventoryName() + ".mode." + currentMode.name().toLowerCase()); } + private boolean showMode() { + if (container.chisel != null && container.chisel.getItem() instanceof IChiselItem) { + return ((IChiselItem) container.chisel.getItem()).hasModes(container.chisel); + } + return false; + } + @Override protected void drawGuiContainerForegroundLayer(int j, int i) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); String line = I18n.format(this.container.inventory.getInventoryName() + ".title"); fontRendererObj.drawSplitString(line, 50 - fontRendererObj.getStringWidth(line) / 2, 60, 40, 0x404040); - line = I18n.format(this.container.inventory.getInventoryName() + ".mode"); - fontRendererObj.drawString(line, fontRendererObj.getStringWidth(line) / 2 + 6, 85, 0x404040); + + if (showMode()) { + line = I18n.format(this.container.inventory.getInventoryName() + ".mode"); + fontRendererObj.drawString(line, fontRendererObj.getStringWidth(line) / 2 + 6, 85, 0x404040); + } } @Override diff --git a/src/main/java/com/cricketcraft/chisel/client/render/tile/RenderAutoChisel.java b/src/main/java/com/cricketcraft/chisel/client/render/tile/RenderAutoChisel.java index ef65c41b..d1f55795 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/tile/RenderAutoChisel.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/tile/RenderAutoChisel.java @@ -186,9 +186,6 @@ public class RenderAutoChisel extends TileEntitySpecialRenderer implements ISimp renderItem.doRender(item, 0, 0, 0, 0, 0); settings.fancyGraphics = was; glPopMatrix(); - } else { - autoChisel.chiselRot = 0; - autoChisel.chiseling = false; } } } diff --git a/src/main/java/com/cricketcraft/chisel/config/Configurations.java b/src/main/java/com/cricketcraft/chisel/config/Configurations.java index dfb63382..9de1acc3 100644 --- a/src/main/java/com/cricketcraft/chisel/config/Configurations.java +++ b/src/main/java/com/cricketcraft/chisel/config/Configurations.java @@ -39,11 +39,12 @@ public class Configurations { public static int ironChiselMaxDamage; public static int diamondChiselMaxDamage; public static boolean ironChiselCanLeftClick; - + public static boolean ironChiselHasModes; + public static boolean useRoadLineTool; public static String getRoadLineTool; public static int roadLineToolLevel; - + public static boolean refreshConfig() { String category; @@ -78,19 +79,21 @@ public class Configurations { .getBoolean(true); /* chisel */ - category = "chisel"; allowChiselDamage = config.get(category, "allowChiselDamage", true, "Should the chisel be damageable and take damage when it chisels something.").getBoolean(); ironChiselMaxDamage = config.get(category, "ironChiselMaxDamage", 500, "The max damage of the standard iron chisel. Default: 500.").getInt(); diamondChiselMaxDamage = config.get(category, "diamondChiselMaxDamage", 5000, "The max damage of the diamond chisel. Default: 5000").getInt(); ironChiselCanLeftClick = config.get(category, "ironChiselCanLeftClick", true, "If this is true, the iron chisel can left click chisel blocks. If false, it cannot.").getBoolean(); - + ironChiselHasModes = config.get(category, "ironChiselHasModes", false, "If this is true, the iron chisel can change its chisel mode just as the diamond chisel can.").getBoolean(); + /* block */ category = "block"; useRoadLineTool = config.get(category, "useRoadLineTool", false, "Should the road line require a tool to break (If false, road lines can be broken in Adventure)").getBoolean(); - getRoadLineTool = config.get(category, "getRoadLineTool","pickaxe","The tool that is able to break roadLines (requires useRoadLineTool to be true to take effect)").getString(); - roadLineToolLevel = config.get(category, "roadLineToolLevel",0,"The lowest harvest level of the tool able to break the road lines (requires useRoadLineTool to be true to take effect) (0 = Wood/Gold, 1 = Stone, 2 = Iron, 3 = Diamond) Default: 0").getInt(); - + getRoadLineTool = config.get(category, "getRoadLineTool", "pickaxe", "The tool that is able to break roadLines (requires useRoadLineTool to be true to take effect)").getString(); + roadLineToolLevel = config.get(category, "roadLineToolLevel", 0, + "The lowest harvest level of the tool able to break the road lines (requires useRoadLineTool to be true to take effect) (0 = Wood/Gold, 1 = Stone, 2 = Iron, 3 = Diamond) Default: 0") + .getInt(); + if (config.hasChanged()) { config.save(); } diff --git a/src/main/java/com/cricketcraft/chisel/inventory/ContainerAutoChisel.java b/src/main/java/com/cricketcraft/chisel/inventory/ContainerAutoChisel.java index 7081e191..466b0942 100644 --- a/src/main/java/com/cricketcraft/chisel/inventory/ContainerAutoChisel.java +++ b/src/main/java/com/cricketcraft/chisel/inventory/ContainerAutoChisel.java @@ -103,7 +103,7 @@ public class ContainerAutoChisel extends Container { if (!player.worldObj.isRemote && slot.slotNumber == TileEntityAutoChisel.BASE && !ItemStack.areItemStacksEqual(stack, slot.getStack())) { int chiseled = stack == null ? 0 : slot.getStack() == null ? stack.stackSize : stack.stackSize - slot.getStack().stackSize; - PacketHandler.INSTANCE.sendToDimension(new MessageAutoChisel(autoChisel, chiseled, false), player.worldObj.provider.dimensionId); + PacketHandler.INSTANCE.sendToDimension(new MessageAutoChisel(autoChisel, chiseled, false, false), player.worldObj.provider.dimensionId); } return ret; diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java index 7d14dd67..560b010d 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java @@ -3,11 +3,11 @@ package com.cricketcraft.chisel.item.chisel; import java.util.List; import net.minecraft.block.Block; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; @@ -57,16 +57,19 @@ public class ItemChisel extends Item implements IChiselItem { @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean held) { - String unloc = "item.chisel.chisel.desc."; // TODO this is hacky - for (int i = 0; i < 3; i++) { - if (i == 0 || type == ChiselType.DIAMOND || Configurations.ironChiselCanLeftClick) { - list.add(StatCollector.translateToLocal(unloc + i)); - } + String base = "item.chisel.chisel.desc."; + String gui = I18n.format(base + "gui"); + String lc1 = I18n.format(base + "lc1"); + String lc2 = I18n.format(base + "lc2"); + String modes = I18n.format(base + "modes"); + list.add(gui); + if (type == ChiselType.DIAMOND || Configurations.ironChiselCanLeftClick) { + list.add(lc1); + list.add(lc2); } - - if (type == ChiselType.DIAMOND) { + if (type == ChiselType.DIAMOND || Configurations.ironChiselHasModes) { list.add(""); - list.add(StatCollector.translateToLocal(getUnlocalizedName(stack) + ".desc")); + list.add(modes); } } @@ -94,4 +97,9 @@ public class ItemChisel extends Item implements IChiselItem { public boolean canChiselBlock(World world, int x, int y, int z, Block block, int metadata) { return type == ChiselType.DIAMOND || Configurations.ironChiselCanLeftClick; } + + @Override + public boolean hasModes(ItemStack chisel) { + return type == ChiselType.DIAMOND || Configurations.ironChiselHasModes; + } } \ No newline at end of file diff --git a/src/main/java/com/cricketcraft/chisel/network/message/MessageAutoChisel.java b/src/main/java/com/cricketcraft/chisel/network/message/MessageAutoChisel.java index 681dd8fe..1d4410ca 100644 --- a/src/main/java/com/cricketcraft/chisel/network/message/MessageAutoChisel.java +++ b/src/main/java/com/cricketcraft/chisel/network/message/MessageAutoChisel.java @@ -18,16 +18,17 @@ public class MessageAutoChisel extends MessageCoords { } ItemStack base; - boolean playSound; + boolean playSound, breakChisel; int chiseled; - public MessageAutoChisel(TileEntityAutoChisel tile, int chiseled, boolean playSound) { + public MessageAutoChisel(TileEntityAutoChisel tile, int chiseled, boolean playSound, boolean breakChisel) { super(tile); this.base = tile.getStackInSlot(TileEntityAutoChisel.BASE); if (base != null) { base = base.copy(); } this.playSound = playSound; + this.breakChisel = breakChisel; this.chiseled = chiseled; } @@ -35,6 +36,7 @@ public class MessageAutoChisel extends MessageCoords { public void toBytes(ByteBuf buf) { super.toBytes(buf); buf.writeBoolean(playSound); + buf.writeBoolean(breakChisel); buf.writeInt(chiseled); ByteBufUtils.writeItemStack(buf, base); } @@ -43,6 +45,7 @@ public class MessageAutoChisel extends MessageCoords { public void fromBytes(ByteBuf buf) { super.fromBytes(buf); this.playSound = buf.readBoolean(); + this.breakChisel = buf.readBoolean(); this.chiseled = buf.readInt(); this.base = ByteBufUtils.readItemStack(buf); } @@ -53,7 +56,7 @@ public class MessageAutoChisel extends MessageCoords { TileEntity te = message.getTileEntity(ctx); if (te instanceof TileEntityAutoChisel) { - ((TileEntityAutoChisel) te).doChiselAnim(message.base, message.chiseled, message.playSound); + ((TileEntityAutoChisel) te).doChiselAnim(message.base, message.chiseled, message.playSound, message.breakChisel); } return null; } diff --git a/src/main/resources/assets/chisel/lang/en_US.lang b/src/main/resources/assets/chisel/lang/en_US.lang index 8585f0a2..dd1b5c39 100644 --- a/src/main/resources/assets/chisel/lang/en_US.lang +++ b/src/main/resources/assets/chisel/lang/en_US.lang @@ -3,12 +3,12 @@ # Item localizations item.chisel.chisel_iron.name=Chisel -item.chisel.chisel.desc.0=Right-Click to open GUI -item.chisel.chisel.desc.1=Left click to chisel blocks in world -item.chisel.chisel.desc.2=Can target a block by leaving it in the inventory +item.chisel.chisel.desc.gui=Right-Click to open GUI +item.chisel.chisel.desc.lc1=Left click to chisel blocks in world +item.chisel.chisel.desc.lc2=Can target a block by leaving it in the inventory +item.chisel.chisel.desc.modes=Has multiple modes for chiseling. item.chisel.chisel_diamond.name=Diamond Chisel -item.chisel.chisel_diamond.desc=Has multiple modes for chiseling. WIP. item.ballMoss.name=Ball O' Moss item.ballMoss.desc=Right-Click to throw. This will turn Cobblestone to Moss Stone on impact. From e910d06c02acfb24cb4781982571454a4559a3fe Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Mon, 19 Jan 2015 11:27:52 -0500 Subject: [PATCH 19/75] Remove debug spam --- .../chisel/block/tileentity/TileEntityAutoChisel.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java b/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java index 93f84d80..bc2c662e 100644 --- a/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java +++ b/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java @@ -166,7 +166,6 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory } } } else if (worldObj.isRemote) { - System.out.println(chiseling + " " + chiselRot); if (chiseling) { chiselRot += rotAmnt; if (chiselRot >= maxRot) { From e2586546cc92ac97c5b6cd900d861ebac58746e8 Mon Sep 17 00:00:00 2001 From: Cricket Date: Mon, 19 Jan 2015 17:07:53 -0500 Subject: [PATCH 20/75] I just removed my bit --- src/main/java/com/cricketcraft/chisel/Chisel.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/Chisel.java b/src/main/java/com/cricketcraft/chisel/Chisel.java index 09b60cfb..10e5cfb9 100644 --- a/src/main/java/com/cricketcraft/chisel/Chisel.java +++ b/src/main/java/com/cricketcraft/chisel/Chisel.java @@ -113,8 +113,6 @@ public class Chisel { Configurations.config.load(); Configurations.refreshConfig(); - logger.info("Hey Jared, I wasn't lying"); - ChiselTabs.preInit(); Features.preInit(); PacketHandler.init(); From d4bd181ef1e998f3230489a9372d8723ff69282d Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Mon, 19 Jan 2015 18:59:25 -0500 Subject: [PATCH 21/75] Add some lifecycle logging to Features --- .../com/cricketcraft/chisel/Features.java | 49 +++++++++++++++++-- .../chisel/config/Configurations.java | 4 +- 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index 01979c2f..8b34d6d5 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -695,8 +695,7 @@ public enum Features { @Override void addBlocks() { BlockCarvable futura = (BlockCarvable) new BlockCarvable(Material.rock/* - * , - * "futura/screenOverlay-ctm" + * , "futura/screenOverlay-ctm" */).setCreativeTab(ChiselTabs.tabMetalChiselBlocks).setHardness(2.0F).setResistance(10F); futura.carverHelper.addVariation("tile.futura.0.desc", 0, "futura/WIP/screenMetallicWIP"); futura.carverHelper.addVariation("tile.futura.1.desc", 1, "futura/WIP/screenCyanWIP"); @@ -2468,27 +2467,45 @@ public enum Features { private static int meta = 0; static void init() { + Chisel.logger.info("Starting init..."); loadRecipes(); + Chisel.logger.info("Init finished."); } private static void loadBlocks() { + Chisel.logger.info("Loading blocks..."); + int num = 0; for (Features f : values()) { if (f.enabled()) { f.addBlocks(); + ++num; + } else { + logDisabled(f); } } + Chisel.logger.info(num + " Feature's blocks loaded."); + Chisel.logger.info("Loading Tile Entities..."); Chisel.proxy.registerTileEntities(); + Chisel.logger.info("Tile Entities loaded."); } private static void loadItems() { + Chisel.logger.info("Loading items..."); + int num = 0; for (Features f : values()) { if (f.enabled()) { f.addItems(); + ++num; + } else { + logDisabled(f); } } + Chisel.logger.info(num + " Feature's items loaded."); } private static void loadRecipes() { + Chisel.logger.info("Loading recipes..."); + int num = 0; for (Features f : values()) { if (f.enabled()) { if (f.needsMetaRecipes()) { @@ -2500,13 +2517,27 @@ public enum Features { } else { f.addRecipes(); } + ++num; + } else { + logDisabled(f); } } + Chisel.logger.info(num + " Feature's recipes loaded."); + } + + private static void logDisabled(Features f) { + if (!f.hasParentFeature() && f.parent != null) { + Chisel.logger.info("Skipping feature {} as its parent feature {} was disabled.", Configurations.featureName(f), Configurations.featureName(f.parent)); + } else if (!f.hasRequiredMod() && f.getRequiredMod() != null) { + Chisel.logger.info("Skipping feature {} as its required mod {} was missing.", Configurations.featureName(f), f.getRequiredMod()); + } else { + Chisel.logger.info("Skipping feature {} as it was disabled in the config.", Configurations.featureName(f)); + } } public static boolean oneModdedFeatureLoaded() { for (Features f : values()) { - if (f.getRequiredMod() != null && Loader.isModLoaded(f.getRequiredMod())) { + if (f.hasRequiredMod()) { return true; } } @@ -2514,8 +2545,10 @@ public enum Features { } static void preInit() { + Chisel.logger.info("Starting pre-init..."); loadBlocks(); loadItems(); + Chisel.logger.info("Pre-init finished."); } private Features parent; @@ -2552,7 +2585,15 @@ public enum Features { } public final boolean enabled() { - return Configurations.featureEnabled(this) && (requiredMod == null || Loader.isModLoaded(requiredMod)) && (parent == null || parent.enabled()); + return Configurations.featureEnabled(this) && hasRequiredMod() && hasParentFeature(); + } + + private final boolean hasParentFeature() { + return parent == null || parent.enabled(); + } + + private final boolean hasRequiredMod() { + return getRequiredMod() == null || Loader.isModLoaded(getRequiredMod()); } private String getRequiredMod() { diff --git a/src/main/java/com/cricketcraft/chisel/config/Configurations.java b/src/main/java/com/cricketcraft/chisel/config/Configurations.java index 9de1acc3..edae58c4 100644 --- a/src/main/java/com/cricketcraft/chisel/config/Configurations.java +++ b/src/main/java/com/cricketcraft/chisel/config/Configurations.java @@ -104,8 +104,8 @@ public class Configurations { return config.get("features", featureName(feature), true).getBoolean(true) && refreshConfig(); } - // this makes the old camelCase names from the new CONSTANT_CASE names - private static String featureName(Features feature) { + /** Makes the old camelCase names from the new CONSTANT_CASE names */ + public static String featureName(Features feature) { String[] words = feature.name().toLowerCase(Locale.ENGLISH).split("_"); if (words.length == 1) { return words[0]; From f6213c9f37bde672be5ded4954f42125dcc0d3cd Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Mon, 19 Jan 2015 21:12:11 -0500 Subject: [PATCH 22/75] Chisels once again have extra attack damage --- .../chisel/config/Configurations.java | 4 +++ .../chisel/item/chisel/ItemChisel.java | 26 +++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/config/Configurations.java b/src/main/java/com/cricketcraft/chisel/config/Configurations.java index edae58c4..644f0697 100644 --- a/src/main/java/com/cricketcraft/chisel/config/Configurations.java +++ b/src/main/java/com/cricketcraft/chisel/config/Configurations.java @@ -40,6 +40,8 @@ public class Configurations { public static int diamondChiselMaxDamage; public static boolean ironChiselCanLeftClick; public static boolean ironChiselHasModes; + public static int ironChiselAttackDamage; + public static int diamondChiselAttackDamage; public static boolean useRoadLineTool; public static String getRoadLineTool; @@ -85,6 +87,8 @@ public class Configurations { diamondChiselMaxDamage = config.get(category, "diamondChiselMaxDamage", 5000, "The max damage of the diamond chisel. Default: 5000").getInt(); ironChiselCanLeftClick = config.get(category, "ironChiselCanLeftClick", true, "If this is true, the iron chisel can left click chisel blocks. If false, it cannot.").getBoolean(); ironChiselHasModes = config.get(category, "ironChiselHasModes", false, "If this is true, the iron chisel can change its chisel mode just as the diamond chisel can.").getBoolean(); + ironChiselAttackDamage = config.get(category, "ironChiselAttackDamage", 2, "The extra attack damage points (in half hearts) that the iron chisel inflicts when it is used to attack an entity.").getInt(); + diamondChiselAttackDamage = config.get(category, "diamondChiselAttackDamage", 2, "The extra attack damage points (in half hearts) that the diamond chisel inflicts when it is used to attack an entity.").getInt(); /* block */ category = "block"; diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java index 560b010d..496543a6 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java @@ -4,6 +4,9 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.client.resources.I18n; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; @@ -16,16 +19,21 @@ import com.cricketcraft.chisel.api.IChiselItem; import com.cricketcraft.chisel.api.carving.ICarvingVariation; import com.cricketcraft.chisel.carving.Carving; import com.cricketcraft.chisel.config.Configurations; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; public class ItemChisel extends Item implements IChiselItem { public enum ChiselType { - IRON(Configurations.ironChiselMaxDamage), DIAMOND(Configurations.diamondChiselMaxDamage); + IRON(Configurations.ironChiselMaxDamage, Configurations.ironChiselAttackDamage), + DIAMOND(Configurations.diamondChiselMaxDamage, Configurations.diamondChiselAttackDamage); final int maxDamage; + final int attackDamage; - ChiselType(int maxDamage) { + ChiselType(int maxDamage, int attackDamage) { this.maxDamage = maxDamage; + this.attackDamage = attackDamage; } } @@ -78,6 +86,20 @@ public class ItemChisel extends Item implements IChiselItem { return true; } + @SuppressWarnings("rawtypes") + @Override + public Multimap getAttributeModifiers(ItemStack stack) { + Multimap multimap = HashMultimap.create(); + multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Chisel Damage", type.attackDamage, 0)); + return multimap; + } + + @Override + public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) { + stack.damageItem(1, attacker); + return super.hitEntity(stack, attacker, target); + } + @Override public boolean canOpenGui(World world, EntityPlayer player, ItemStack chisel) { return true; From 09d72a44b8294c1d901c94d24eb19cd2291bf98b Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Mon, 19 Jan 2015 21:18:48 -0500 Subject: [PATCH 23/75] Fix jackolanterns not emitting light --- src/main/java/com/cricketcraft/chisel/Features.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index 8b34d6d5..a5fbe32c 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -1101,7 +1101,7 @@ public enum Features { void addBlocks() { for (int metadata = 0; metadata < 16; metadata++) { jackolantern[metadata] = (BlockCarvablePumpkin) new BlockCarvablePumpkin(true).setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(1.0F).setBlockName("litpumpkin") - .setCreativeTab(ChiselTabs.tabOtherChiselBlocks); + .setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setLightLevel(1.0f); jackolantern[metadata].setInformation("pumpkin/pumpkin_face_" + (metadata + 1) + "_on"); GameRegistry.registerBlock(jackolantern[metadata], ("jackolantern" + (metadata + 1))); Carving.chisel.addVariation("jackolantern", jackolantern[metadata], 0, (metadata + 1)); From 281343c0198237c966408a97c1da266944ebb687 Mon Sep 17 00:00:00 2001 From: Adaptivity Date: Tue, 20 Jan 2015 18:03:16 +0300 Subject: [PATCH 24/75] Update ru_RU.lang --- .../resources/assets/chisel/lang/en_US.lang | 2 +- .../resources/assets/chisel/lang/ru_RU.lang | 59 ++++++++----------- src/main/resources/mcmod.info | 2 +- src/main/resources/pack.mcmeta | 6 ++ 4 files changed, 31 insertions(+), 38 deletions(-) create mode 100644 src/main/resources/pack.mcmeta diff --git a/src/main/resources/assets/chisel/lang/en_US.lang b/src/main/resources/assets/chisel/lang/en_US.lang index dd1b5c39..cf7e3b8c 100644 --- a/src/main/resources/assets/chisel/lang/en_US.lang +++ b/src/main/resources/assets/chisel/lang/en_US.lang @@ -1218,4 +1218,4 @@ container.chisel.mode=Mode: container.chisel.mode.single=Single container.chisel.mode.panel=Panel container.chisel.mode.column=Column -container.chisel.mode.row=Row +container.chisel.mode.row=Row \ No newline at end of file diff --git a/src/main/resources/assets/chisel/lang/ru_RU.lang b/src/main/resources/assets/chisel/lang/ru_RU.lang index 27e806f6..b9930188 100644 --- a/src/main/resources/assets/chisel/lang/ru_RU.lang +++ b/src/main/resources/assets/chisel/lang/ru_RU.lang @@ -3,12 +3,12 @@ # Item localizations item.chisel.chisel_iron.name=Стамеска -item.chisel.chisel.desc.0=ПКМ, чтобы открыть интерфейс -item.chisel.chisel.desc.1=ЛКМ, чтобы менять блоки прямо в мире -item.chisel.chisel.desc.2=Может ориентироваться на блок в инвентаре +item.chisel.chisel.desc.gui=ПКМ, чтобы открыть интерфейс +item.chisel.chisel.desc.lc1=ЛКМ, чтобы менять блоки прямо в мире +item.chisel.chisel.desc.lc2=Может ориентироваться на блок в инвентаре +item.chisel.chisel.desc.modes=Обладает разными режимами для обработки. item.chisel.chisel_diamond.name=Алмазная стамеска -item.chisel.chisel_diamond.desc=Обладает разными режимами для обработки. В разработке. item.ballMoss.name=Шарик мха item.ballMoss.desc=ПКМ, чтобы кинуть. Превратить булыжник в замшелый булыжник при столкновении. @@ -108,6 +108,7 @@ tile.warningSign.10.desc=В стадии строительства tile.warningSign.11.desc=Громкие звуки tile.warningSign.12.desc=Вход запрещён tile.warningSign.13.desc=В ходе криогенной заморозки +tile.warningSign.14.desc=Необходим кислород #Energised Void Stone Blocks tile.voidstone2.name=Заряженный пустотный камень @@ -758,22 +759,12 @@ tile.ice.15.desc=Блок ледяного яда #Ice Pillars tile.ice_pillar.name=Ледяная колонна -tile.icePillar.0.desc=Ледяная колонна -tile.icePillar.1.desc=Капитель ледяной колонны -tile.icePillar.2.desc=Основание ледяной колонны -tile.icePillar.3.desc=Маленькая ледяная колонна -tile.icePillar.4.desc=Резная ледяная колонна -tile.icePillar.5.desc=Декоративная ледяная колонна -tile.icePillar.6.desc=Греческая ледяная колонна -tile.icePillar.7.desc=Обычная ледяная колонна -tile.icePillar.8.desc=Капитель греческой ледяной колонны -tile.icePillar.9.desc=Капитель обычной ледяной колонны -tile.icePillar.10.desc=Основание греческой ледяной колонны -tile.icePillar.11.desc=Основание обычной ледяной колонны -tile.icePillar.12.desc=Декоративная капитель греческой ледяной колонны -tile.icePillar.13.desc=Декоративная капитель обычной ледяной колонны -tile.icePillar.14.desc=Декоративное основание греческой ледяной колонны -tile.icePillar.15.desc=Декоративное основание обычной ледяной колонны +tile.icePillar.0.desc=Обычная ледяная колонна с обычной капителью +tile.icePillar.1.desc=Обычная ледяная колонна с греческой капителью +tile.icePillar.2.desc=Греческая ледяная колонна с обычной капителью +tile.icePillar.3.desc=Греческая ледяная колонна с греческой капителью +tile.icePillar.4.desc=Резная капитель ледяной колонны +tile.icePillar.5.desc=Декоративная капитель ледяной колонны #Ice Stairs tile.ice_stairs.name=Ледяные ступеньки @@ -822,22 +813,12 @@ tile.packedice.15.desc=Ядовитый блок из плотного льда #Packed Ice Pillars tile.packedice_pillar.name=Колонна из плотного льда -tile.packedicePillar.0.desc=Колонна из плотного льда -tile.packedicePillar.1.desc=Капитель колонны из плотного льда -tile.packedicePillar.2.desc=Основание колонны из плотного льда -tile.packedicePillar.3.desc=Маленькая колонна из плотного льда -tile.packedicePillar.4.desc=Резная колонна из плотного льда -tile.packedicePillar.5.desc=Декоративная колонна из плотного льда -tile.packedicePillar.6.desc=Греческая колонна из плотного льда -tile.packedicePillar.7.desc=Обычная колонна из плотного льда -tile.packedicePillar.8.desc=Капитель греческой колонны из плотного льда -tile.packedicePillar.9.desc=Капитель обычной колонны из плотного льда -tile.packedicePillar.10.desc=Основание греческой колонны из плотного льда -tile.packedicePillar.11.desc=Основание обычной колонны из плотного льда -tile.packedicePillar.12.desc=Капитель декоративной греческой колонны из плотного льда -tile.packedicePillar.13.desc=Капитель декоративной обычной колонны из плотного льда -tile.packedicePillar.14.desc=Основание декоративной греческой колонны из плотного льда -tile.packedicePillar.15.desc=Основание декоративной обычной колонны из плотного льда +tile.packedice_pillar.0.desc=Обычная колонна из плотного льда с обычной капителью +tile.packedice_pillar.1.desc=Обычная колонна из плотного льда с греческой капителью +tile.packedice_pillar.2.desc=Греческая колонна из плотного льда с обычной капителью +tile.packedice_pillar.3.desc=Греческая колонна из плотного льда с греческой капителью +tile.packedice_pillar.4.desc=Резная капитель колонны из плотного льда +tile.packedice_pillar.5.desc=Декоративная капитель колонны из плотного льда #Packed Ice Stairs tile.packedice_stairs.name=Ступеньки из плотного льда @@ -1153,6 +1134,7 @@ tile.fantasyblock2.15.desc=Изношенные фантастические к #Paperwall tile.paperwall.name=Бумажная стена +tile.paperwall_block.name=Блок бумажной стены tile.paperwall.0.desc=Коробочная бумажная стена tile.paperwall.1.desc=Разделённая бумажная стена tile.paperwall.2.desc=Скрещенная бумажная стена @@ -1232,3 +1214,8 @@ itemGroup.tabChisel=Chisel: Предметы container.chisel=Стамеска container.chisel.title=Обработка блоков container.chisel.titleShort=Обработка +container.chisel.mode=Режим: +container.chisel.mode.single=Одиночный +container.chisel.mode.panel=Панель +container.chisel.mode.column=Колонна +container.chisel.mode.row=Ряд \ No newline at end of file diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index b17c1088..76987e17 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,7 +1,7 @@ [ { "modid": "chisel", - "name": "Chisel", + "name": "Chisel 2", "description": "A mod that adds in many fancy blocks for decoration, which are crafted utilising the Chisel.", "version": "${version}", "mcversion": "${mcversion}", diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta new file mode 100644 index 00000000..ee1087b1 --- /dev/null +++ b/src/main/resources/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "pack_format": 1, + "description": "Resources used for Chisel 2" + } +} \ No newline at end of file From 9d91c64485f0d7cf180fc2afecb4367d80dbce9f Mon Sep 17 00:00:00 2001 From: Cricket Date: Tue, 20 Jan 2015 18:13:59 -0500 Subject: [PATCH 25/75] Removed Inventory and Slot parameters --- src/main/java/com/cricketcraft/chisel/api/IChiselItem.java | 6 +----- .../chisel/block/tileentity/TileEntityAutoChisel.java | 2 +- .../cricketcraft/chisel/inventory/SlotChiselSelection.java | 2 +- .../com/cricketcraft/chisel/item/chisel/ChiselMode.java | 2 +- .../com/cricketcraft/chisel/item/chisel/ItemChisel.java | 2 +- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java b/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java index 6c2af1c9..62f8f6f5 100644 --- a/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java +++ b/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java @@ -31,17 +31,13 @@ public interface IChiselItem { * * @param world * {@link World} object - * @param inv - * The inventory this chisel is currently in - * @param slot - * The slot index of the chisel in the inventory * @param chisel * The {@link ItemStack} representing the chisel * @param target * The {@link ItemStack} representing the target item * @return True if the chisel should be damaged. False otherwise. */ - boolean onChisel(World world, IInventory inv, int slot, ItemStack chisel, ICarvingVariation target); + 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. diff --git a/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java b/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java index bc2c662e..94269c48 100644 --- a/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java +++ b/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java @@ -210,7 +210,7 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory private void chiselItem(int chiseled) { if (!worldObj.isRemote) { boolean breakChisel = false; - if (((IChiselItem) inventory[CHISEL].getItem()).onChisel(worldObj, this, CHISEL, inventory[CHISEL], General.getVariation(inventory[TARGET]))) { + if (((IChiselItem) inventory[CHISEL].getItem()).onChisel(worldObj, inventory[CHISEL], General.getVariation(inventory[TARGET]))) { inventory[CHISEL].setItemDamage(inventory[CHISEL].getItemDamage() + 1); if (inventory[CHISEL].getItemDamage() >= inventory[CHISEL].getMaxDamage()) { setInventorySlotContents(CHISEL, null); diff --git a/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java b/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java index f40f4c0f..3b2b6f35 100644 --- a/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java +++ b/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java @@ -60,7 +60,7 @@ public class SlotChiselSelection extends Slot { selInventory.updateItems(); - if (((IChiselItem) container.chisel.getItem()).onChisel(player.worldObj, player.inventory, player.inventory.currentItem, container.chisel, General.getVariation(crafted))) { + if (((IChiselItem) container.chisel.getItem()).onChisel(player.worldObj, container.chisel, General.getVariation(crafted))) { container.chisel.damageItem(1, player); if (container.chisel.stackSize <= 0) { player.inventory.mainInventory[player.inventory.currentItem] = null; diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselMode.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselMode.java index 6efcab48..b58129b2 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselMode.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselMode.java @@ -105,7 +105,7 @@ public enum ChiselMode { if (held != null && held.getItem() instanceof IChiselItem) { world.setBlock(x, y, z, v.getBlock(), v.getBlockMeta(), 3); boolean breakChisel = false; - if (((IChiselItem) player.getCurrentEquippedItem().getItem()).onChisel(world, player.inventory, player.inventory.currentItem, player.getCurrentEquippedItem(), v)) { + if (((IChiselItem) player.getCurrentEquippedItem().getItem()).onChisel(world, player.getCurrentEquippedItem(), v)) { player.getCurrentEquippedItem().damageItem(1, player); if (player.getCurrentEquippedItem().stackSize <= 0) { player.inventory.mainInventory[player.inventory.currentItem] = null; diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java index 496543a6..91d8f569 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java @@ -111,7 +111,7 @@ public class ItemChisel extends Item implements IChiselItem { } @Override - public boolean onChisel(World world, IInventory inv, int slot, ItemStack chisel, ICarvingVariation target) { + public boolean onChisel(World world, ItemStack chisel, ICarvingVariation target) { return Configurations.allowChiselDamage; } From 76a378d12cb4d79aac6e57bfd822c181391f85be Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Tue, 20 Jan 2015 18:26:14 -0500 Subject: [PATCH 26/75] More IChiselItem cleanup and organize imports --- .../java/com/cricketcraft/chisel/api/IChiselItem.java | 11 +++-------- .../cricketcraft/chisel/api/carving/CarvingUtils.java | 2 -- .../chisel/block/tileentity/TileEntityAutoChisel.java | 1 - .../chisel/inventory/InventoryChiselSelection.java | 3 ++- .../chisel/inventory/SlotChiselSelection.java | 1 - .../cricketcraft/chisel/item/chisel/ItemChisel.java | 3 +-- 6 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java b/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java index 62f8f6f5..9dbc433f 100644 --- a/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java +++ b/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java @@ -2,7 +2,6 @@ package com.cricketcraft.chisel.api; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -34,7 +33,7 @@ public interface IChiselItem { * @param chisel * The {@link ItemStack} representing the chisel * @param target - * The {@link ItemStack} representing the target item + * 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); @@ -46,17 +45,13 @@ public interface IChiselItem { * * @param world * {@link World} object - * @param inv - * The inventory this chisel is currently in - * @param slot - * The slot index of the chisel in the inventory * @param chisel * The {@link ItemStack} representing the chisel * @param target - * The {@link ItemStack} representing the target item + * The {@link ICarvingVariation} representing the target item * @return True if the current target can be chiseled into anything. False otherwise. */ - boolean canChisel(World world, IInventory inv, int slot, ItemStack chisel, ItemStack target); + boolean canChisel(World world, ItemStack chisel, ICarvingVariation target); /** * Allows you to control if your item can chisel this block in the world. diff --git a/src/main/java/com/cricketcraft/chisel/api/carving/CarvingUtils.java b/src/main/java/com/cricketcraft/chisel/api/carving/CarvingUtils.java index c219b3b0..317c75b8 100644 --- a/src/main/java/com/cricketcraft/chisel/api/carving/CarvingUtils.java +++ b/src/main/java/com/cricketcraft/chisel/api/carving/CarvingUtils.java @@ -1,7 +1,5 @@ package com.cricketcraft.chisel.api.carving; -import com.cricketcraft.chisel.carving.Carving; - import net.minecraft.item.ItemStack; public class CarvingUtils { diff --git a/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java b/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java index 94269c48..a4baac9b 100644 --- a/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java +++ b/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java @@ -15,7 +15,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.StatCollector; import com.cricketcraft.chisel.api.IChiselItem; -import com.cricketcraft.chisel.api.carving.CarvingUtils; import com.cricketcraft.chisel.carving.Carving; import com.cricketcraft.chisel.client.GeneralChiselClient; import com.cricketcraft.chisel.init.ChiselItems; diff --git a/src/main/java/com/cricketcraft/chisel/inventory/InventoryChiselSelection.java b/src/main/java/com/cricketcraft/chisel/inventory/InventoryChiselSelection.java index ffc34e94..4751c3e9 100644 --- a/src/main/java/com/cricketcraft/chisel/inventory/InventoryChiselSelection.java +++ b/src/main/java/com/cricketcraft/chisel/inventory/InventoryChiselSelection.java @@ -10,6 +10,7 @@ import net.minecraft.item.ItemStack; import com.cricketcraft.chisel.api.IChiselItem; import com.cricketcraft.chisel.item.chisel.ItemChisel; +import com.cricketcraft.chisel.utils.General; public class InventoryChiselSelection implements IInventory { @@ -120,7 +121,7 @@ public class InventoryChiselSelection implements IInventory { if (Block.getBlockFromItem(item) == null) return; - if (!((IChiselItem) chisel.getItem()).canChisel(container.playerInventory.player.worldObj, this, container.playerInventory.currentItem, chisel, chiseledItem)) + if (!((IChiselItem) chisel.getItem()).canChisel(container.playerInventory.player.worldObj, chisel, General.getVariation(chiseledItem))) return; ArrayList list = container.carving.getItems(chiseledItem); diff --git a/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java b/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java index 3b2b6f35..2170a7f3 100644 --- a/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java +++ b/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java @@ -6,7 +6,6 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; -import com.cricketcraft.chisel.Chisel; import com.cricketcraft.chisel.api.IChiselItem; import com.cricketcraft.chisel.carving.Carving; import com.cricketcraft.chisel.utils.General; diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java index 91d8f569..490aefc0 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java @@ -8,7 +8,6 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -106,7 +105,7 @@ public class ItemChisel extends Item implements IChiselItem { } @Override - public boolean canChisel(World world, IInventory inv, int slot, ItemStack chisel, ItemStack target) { + public boolean canChisel(World world, ItemStack chisel, ICarvingVariation target) { return true; } From 378453692b503bd673510531f6c22ea231ec7711 Mon Sep 17 00:00:00 2001 From: Cricket Date: Tue, 20 Jan 2015 18:43:51 -0500 Subject: [PATCH 27/75] Recipes added --- src/main/java/com/cricketcraft/chisel/Features.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index a5fbe32c..8473fa8f 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -142,7 +142,7 @@ public enum Features { @Override void addRecipes() { - // TODO Add a recipe + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.antiBlock), 8, 0, "SSS", "SGS", "SSS", 'S', "stone", 'G', "dustGlowstone")); } @Override @@ -704,6 +704,11 @@ public enum Features { futura.carverHelper.registerAll(futura, "futura"); Carving.chisel.registerOre("futura", "futura"); } + + @Override + void addRecipes(){ + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.futura), 8, 0, "SSS", "SGS", "SSS", 'S', "stone", 'G', "dustRedstone")); + } }, GLASS { From 952e98402bf942c724d8f8c220ddc83594e15a95 Mon Sep 17 00:00:00 2001 From: Cricket Date: Tue, 20 Jan 2015 18:44:37 -0500 Subject: [PATCH 28/75] Update changelog --- changelog | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/changelog b/changelog index 89961bbe..fd51d42a 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,14 @@ +2.3: +Fixed issues with stairs +NEI Handler for seeing how to obtain all the blocks +Fixed sand having the wrong sound +Fixed some assorted rendering and lighting issues +Brand new Auto Chisel +Recipes for the upgrades are now available +Brand new Chisel GUI +Added antiblocks +Chisel Modes and left click! + 2.2.2: Diamond Chisel implemented while still retaining the iron chisel if diamond is disabled Added OCD Blocks From 61fc228dd3fe4ec5636b21b616ebe5292708aadb Mon Sep 17 00:00:00 2001 From: Cricket Date: Tue, 20 Jan 2015 19:20:07 -0500 Subject: [PATCH 29/75] oopsy --- src/main/java/com/cricketcraft/chisel/Features.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index 8473fa8f..b1a06691 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -142,7 +142,7 @@ public enum Features { @Override void addRecipes() { - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.antiBlock), 8, 0, "SSS", "SGS", "SSS", 'S', "stone", 'G', "dustGlowstone")); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.antiBlock, 8, 0), "SSS", "SGS", "SSS", 'S', "stone", 'G', "dustGlowstone")); } @Override @@ -707,7 +707,7 @@ public enum Features { @Override void addRecipes(){ - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.futura), 8, 0, "SSS", "SGS", "SSS", 'S', "stone", 'G', "dustRedstone")); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.futura, 8, 0), "SSS", "SGS", "SSS", 'S', "stone", 'G', "dustRedstone")); } }, From 3f9f2955da0f0f47dbcf6552bd5fde4e7277d7f7 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Tue, 20 Jan 2015 20:04:46 -0500 Subject: [PATCH 30/75] Update preparing for 2.3.2, fix antiblocks being chiselable --- changelog | 19 ++++++++++++++++++- gradle.properties | 2 +- .../com/cricketcraft/chisel/Features.java | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/changelog b/changelog index 89961bbe..18ebfaa9 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,20 @@ +2.3.2: +Fixed antiblocks being chiselable between colors + +2.3.1: +Fixed recipe crash on startup + +2.3: +Fixed issues with stairs +NEI Handler for seeing how to obtain all the blocks +Fixed sand having the wrong sound +Fixed some assorted rendering and lighting issues +Brand new Auto Chisel +Recipes for the upgrades are now available +Brand new Chisel GUI +Added antiblocks +Chisel Modes and left click! + 2.2.2: Diamond Chisel implemented while still retaining the iron chisel if diamond is disabled Added OCD Blocks @@ -164,7 +181,7 @@ Asies changes: Added: Far more config-level configurability for the mod's available features and behaviour. Changed: The config format. Cleaned it up a bit. Watch out! Fixed: Marble stairs and limestone stairs now work! -Fixed: Partially attempted to fix the “left-click-with-chisel to make block disappear” bug. +Fixed: Partially attempted to fix the left-click-with-chisel to make block disappear bug. 1.5.2 (17 March 2014) Added: Chiselable Stained Glass and Stained Glass Panes. Changed: Textures are now compressed with pngout, cutting the mod's size from 4MB to 2.1MB - an almost 50% reduction! diff --git a/gradle.properties b/gradle.properties index 2eb02977..4e12ebd2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -mod_version=2.2.2 +mod_version=2.3.2 minecraft_version=1.7.10 forge_version=10.13.2.1277 diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index a5fbe32c..20e294af 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -131,6 +131,7 @@ public enum Features { void addBlocks() { BlockCarvable antiBlock = (BlockCarvable) new BlockCarvableAntiBlock().setCreativeTab(ChiselTabs.tabOtherChiselBlocks); antiBlock.carverHelper.setChiselBlockName("Anti Block"); + antiBlock.carverHelper.forbidChiseling = true; for (int i = 0; i < 16; i++) { antiBlock.carverHelper.addVariation("tile.antiBlock." + ItemDye.field_150921_b[i] + ".desc", i, "antiblock/" + ItemDye.field_150921_b[i] + "-antiBlock"); From a38b7c4f23486a96c4e122e1a89e921609e06c4a Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Tue, 20 Jan 2015 20:39:14 -0500 Subject: [PATCH 31/75] Fix antiblock recipes, and all dye-using recipes now support oredict --- .../com/cricketcraft/chisel/Features.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index 3807628e..bd95546d 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -137,13 +137,17 @@ public enum Features { antiBlock.carverHelper.addVariation("tile.antiBlock." + ItemDye.field_150921_b[i] + ".desc", i, "antiblock/" + ItemDye.field_150921_b[i] + "-antiBlock"); } - antiBlock.carverHelper.registerAll(antiBlock, "antiBlock"); - Carving.chisel.registerOre("antiBlock", "antiBlock"); + antiBlock.carverHelper.registerBlock(antiBlock, "antiBlock"); + OreDictionary.registerOre("antiBlock", antiBlock); } @Override void addRecipes() { - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.antiBlock, 8, 0), "SSS", "SGS", "SSS", 'S', "stone", 'G', "dustGlowstone")); + if (meta == 0) { + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.antiBlock, 8, 15), "SSS", "SGS", "SSS", 'S', "stone", 'G', "dustGlowstone")); + } + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.antiBlock, 8, meta), "BBB", "BdB", "BBB", + 'd', dyeOres[meta], 'B', new ItemStack(ChiselBlocks.antiBlock, 1, OreDictionary.WILDCARD_VALUE))); } @Override @@ -707,7 +711,7 @@ public enum Features { } @Override - void addRecipes(){ + void addRecipes() { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.futura, 8, 0), "SSS", "SGS", "SSS", 'S', "stone", 'G', "dustRedstone")); } }, @@ -1697,7 +1701,7 @@ public enum Features { @Override void addRecipes() { - GameRegistry.addShapelessRecipe(new ItemStack(ChiselBlocks.present[meta]), new ItemStack(Blocks.chest, 1), new ItemStack(Items.dye, 1, meta)); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ChiselBlocks.present[meta]), new ItemStack(Blocks.chest, 1), dyeOres[meta])); } @Override @@ -2141,7 +2145,7 @@ public enum Features { @Override void addRecipes() { - GameRegistry.addRecipe(new ItemStack(ChiselBlocks.templeblock, 8, 0), "***", "*X*", "***", '*', new ItemStack(Blocks.stone, 1), 'X', new ItemStack(Items.dye, 1, 4)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.templeblock, 8, 0), "***", "*X*", "***", '*', new ItemStack(Blocks.stone, 1), 'X', dyeOres[4])); } }, @@ -2470,6 +2474,9 @@ public enum Features { ; + private static final String[] dyeOres = { "dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple", "dyeCyan", "dyeLightGray", "dyeGray", "dyePink", "dyeLime", "dyeYellow", + "dyeLightBlue", "dyeMagenta", "dyeOrange", "dyeWhite" }; + private static int meta = 0; static void init() { From f71fddf01e7f7d99c86945c8ca710cab67cd2313 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Wed, 21 Jan 2015 01:44:20 -0500 Subject: [PATCH 32/75] Left click chiseling will now go through oredict group members as well --- .../chisel/carving/CarvingGroup.java | 3 +-- .../chisel/item/chisel/ChiselController.java | 17 ++++++++++++++--- .../com/cricketcraft/chisel/utils/General.java | 4 +++- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/carving/CarvingGroup.java b/src/main/java/com/cricketcraft/chisel/carving/CarvingGroup.java index 08e64389..e29af8b1 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/CarvingGroup.java +++ b/src/main/java/com/cricketcraft/chisel/carving/CarvingGroup.java @@ -7,7 +7,6 @@ import java.util.List; import com.cricketcraft.chisel.api.carving.CarvingUtils; import com.cricketcraft.chisel.api.carving.ICarvingGroup; import com.cricketcraft.chisel.api.carving.ICarvingVariation; -import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; public class CarvingGroup implements ICarvingGroup { @@ -23,7 +22,7 @@ public class CarvingGroup implements ICarvingGroup { } public List getVariations() { - return ImmutableList.copyOf(variations); + return Lists.newArrayList(variations); } @Override diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java index 4df6578c..d66368c0 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java @@ -7,9 +7,11 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.oredict.OreDictionary; import com.cricketcraft.chisel.Chisel; import com.cricketcraft.chisel.api.IChiselItem; +import com.cricketcraft.chisel.api.carving.ICarvingGroup; import com.cricketcraft.chisel.api.carving.ICarvingVariation; import com.cricketcraft.chisel.carving.Carving; import com.cricketcraft.chisel.carving.CarvingVariation; @@ -48,10 +50,18 @@ public final class ChiselController { z = event.z; Block block = event.world.getBlock(x, y, z); int metadata = event.world.getBlockMetadata(x, y, z); - List list = Carving.chisel.getVariations(block, metadata); + ICarvingGroup group = Carving.chisel.getGroup(block, metadata); - if (list == null || list.isEmpty()) { - break; + List list = group.getVariations(); + + main: for (ItemStack stack : OreDictionary.getOres(group.getOreName())) { + ICarvingVariation v = General.getVariation(stack); + for (ICarvingVariation check : list) { + if (check.getBlock() == v.getBlock() && check.getBlockMeta() == v.getBlockMeta()) { + continue main; + } + } + list.add(General.getVariation(stack)); } ICarvingVariation[] variations = list.toArray(new CarvingVariation[] {}); @@ -73,6 +83,7 @@ public final class ChiselController { ICarvingVariation v = variations[i]; if (v.getBlock() == block && v.getBlockMeta() == metadata) { idx = (i + 1) % variations.length; // move to the next in the group + break; } } diff --git a/src/main/java/com/cricketcraft/chisel/utils/General.java b/src/main/java/com/cricketcraft/chisel/utils/General.java index 99ab77ac..5bff0697 100644 --- a/src/main/java/com/cricketcraft/chisel/utils/General.java +++ b/src/main/java/com/cricketcraft/chisel/utils/General.java @@ -17,6 +17,7 @@ import net.minecraft.world.World; import com.cricketcraft.chisel.api.carving.ICarvingVariation; import com.cricketcraft.chisel.carving.Carving; +import com.cricketcraft.chisel.carving.CarvingVariation; import com.cricketcraft.chisel.item.chisel.ChiselMode; public class General { @@ -137,6 +138,7 @@ public class General { } public static ICarvingVariation getVariation(ItemStack stack) { - return Carving.chisel.getVariation(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage()); + ICarvingVariation v = Carving.chisel.getVariation(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage()); + return v == null ? new CarvingVariation(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 99) : v; } } From 8ca74532d3e45dcdc1cfe5e159ee0a1771486072 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Wed, 21 Jan 2015 02:30:00 -0500 Subject: [PATCH 33/75] Update changelog --- changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog b/changelog index 18ebfaa9..c42b7c41 100644 --- a/changelog +++ b/changelog @@ -1,5 +1,8 @@ 2.3.2: Fixed antiblocks being chiselable between colors +Added recipes to dye existing antiblocks +Made all recipes that use dyes support oredict dyes +Fixed left click chiseling not going through oredict members of the group 2.3.1: Fixed recipe crash on startup From 4ef5c9c4bc79f238ce9746aad9d6028fe75ab19a Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Wed, 21 Jan 2015 08:44:32 -0500 Subject: [PATCH 34/75] Fix bad curseforge project ID --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 4e12ebd2..2c0402f5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,4 +8,4 @@ ccc_version=1.0.4.29 nei_version=1.0.3.74 fmp_version=1.1.1.320 -projectId='225236' \ No newline at end of file +projectId=225236 \ No newline at end of file From e7cb95466783dc9ca194e069d7b5b79eb3c479c0 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Wed, 21 Jan 2015 09:58:24 -0500 Subject: [PATCH 35/75] Fix extra newlines in changelog --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index 77aeaa43..67122356 100644 --- a/build.gradle +++ b/build.gradle @@ -120,6 +120,7 @@ String getChangelogText() { } if (it.size() > 1) { str += "$it" + (lineCount == 0 ? '\n\n' : '\n') + lineCount++ return } else { done = true From 3ac7bd79e7ff825db615f8b4207531e864964de0 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Wed, 21 Jan 2015 10:33:36 -0500 Subject: [PATCH 36/75] Add display name for curseforge uploads --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index 67122356..1764c3c5 100644 --- a/build.gradle +++ b/build.gradle @@ -140,5 +140,6 @@ curse { projectId = project.projectId changelog = System.getenv("CHANGELOG").equals("none") ? getChangelogText() : System.getenv("CHANGELOG") releaseType = 'release' + displayName = "Chisel 2 - ${mod_version}" additionalArtifact deobfJar, sourcesJar, apiJar } From aeebccf83ee87846168383e56f4e1d04415e4062 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Wed, 21 Jan 2015 11:40:00 -0500 Subject: [PATCH 37/75] Fix crash when left clicking blocks that are not in a carving group --- changelog | 3 +++ gradle.properties | 2 +- .../com/cricketcraft/chisel/item/chisel/ChiselController.java | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/changelog b/changelog index c42b7c41..cbd87f3e 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,6 @@ +2.3.3: +Fix crash when left clicking certain blocks with the chisel + 2.3.2: Fixed antiblocks being chiselable between colors Added recipes to dye existing antiblocks diff --git a/gradle.properties b/gradle.properties index 2c0402f5..24f276b8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -mod_version=2.3.2 +mod_version=2.3.3 minecraft_version=1.7.10 forge_version=10.13.2.1277 diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java index d66368c0..15b9a24c 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java @@ -52,6 +52,10 @@ public final class ChiselController { int metadata = event.world.getBlockMetadata(x, y, z); ICarvingGroup group = Carving.chisel.getGroup(block, metadata); + if (group == null) { + return; + } + List list = group.getVariations(); main: for (ItemStack stack : OreDictionary.getOres(group.getOreName())) { From 14288766e4855b0c7cb06344f6761fdc34da26df Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Wed, 21 Jan 2015 11:43:35 -0500 Subject: [PATCH 38/75] Fix build crash --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 1764c3c5..b51b1cb6 100644 --- a/build.gradle +++ b/build.gradle @@ -140,6 +140,6 @@ curse { projectId = project.projectId changelog = System.getenv("CHANGELOG").equals("none") ? getChangelogText() : System.getenv("CHANGELOG") releaseType = 'release' - displayName = "Chisel 2 - ${mod_version}" + //displayName = "Chisel 2 - ${mod_version}" additionalArtifact deobfJar, sourcesJar, apiJar } From bef19466cf8dd9352fcbbebc6a95204606b54dc7 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Wed, 21 Jan 2015 14:02:47 -0500 Subject: [PATCH 39/75] Add ability for chisels to define their own chisel modes --- .../chisel/api/carving/IAdvancedChisel.java | 33 +++++++++++++++++++ .../chisel/api/carving/IChiselMode.java | 18 ++++++++++ .../chisel/client/gui/GuiChisel.java | 16 ++++++--- .../chisel/item/chisel/ChiselController.java | 3 +- .../chisel/item/chisel/ChiselMode.java | 14 ++++---- .../network/message/MessageChiselMode.java | 13 +++++--- .../cricketcraft/chisel/utils/General.java | 11 +++++-- 7 files changed, 91 insertions(+), 17 deletions(-) create mode 100644 src/main/java/com/cricketcraft/chisel/api/carving/IAdvancedChisel.java create mode 100644 src/main/java/com/cricketcraft/chisel/api/carving/IChiselMode.java diff --git a/src/main/java/com/cricketcraft/chisel/api/carving/IAdvancedChisel.java b/src/main/java/com/cricketcraft/chisel/api/carving/IAdvancedChisel.java new file mode 100644 index 00000000..1079807c --- /dev/null +++ b/src/main/java/com/cricketcraft/chisel/api/carving/IAdvancedChisel.java @@ -0,0 +1,33 @@ +package com.cricketcraft.chisel.api.carving; + +import net.minecraft.item.ItemStack; + +/** + * Implement this on chisel items which require more control over chisel modes + * (including adding new modes). + */ +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 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); +} diff --git a/src/main/java/com/cricketcraft/chisel/api/carving/IChiselMode.java b/src/main/java/com/cricketcraft/chisel/api/carving/IChiselMode.java new file mode 100644 index 00000000..2db9afad --- /dev/null +++ b/src/main/java/com/cricketcraft/chisel/api/carving/IChiselMode.java @@ -0,0 +1,18 @@ +package com.cricketcraft.chisel.api.carving; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public interface IChiselMode { + + 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(); +} diff --git a/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java b/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java index a1c54edd..febbfddf 100644 --- a/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java +++ b/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java @@ -10,6 +10,8 @@ import net.minecraft.inventory.Slot; import org.lwjgl.opengl.GL11; import com.cricketcraft.chisel.api.IChiselItem; +import com.cricketcraft.chisel.api.carving.IAdvancedChisel; +import com.cricketcraft.chisel.api.carving.IChiselMode; import com.cricketcraft.chisel.inventory.ContainerChisel; import com.cricketcraft.chisel.inventory.InventoryChiselSelection; import com.cricketcraft.chisel.inventory.SlotChiselInput; @@ -23,7 +25,7 @@ public class GuiChisel extends GuiContainer { public EntityPlayer player; public ContainerChisel container; - private ChiselMode currentMode; + private IChiselMode currentMode; public GuiChisel(InventoryPlayer iinventory, InventoryChiselSelection menu) { super(new ContainerChisel(iinventory, menu)); @@ -103,9 +105,15 @@ public class GuiChisel extends GuiContainer { @Override protected void actionPerformed(GuiButton button) { if (button.id == 0) { - PacketHandler.INSTANCE.sendToServer(new MessageChiselMode(currentMode)); - currentMode = currentMode.next(); - setButtonText(); + if (container.chisel != null && container.chisel.getItem() instanceof IAdvancedChisel) { + IAdvancedChisel item = (IAdvancedChisel) container.chisel.getItem(); + currentMode = item.getNextMode(container.chisel, currentMode); + PacketHandler.INSTANCE.sendToServer(new MessageChiselMode(currentMode)); + } else { + currentMode = ChiselMode.next(currentMode); + PacketHandler.INSTANCE.sendToServer(new MessageChiselMode(currentMode)); + setButtonText(); + } } super.actionPerformed(button); } diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java index 15b9a24c..f5f96690 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java @@ -13,6 +13,7 @@ import com.cricketcraft.chisel.Chisel; import com.cricketcraft.chisel.api.IChiselItem; import com.cricketcraft.chisel.api.carving.ICarvingGroup; import com.cricketcraft.chisel.api.carving.ICarvingVariation; +import com.cricketcraft.chisel.api.carving.IChiselMode; import com.cricketcraft.chisel.carving.Carving; import com.cricketcraft.chisel.carving.CarvingVariation; import com.cricketcraft.chisel.utils.General; @@ -72,7 +73,7 @@ public final class ChiselController { if (chisel.canChiselBlock(event.world, x, y, z, block, metadata)) { ItemStack target = General.getChiselTarget(held); - ChiselMode mode = General.getChiselMode(held); + IChiselMode mode = General.getChiselMode(held); ForgeDirection sideHit = ForgeDirection.VALID_DIRECTIONS[event.face]; if (target != null) { diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselMode.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselMode.java index b58129b2..0d2446c5 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselMode.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselMode.java @@ -10,10 +10,11 @@ import net.minecraftforge.common.util.ForgeDirection; import com.cricketcraft.chisel.api.IChiselItem; import com.cricketcraft.chisel.api.carving.ICarvingVariation; +import com.cricketcraft.chisel.api.carving.IChiselMode; import com.cricketcraft.chisel.network.PacketHandler; import com.cricketcraft.chisel.network.message.MessageChiselSound; -public enum ChiselMode { +public enum ChiselMode implements IChiselMode { SINGLE { @@ -86,8 +87,6 @@ public enum ChiselMode { } }; - public abstract void chiselAll(EntityPlayer player, World world, int x, int y, int z, ForgeDirection side, ICarvingVariation variation); - /** * Assumes that the player is holding a chisel */ @@ -116,8 +115,11 @@ public enum ChiselMode { } } - public ChiselMode next() { - ChiselMode[] values = values(); - return values[(ordinal() + 1) % values.length]; + public static ChiselMode next(IChiselMode currentMode) { + if (currentMode instanceof ChiselMode) { + ChiselMode[] values = values(); + return values[(((ChiselMode) currentMode).ordinal() + 1) % values.length]; + } + return SINGLE; } } diff --git a/src/main/java/com/cricketcraft/chisel/network/message/MessageChiselMode.java b/src/main/java/com/cricketcraft/chisel/network/message/MessageChiselMode.java index db2ab62f..926c8a37 100644 --- a/src/main/java/com/cricketcraft/chisel/network/message/MessageChiselMode.java +++ b/src/main/java/com/cricketcraft/chisel/network/message/MessageChiselMode.java @@ -4,6 +4,8 @@ import io.netty.buffer.ByteBuf; import net.minecraft.item.ItemStack; import com.cricketcraft.chisel.api.IChiselItem; +import com.cricketcraft.chisel.api.carving.IAdvancedChisel; +import com.cricketcraft.chisel.api.carving.IChiselMode; import com.cricketcraft.chisel.item.chisel.ChiselMode; import com.cricketcraft.chisel.utils.General; @@ -12,7 +14,6 @@ import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; - public class MessageChiselMode implements IMessage { public MessageChiselMode(){ @@ -20,8 +21,8 @@ public class MessageChiselMode implements IMessage { private String mode; - public MessageChiselMode(ChiselMode current) { - this.mode = current.next().name(); + public MessageChiselMode(IChiselMode iChiselMode) { + this.mode = iChiselMode.name(); } public void toBytes(ByteBuf buf) { @@ -38,7 +39,11 @@ public class MessageChiselMode implements IMessage { public IMessage onMessage(MessageChiselMode message, MessageContext ctx) { ItemStack stack = ctx.getServerHandler().playerEntity.getCurrentEquippedItem(); if (stack != null && stack.getItem() instanceof IChiselItem) { - General.setChiselMode(stack, ChiselMode.valueOf(message.mode)); + if (stack.getItem() instanceof IAdvancedChisel) { + General.setChiselMode(stack, ((IAdvancedChisel) stack.getItem()).getMode(stack, message.mode)); + } else { + General.setChiselMode(stack, ChiselMode.valueOf(message.mode)); + } } return null; } diff --git a/src/main/java/com/cricketcraft/chisel/utils/General.java b/src/main/java/com/cricketcraft/chisel/utils/General.java index 5bff0697..fe37df73 100644 --- a/src/main/java/com/cricketcraft/chisel/utils/General.java +++ b/src/main/java/com/cricketcraft/chisel/utils/General.java @@ -15,7 +15,9 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; +import com.cricketcraft.chisel.api.carving.IAdvancedChisel; import com.cricketcraft.chisel.api.carving.ICarvingVariation; +import com.cricketcraft.chisel.api.carving.IChiselMode; import com.cricketcraft.chisel.carving.Carving; import com.cricketcraft.chisel.carving.CarvingVariation; import com.cricketcraft.chisel.item.chisel.ChiselMode; @@ -123,16 +125,21 @@ public class General { } private static final String MODE_KEY = "chiselMode"; - public static ChiselMode getChiselMode(ItemStack chisel) { + public static IChiselMode getChiselMode(ItemStack chisel) { if (chisel.stackTagCompound == null || Strings.isNullOrEmpty(chisel.stackTagCompound.getString(MODE_KEY))) { initTag(chisel); chisel.stackTagCompound.setString(MODE_KEY, ChiselMode.SINGLE.name()); } + + String name = chisel.stackTagCompound.getString(MODE_KEY); + if (chisel.getItem() instanceof IAdvancedChisel) { + return ((IAdvancedChisel)chisel.getItem()).getMode(chisel, name); + } return Enum.valueOf(ChiselMode.class, chisel.stackTagCompound.getString(MODE_KEY)); } - public static void setChiselMode(ItemStack chisel, ChiselMode mode) { + public static void setChiselMode(ItemStack chisel, IChiselMode mode) { initTag(chisel); chisel.stackTagCompound.setString(MODE_KEY, mode.name()); } From 9b064c59ef7cefddc93be4ed3f5b9bc06449be6a Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Wed, 21 Jan 2015 15:15:23 -0500 Subject: [PATCH 40/75] Move IAdvancedChisel to base api package --- .../chisel/api/{carving => }/IAdvancedChisel.java | 4 +++- .../java/com/cricketcraft/chisel/client/gui/GuiChisel.java | 2 +- .../chisel/network/message/MessageChiselMode.java | 2 +- src/main/java/com/cricketcraft/chisel/utils/General.java | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) rename src/main/java/com/cricketcraft/chisel/api/{carving => }/IAdvancedChisel.java (90%) diff --git a/src/main/java/com/cricketcraft/chisel/api/carving/IAdvancedChisel.java b/src/main/java/com/cricketcraft/chisel/api/IAdvancedChisel.java similarity index 90% rename from src/main/java/com/cricketcraft/chisel/api/carving/IAdvancedChisel.java rename to src/main/java/com/cricketcraft/chisel/api/IAdvancedChisel.java index 1079807c..6a01ed97 100644 --- a/src/main/java/com/cricketcraft/chisel/api/carving/IAdvancedChisel.java +++ b/src/main/java/com/cricketcraft/chisel/api/IAdvancedChisel.java @@ -1,4 +1,6 @@ -package com.cricketcraft.chisel.api.carving; +package com.cricketcraft.chisel.api; + +import com.cricketcraft.chisel.api.carving.IChiselMode; import net.minecraft.item.ItemStack; diff --git a/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java b/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java index febbfddf..58c8074d 100644 --- a/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java +++ b/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java @@ -9,8 +9,8 @@ import net.minecraft.inventory.Slot; import org.lwjgl.opengl.GL11; +import com.cricketcraft.chisel.api.IAdvancedChisel; import com.cricketcraft.chisel.api.IChiselItem; -import com.cricketcraft.chisel.api.carving.IAdvancedChisel; import com.cricketcraft.chisel.api.carving.IChiselMode; import com.cricketcraft.chisel.inventory.ContainerChisel; import com.cricketcraft.chisel.inventory.InventoryChiselSelection; diff --git a/src/main/java/com/cricketcraft/chisel/network/message/MessageChiselMode.java b/src/main/java/com/cricketcraft/chisel/network/message/MessageChiselMode.java index 926c8a37..855c41a7 100644 --- a/src/main/java/com/cricketcraft/chisel/network/message/MessageChiselMode.java +++ b/src/main/java/com/cricketcraft/chisel/network/message/MessageChiselMode.java @@ -3,8 +3,8 @@ package com.cricketcraft.chisel.network.message; import io.netty.buffer.ByteBuf; import net.minecraft.item.ItemStack; +import com.cricketcraft.chisel.api.IAdvancedChisel; import com.cricketcraft.chisel.api.IChiselItem; -import com.cricketcraft.chisel.api.carving.IAdvancedChisel; import com.cricketcraft.chisel.api.carving.IChiselMode; import com.cricketcraft.chisel.item.chisel.ChiselMode; import com.cricketcraft.chisel.utils.General; diff --git a/src/main/java/com/cricketcraft/chisel/utils/General.java b/src/main/java/com/cricketcraft/chisel/utils/General.java index fe37df73..b2a5eab8 100644 --- a/src/main/java/com/cricketcraft/chisel/utils/General.java +++ b/src/main/java/com/cricketcraft/chisel/utils/General.java @@ -15,7 +15,7 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import com.cricketcraft.chisel.api.carving.IAdvancedChisel; +import com.cricketcraft.chisel.api.IAdvancedChisel; import com.cricketcraft.chisel.api.carving.ICarvingVariation; import com.cricketcraft.chisel.api.carving.IChiselMode; import com.cricketcraft.chisel.carving.Carving; From edf632763c656c569dac54bc5243a433ed92f374 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Wed, 21 Jan 2015 16:44:14 -0500 Subject: [PATCH 41/75] displayName should work now Thanks @AbrarSyed :D --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index b51b1cb6..1764c3c5 100644 --- a/build.gradle +++ b/build.gradle @@ -140,6 +140,6 @@ curse { projectId = project.projectId changelog = System.getenv("CHANGELOG").equals("none") ? getChangelogText() : System.getenv("CHANGELOG") releaseType = 'release' - //displayName = "Chisel 2 - ${mod_version}" + displayName = "Chisel 2 - ${mod_version}" additionalArtifact deobfJar, sourcesJar, apiJar } From bfabad129f479209fe5f00e6579162ca2527d062 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Thu, 22 Jan 2015 21:33:43 -0500 Subject: [PATCH 42/75] Add variation removal support to API, add ICarvingRegistry --- .../chisel/api/ChiselAPIProps.java | 2 +- .../chisel/api/carving/CarvingUtils.java | 28 +++++++++++++++++++ .../chisel/api/carving/ICarvingGroup.java | 13 +++++++++ .../tileentity/TileEntityAutoChisel.java | 6 ++-- .../cricketcraft/chisel/carving/Carving.java | 23 ++++++++++++--- .../chisel/carving/CarvingGroup.java | 13 +++++++++ .../chisel/carving/GroupList.java | 2 ++ .../chisel/inventory/ContainerChisel.java | 3 +- .../inventory/InventoryChiselSelection.java | 4 +-- .../chisel/item/chisel/ItemChisel.java | 3 +- 10 files changed, 85 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/api/ChiselAPIProps.java b/src/main/java/com/cricketcraft/chisel/api/ChiselAPIProps.java index 065b8219..579b9a21 100644 --- a/src/main/java/com/cricketcraft/chisel/api/ChiselAPIProps.java +++ b/src/main/java/com/cricketcraft/chisel/api/ChiselAPIProps.java @@ -2,6 +2,6 @@ package com.cricketcraft.chisel.api; public class ChiselAPIProps { - public static final String VERSION = "0.0.1"; + public static final String VERSION = "0.0.2"; } diff --git a/src/main/java/com/cricketcraft/chisel/api/carving/CarvingUtils.java b/src/main/java/com/cricketcraft/chisel/api/carving/CarvingUtils.java index 317c75b8..d47676ef 100644 --- a/src/main/java/com/cricketcraft/chisel/api/carving/CarvingUtils.java +++ b/src/main/java/com/cricketcraft/chisel/api/carving/CarvingUtils.java @@ -1,5 +1,7 @@ package com.cricketcraft.chisel.api.carving; +import java.lang.reflect.Field; + import net.minecraft.item.ItemStack; public class CarvingUtils { @@ -27,4 +29,30 @@ public class CarvingUtils { public static ItemStack getStack(ICarvingVariation variation) { return new ItemStack(variation.getBlock(), 1, variation.getItemMeta()); } + + private static Field _chisel; + private static boolean errored = false; + private static final String CARVING_CLASS = "com.cricketcraft.chisel.carving.Carving"; + + /** + * @return The instance of the chisel carving registry from the chisel mod. + *

+ * If chisel is not installed or some other error occurs this will return null. + */ + public static ICarvingRegistry getChiselRegistry() { + if (errored) { + return null; + } + + try { + if (_chisel == null) { + _chisel = Class.forName(CARVING_CLASS).getDeclaredField("chisel"); + } + return (ICarvingRegistry) _chisel.get(null); + } catch (Exception e) { + e.printStackTrace(); + errored = true; + return getChiselRegistry(); + } + } } diff --git a/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingGroup.java b/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingGroup.java index 928aa869..e5d189c3 100644 --- a/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingGroup.java +++ b/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingGroup.java @@ -2,6 +2,8 @@ package com.cricketcraft.chisel.api.carving; import java.util.List; +import net.minecraft.block.Block; + /** * Represents a group of chiselable blocks. *

@@ -63,4 +65,15 @@ public interface ICarvingGroup { * An {@link ICarvingVariation} to add to this group */ void addVariation(ICarvingVariation variation); + + /** + * Removes a varaition with the passed {@link Block} and metadata from this group. + * + * @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); } diff --git a/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java b/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java index a4baac9b..64507435 100644 --- a/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java +++ b/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java @@ -1,6 +1,6 @@ package com.cricketcraft.chisel.block.tileentity; -import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; @@ -178,7 +178,7 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory // lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target private boolean canBeMadeFrom(ItemStack from, ItemStack to) { - ArrayList results = Carving.chisel.getItems(from); + List results = Carving.chisel.getItemsForChiseling(from); for (ItemStack s : results) { if (s.getItem() == to.getItem() && s.getItemDamage() == to.getItemDamage()) { return true; @@ -329,7 +329,7 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory switch (slot) { case BASE: case TARGET: - return !Carving.chisel.getItems(itemStack).isEmpty(); + return !Carving.chisel.getItemsForChiseling(itemStack).isEmpty(); case OUTPUT: return false; case CHISEL: diff --git a/src/main/java/com/cricketcraft/chisel/carving/Carving.java b/src/main/java/com/cricketcraft/chisel/carving/Carving.java index 4a4a51b6..f3f7f461 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/Carving.java +++ b/src/main/java/com/cricketcraft/chisel/carving/Carving.java @@ -12,9 +12,10 @@ import net.minecraftforge.oredict.OreDictionary; import com.cricketcraft.chisel.Chisel; import com.cricketcraft.chisel.api.carving.ICarvingGroup; +import com.cricketcraft.chisel.api.carving.ICarvingRegistry; import com.cricketcraft.chisel.api.carving.ICarvingVariation; -public class Carving { +public class Carving implements ICarvingRegistry { GroupList groups = new GroupList(); @@ -24,6 +25,7 @@ public class Carving { private Carving() { } + @Override public ICarvingVariation getVariation(Block block, int metadata) { ICarvingGroup g = getGroup(block, metadata); if (g != null) { @@ -36,7 +38,8 @@ public class Carving { return null; } - public List getVariations(Block block, int metadata) { + @Override + public List getGroupVariations(Block block, int metadata) { ICarvingGroup group = getGroup(block, metadata); if (group == null) return null; @@ -44,7 +47,8 @@ public class Carving { return group.getVariations(); } - public String getOre(Block block, int metadata) { + @Override + public String getOreName(Block block, int metadata) { ICarvingGroup group = getGroup(block, metadata); if (group == null) return null; @@ -52,7 +56,8 @@ public class Carving { return group.getOreName(); } - public ArrayList getItems(ItemStack chiseledItem) { + @Override + public List getItemsForChiseling(ItemStack chiseledItem) { ArrayList items = new ArrayList(); int damage = chiseledItem.getItemDamage(); @@ -94,6 +99,7 @@ public class Carving { return items; } + @Override public ICarvingGroup getGroup(Block block, int metadata) { int[] ids = OreDictionary.getOreIDs(new ItemStack(block, metadata)); if (ids.length > 0) { @@ -108,10 +114,12 @@ public class Carving { return groups.getGroup(block, metadata); } + @Override public ICarvingGroup getGroup(String name) { return groups.getGroupByName(name); } + @Override public void addVariation(String groupName, Block block, int metadata, int order) { if (block == null) { throw new NullPointerException("Cannot add variation in group " + groupName + " for null block."); @@ -121,6 +129,7 @@ public class Carving { addVariation(groupName, variation); } + @Override public void addVariation(String groupName, ICarvingVariation variation) { if (groupName == null) { throw new NullPointerException("Cannot add variation to null group name."); @@ -138,10 +147,12 @@ public class Carving { groups.addVariation(groupName, variation); } + @Override public void addGroup(ICarvingGroup group) { groups.add(group); } + @Override public void registerOre(String name, String oreName) { ICarvingGroup group = groups.getGroupByName(name); if (group != null) { @@ -151,6 +162,7 @@ public class Carving { } } + @Override public void setVariationSound(String name, String sound) { ICarvingGroup group = groups.getGroupByName(name); if (group != null) { @@ -160,16 +172,19 @@ public class Carving { } } + @Override public String getVariationSound(Block block, int metadata) { return getVariationSound(Item.getItemFromBlock(block), metadata); } + @Override public String getVariationSound(Item item, int metadata) { ICarvingGroup group = groups.getGroup(Block.getBlockFromItem(item), metadata); String sound = group == null ? null : group.getSound(); return sound == null ? Chisel.MOD_ID + ":chisel.fallback" : sound; } + @Override public List getSortedGroupNames() { List names = new ArrayList(); names.addAll(groups.getNames()); diff --git a/src/main/java/com/cricketcraft/chisel/carving/CarvingGroup.java b/src/main/java/com/cricketcraft/chisel/carving/CarvingGroup.java index e29af8b1..3a42618f 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/CarvingGroup.java +++ b/src/main/java/com/cricketcraft/chisel/carving/CarvingGroup.java @@ -4,6 +4,8 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; +import net.minecraft.block.Block; + import com.cricketcraft.chisel.api.carving.CarvingUtils; import com.cricketcraft.chisel.api.carving.ICarvingGroup; import com.cricketcraft.chisel.api.carving.ICarvingVariation; @@ -36,6 +38,17 @@ public class CarvingGroup implements ICarvingGroup { } }); } + + @Override + public ICarvingVariation removeVariation(Block block, int metadata) { + ICarvingVariation toRemove = null; + for (ICarvingVariation v : variations) { + if (v.getBlock() == block && v.getBlockMeta() == metadata) { + toRemove = v; + } + } + return toRemove == null ? null : variations.remove(toRemove) ? toRemove : null; + } @Override public String getName() { diff --git a/src/main/java/com/cricketcraft/chisel/carving/GroupList.java b/src/main/java/com/cricketcraft/chisel/carving/GroupList.java index a33db007..d3c99ed9 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/GroupList.java +++ b/src/main/java/com/cricketcraft/chisel/carving/GroupList.java @@ -130,6 +130,8 @@ public class GroupList implements Set { public boolean remove(Object o) { if (o instanceof ICarvingGroup) { return groups.remove(((ICarvingGroup) o).getName()) != null; + } else if (o instanceof ICarvingVariation) { + // TODO support carving variation removal } return false; } diff --git a/src/main/java/com/cricketcraft/chisel/inventory/ContainerChisel.java b/src/main/java/com/cricketcraft/chisel/inventory/ContainerChisel.java index e837fdc2..ac841217 100644 --- a/src/main/java/com/cricketcraft/chisel/inventory/ContainerChisel.java +++ b/src/main/java/com/cricketcraft/chisel/inventory/ContainerChisel.java @@ -7,6 +7,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import com.cricketcraft.chisel.api.carving.ICarvingRegistry; import com.cricketcraft.chisel.carving.Carving; import com.cricketcraft.chisel.item.chisel.ItemChisel; import com.cricketcraft.chisel.utils.General; @@ -18,7 +19,7 @@ public class ContainerChisel extends Container { int currentIndex; public ItemStack chisel; public boolean finished; - public Carving carving; + public ICarvingRegistry carving; public ContainerChisel(InventoryPlayer inventoryplayer, InventoryChiselSelection inv) { inventory = inv; diff --git a/src/main/java/com/cricketcraft/chisel/inventory/InventoryChiselSelection.java b/src/main/java/com/cricketcraft/chisel/inventory/InventoryChiselSelection.java index 4751c3e9..e69aa789 100644 --- a/src/main/java/com/cricketcraft/chisel/inventory/InventoryChiselSelection.java +++ b/src/main/java/com/cricketcraft/chisel/inventory/InventoryChiselSelection.java @@ -1,6 +1,6 @@ package com.cricketcraft.chisel.inventory; -import java.util.ArrayList; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; @@ -124,7 +124,7 @@ public class InventoryChiselSelection implements IInventory { if (!((IChiselItem) chisel.getItem()).canChisel(container.playerInventory.player.worldObj, chisel, General.getVariation(chiseledItem))) return; - ArrayList list = container.carving.getItems(chiseledItem); + List list = container.carving.getItemsForChiseling(chiseledItem); activeVariations = 0; while (activeVariations < normalSlots && activeVariations < list.size()) { diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java index 490aefc0..1727e8f5 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java @@ -15,6 +15,7 @@ import net.minecraftforge.common.MinecraftForge; import com.cricketcraft.chisel.Chisel; import com.cricketcraft.chisel.api.IChiselItem; +import com.cricketcraft.chisel.api.carving.ICarvingRegistry; import com.cricketcraft.chisel.api.carving.ICarvingVariation; import com.cricketcraft.chisel.carving.Carving; import com.cricketcraft.chisel.config.Configurations; @@ -36,7 +37,7 @@ public class ItemChisel extends Item implements IChiselItem { } } - public static Carving carving = Carving.chisel; + public static ICarvingRegistry carving = Carving.chisel; private ChiselType type; From 2321c2e6362f8228b2f5a3080adcf0fb918617f1 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Thu, 22 Jan 2015 21:47:30 -0500 Subject: [PATCH 43/75] Add ICarvingRegistry, still need to document properly --- .../chisel/api/carving/ICarvingRegistry.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/main/java/com/cricketcraft/chisel/api/carving/ICarvingRegistry.java diff --git a/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingRegistry.java b/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingRegistry.java new file mode 100644 index 00000000..cbb4366a --- /dev/null +++ b/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingRegistry.java @@ -0,0 +1,47 @@ +package com.cricketcraft.chisel.api.carving; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +/** + * Represents a registry of {@link ICarvingGroup}s + *

+ * To obtain chisel's instance of this class, use {@link CarvingUtils#getChiselRegistry()} + */ +public interface ICarvingRegistry { + + /* Getters */ + + ICarvingGroup getGroup(Block block, int meta); + + ICarvingGroup getGroup(String name); + + ICarvingVariation getVariation(Block block, int meta); + + List getGroupVariations(Block block, int meta); + + String getOreName(Block block, int meta); + + List getItemsForChiseling(ItemStack chiseled); + + public String getVariationSound(Block block, int metadata); + + public String getVariationSound(Item item, int metadata); + + List getSortedGroupNames(); + + /* Setters */ + + void addVariation(String groupName, Block block, int metadata, int order); + + void addVariation(String groupName, ICarvingVariation variation); + + void addGroup(ICarvingGroup group); + + void registerOre(String groupName, String oreName); + + void setVariationSound(String name, String sound); +} From 8467b1cbb8ea7a394bf78dfa40dda46278557718 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Fri, 23 Jan 2015 16:09:40 -0500 Subject: [PATCH 44/75] Add group removal support. Add player argument to canChiselBlock --- .../cricketcraft/chisel/api/IChiselItem.java | 6 ++++-- .../chisel/api/carving/ICarvingRegistry.java | 2 ++ .../cricketcraft/chisel/carving/Carving.java | 6 ++++++ .../cricketcraft/chisel/carving/GroupList.java | 18 +++++++++++++++--- .../chisel/item/chisel/ChiselController.java | 2 +- .../chisel/item/chisel/ItemChisel.java | 2 +- 6 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java b/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java index 9dbc433f..5949a400 100644 --- a/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java +++ b/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java @@ -58,19 +58,21 @@ public interface IChiselItem { * * @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 + * Z coord of the block being chmatiseled * @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, int x, int y, int z, Block block, int metadata); + 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. diff --git a/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingRegistry.java b/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingRegistry.java index cbb4366a..c68dd1cf 100644 --- a/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingRegistry.java +++ b/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingRegistry.java @@ -40,6 +40,8 @@ public interface ICarvingRegistry { void addVariation(String groupName, ICarvingVariation variation); void addGroup(ICarvingGroup group); + + ICarvingGroup removeGroup(String groupName); void registerOre(String groupName, String oreName); diff --git a/src/main/java/com/cricketcraft/chisel/carving/Carving.java b/src/main/java/com/cricketcraft/chisel/carving/Carving.java index f3f7f461..60c03e9a 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/Carving.java +++ b/src/main/java/com/cricketcraft/chisel/carving/Carving.java @@ -119,6 +119,12 @@ public class Carving implements ICarvingRegistry { return groups.getGroupByName(name); } + @Override + public ICarvingGroup removeGroup(String groupName) { + ICarvingGroup g = groups.getGroupByName(groupName); + return groups.remove(g) ? g : null; + } + @Override public void addVariation(String groupName, Block block, int metadata, int order) { if (block == null) { diff --git a/src/main/java/com/cricketcraft/chisel/carving/GroupList.java b/src/main/java/com/cricketcraft/chisel/carving/GroupList.java index d3c99ed9..e829999c 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/GroupList.java +++ b/src/main/java/com/cricketcraft/chisel/carving/GroupList.java @@ -3,6 +3,8 @@ package com.cricketcraft.chisel.carving; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; +import java.util.List; +import java.util.Map; import java.util.Set; import net.minecraft.block.Block; @@ -11,6 +13,8 @@ import org.apache.commons.lang3.tuple.Pair; import com.cricketcraft.chisel.api.carving.ICarvingGroup; import com.cricketcraft.chisel.api.carving.ICarvingVariation; +import com.google.common.collect.HashBiMap; +import com.google.common.collect.Lists; import com.google.common.collect.Maps; public class GroupList implements Set { @@ -75,7 +79,7 @@ public class GroupList implements Set { } private HashMap groups = Maps.newHashMap(); - private HashMap lookup = Maps.newHashMap(); + private HashBiMap lookup = HashBiMap.create(); @Override public int size() { @@ -129,9 +133,17 @@ public class GroupList implements Set { @Override public boolean remove(Object o) { if (o instanceof ICarvingGroup) { + Map reverse = lookup.inverse(); + List toRemove = Lists.newArrayList(); + for (ICarvingGroup g : reverse.keySet()) { + if (g.getName().equals(((ICarvingGroup) o).getName())) { + toRemove.add(reverse.get(g)); + } + } + for (VariationWrapper v : toRemove) { + lookup.remove(v); + } return groups.remove(((ICarvingGroup) o).getName()) != null; - } else if (o instanceof ICarvingVariation) { - // TODO support carving variation removal } return false; } diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java index f5f96690..11eba5f7 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java @@ -71,7 +71,7 @@ public final class ChiselController { ICarvingVariation[] variations = list.toArray(new CarvingVariation[] {}); - if (chisel.canChiselBlock(event.world, x, y, z, block, metadata)) { + if (chisel.canChiselBlock(event.world, event.entityPlayer, x, y, z, block, metadata)) { ItemStack target = General.getChiselTarget(held); IChiselMode mode = General.getChiselMode(held); ForgeDirection sideHit = ForgeDirection.VALID_DIRECTIONS[event.face]; diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java index 1727e8f5..4d9e68aa 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java @@ -116,7 +116,7 @@ public class ItemChisel extends Item implements IChiselItem { } @Override - public boolean canChiselBlock(World world, int x, int y, int z, Block block, int metadata) { + public boolean canChiselBlock(World world, EntityPlayer player, int x, int y, int z, Block block, int metadata) { return type == ChiselType.DIAMOND || Configurations.ironChiselCanLeftClick; } From c0f683ca3a23a74ae4eba13c7e37e3431fdee811 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Fri, 23 Jan 2015 16:23:36 -0500 Subject: [PATCH 45/75] Fix javadoc typo --- src/main/java/com/cricketcraft/chisel/api/IChiselItem.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java b/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java index 5949a400..43812d82 100644 --- a/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java +++ b/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java @@ -65,7 +65,7 @@ public interface IChiselItem { * @param y * Y coord of the block being chiseled * @param z - * Z coord of the block being chmatiseled + * Z coord of the block being chiseled * @param block * The {@link Block} being chiseled * @param metadata From 909b86894b5e94164b21e5944eb226fb5e84b2ec Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Fri, 23 Jan 2015 16:36:22 -0500 Subject: [PATCH 46/75] Switch back to a standard hashmap to prevent crashes --- .../com/cricketcraft/chisel/carving/GroupList.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/carving/GroupList.java b/src/main/java/com/cricketcraft/chisel/carving/GroupList.java index e829999c..7d0a2f0c 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/GroupList.java +++ b/src/main/java/com/cricketcraft/chisel/carving/GroupList.java @@ -4,7 +4,6 @@ import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; -import java.util.Map; import java.util.Set; import net.minecraft.block.Block; @@ -13,7 +12,6 @@ import org.apache.commons.lang3.tuple.Pair; import com.cricketcraft.chisel.api.carving.ICarvingGroup; import com.cricketcraft.chisel.api.carving.ICarvingVariation; -import com.google.common.collect.HashBiMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; @@ -79,7 +77,7 @@ public class GroupList implements Set { } private HashMap groups = Maps.newHashMap(); - private HashBiMap lookup = HashBiMap.create(); + private HashMap lookup = Maps.newHashMap(); @Override public int size() { @@ -133,11 +131,10 @@ public class GroupList implements Set { @Override public boolean remove(Object o) { if (o instanceof ICarvingGroup) { - Map reverse = lookup.inverse(); List toRemove = Lists.newArrayList(); - for (ICarvingGroup g : reverse.keySet()) { - if (g.getName().equals(((ICarvingGroup) o).getName())) { - toRemove.add(reverse.get(g)); + for (VariationWrapper v : lookup.keySet()) { + if (lookup.get(v).getName().equals(((ICarvingGroup) o).getName())) { + toRemove.add(v); } } for (VariationWrapper v : toRemove) { From a5b19d564a2e8607eb0bd4c952881c29ceb81f7c Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Fri, 23 Jan 2015 18:19:11 -0500 Subject: [PATCH 47/75] Fix breaking animation on advanced CTM renderers --- .../chisel/client/render/BlockAdvancedMarbleRenderer.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/cricketcraft/chisel/client/render/BlockAdvancedMarbleRenderer.java b/src/main/java/com/cricketcraft/chisel/client/render/BlockAdvancedMarbleRenderer.java index 227221b2..4eb8bbc8 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/BlockAdvancedMarbleRenderer.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/BlockAdvancedMarbleRenderer.java @@ -38,6 +38,12 @@ public class BlockAdvancedMarbleRenderer implements ISimpleBlockRenderingHandler int meta = world.getBlockMetadata(x, y, z); CarvableVariation var = ((ICarvable) block).getVariation(world, x, y, z, meta); + + if (rendererOld.hasOverrideBlockTexture()) { + // breaking anim + rendererOld.renderStandardBlock(block, x, y, z); + return true; + } switch (var == null ? 0 : var.kind) { case CarvableHelper.CTMX: From 89b384bdf6b9655a2a2dac7078931fdb1fcbeb15 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Fri, 23 Jan 2015 18:46:31 -0500 Subject: [PATCH 48/75] Add breaking animation support to auto chisel renderer --- .../chisel/client/render/tile/RenderAutoChisel.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/client/render/tile/RenderAutoChisel.java b/src/main/java/com/cricketcraft/chisel/client/render/tile/RenderAutoChisel.java index d1f55795..8c4317c1 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/tile/RenderAutoChisel.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/tile/RenderAutoChisel.java @@ -83,7 +83,7 @@ public class RenderAutoChisel extends TileEntitySpecialRenderer implements ISimp @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { Tessellator tes = Tessellator.instance; - IIcon icon = block.getIcon(0, 0); + IIcon icon = renderer.hasOverrideBlockTexture() ? renderer.overrideBlockTexture : block.getIcon(0, 0); tes.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z)); tes.setColorOpaque_F(1, 1, 1); tes.addTranslation(x, y, z + 1); @@ -92,9 +92,13 @@ public class RenderAutoChisel extends TileEntitySpecialRenderer implements ISimp Vertex n = f.faceNormal; tes.setNormal(n.x, n.y, n.z); for (int i = 0; i < f.vertices.length; i++) { - Vertex v = f.vertices[i]; + Vertex vert = f.vertices[i]; TextureCoordinate t = f.textureCoordinates[i]; - tes.addVertexWithUV(v.x, v.y, v.z, icon.getInterpolatedU(t.u * 16), icon.getInterpolatedV(t.v * 16)); + if (!renderer.hasOverrideBlockTexture()) { + tes.addVertexWithUV(vert.x, vert.y, vert.z, icon.getInterpolatedU(t.u * 16), icon.getInterpolatedV(t.v * 16)); + } else { + tes.addVertexWithUV(vert.x, vert.y, vert.z, icon.getInterpolatedU((t.u * 64) % 16), icon.getInterpolatedV((t.v * 64) % 16)); + } } } } From 8bf33959e28bf2963d689cf7ff25c339a7775989 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Fri, 23 Jan 2015 22:35:21 -0500 Subject: [PATCH 49/75] Change up how removing groups is done, should fix most issues --- .../chisel/api/carving/ICarvingGroup.java | 15 ++++------- .../chisel/api/carving/ICarvingRegistry.java | 26 ++++++++++++++++++- .../cricketcraft/chisel/carving/Carving.java | 10 +++++++ .../chisel/carving/CarvingGroup.java | 8 +++--- .../chisel/carving/GroupList.java | 24 +++++++++++++++++ .../render/BlockMarblePaneRenderer.java | 6 ++++- 6 files changed, 72 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingGroup.java b/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingGroup.java index e5d189c3..ffe97843 100644 --- a/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingGroup.java +++ b/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingGroup.java @@ -2,8 +2,6 @@ package com.cricketcraft.chisel.api.carving; import java.util.List; -import net.minecraft.block.Block; - /** * Represents a group of chiselable blocks. *

@@ -59,7 +57,7 @@ public interface ICarvingGroup { List getVariations(); /** - * Adds a variation to this group. + * 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 @@ -67,13 +65,10 @@ public interface ICarvingGroup { void addVariation(ICarvingVariation variation); /** - * Removes a varaition with the passed {@link Block} and metadata from this group. + * 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 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. + * @param variation + * An {@link ICarvingVariation} to add to this group */ - ICarvingVariation removeVariation(Block block, int metadata); + boolean removeVariation(ICarvingVariation variation); } diff --git a/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingRegistry.java b/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingRegistry.java index c68dd1cf..49a1fc3e 100644 --- a/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingRegistry.java +++ b/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingRegistry.java @@ -40,9 +40,33 @@ public interface ICarvingRegistry { void addVariation(String groupName, ICarvingVariation variation); void addGroup(ICarvingGroup group); - + 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, 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); + void registerOre(String groupName, String oreName); void setVariationSound(String name, String sound); diff --git a/src/main/java/com/cricketcraft/chisel/carving/Carving.java b/src/main/java/com/cricketcraft/chisel/carving/Carving.java index 60c03e9a..acea6c4c 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/Carving.java +++ b/src/main/java/com/cricketcraft/chisel/carving/Carving.java @@ -124,6 +124,16 @@ public class Carving implements ICarvingRegistry { ICarvingGroup g = groups.getGroupByName(groupName); return groups.remove(g) ? g : null; } + + @Override + public ICarvingVariation removeVariation(Block block, int metadata) { + return removeVariation(block, metadata, null); + } + + @Override + public ICarvingVariation removeVariation(Block block, int metadata, String group) { + return groups.removeVariation(block, metadata, group); + } @Override public void addVariation(String groupName, Block block, int metadata, int order) { diff --git a/src/main/java/com/cricketcraft/chisel/carving/CarvingGroup.java b/src/main/java/com/cricketcraft/chisel/carving/CarvingGroup.java index 3a42618f..6a1286d5 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/CarvingGroup.java +++ b/src/main/java/com/cricketcraft/chisel/carving/CarvingGroup.java @@ -4,8 +4,6 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; -import net.minecraft.block.Block; - import com.cricketcraft.chisel.api.carving.CarvingUtils; import com.cricketcraft.chisel.api.carving.ICarvingGroup; import com.cricketcraft.chisel.api.carving.ICarvingVariation; @@ -40,14 +38,14 @@ public class CarvingGroup implements ICarvingGroup { } @Override - public ICarvingVariation removeVariation(Block block, int metadata) { + public boolean removeVariation(ICarvingVariation variation) { ICarvingVariation toRemove = null; for (ICarvingVariation v : variations) { - if (v.getBlock() == block && v.getBlockMeta() == metadata) { + if (v.getBlock() == variation.getBlock() && v.getBlockMeta() == variation.getBlockMeta()) { toRemove = v; } } - return toRemove == null ? null : variations.remove(toRemove) ? toRemove : null; + return toRemove == null ? false : variations.remove(toRemove); } @Override diff --git a/src/main/java/com/cricketcraft/chisel/carving/GroupList.java b/src/main/java/com/cricketcraft/chisel/carving/GroupList.java index 7d0a2f0c..a2bb7159 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/GroupList.java +++ b/src/main/java/com/cricketcraft/chisel/carving/GroupList.java @@ -216,6 +216,30 @@ public class GroupList implements Set { return groups.keySet(); } + public ICarvingVariation removeVariation(Block block, int metadata, String group) { + ICarvingGroup g = null; + if (group != null) { + g = groups.get(group); + if (g == null) { + throw new IllegalArgumentException("No such group " + group); + } + groups.remove(g.getName()); + } + List toRemove = Lists.newArrayList(); + for (VariationWrapper v : lookup.keySet()) { + if ((g == null || lookup.get(v) == g) && v.v.getBlock() == block && v.v.getBlockMeta() == metadata) { + if (g != null) { + g.removeVariation(v.v); + } + toRemove.add(v); + } + } + for (VariationWrapper v : toRemove) { + lookup.remove(v); + } + return toRemove.isEmpty() ? null : toRemove.get(0).v; + } + @Override public String toString() { return groups.toString(); diff --git a/src/main/java/com/cricketcraft/chisel/client/render/BlockMarblePaneRenderer.java b/src/main/java/com/cricketcraft/chisel/client/render/BlockMarblePaneRenderer.java index f813eded..767482a7 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/BlockMarblePaneRenderer.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/BlockMarblePaneRenderer.java @@ -229,7 +229,11 @@ public class BlockMarblePaneRenderer implements ISimpleBlockRenderingHandler { if (iconPane == null || iconTop == null || iconSide == null) return false; - paneRenderer.set(x, y, z, iconPane, iconTop, iconSide); + if (renderer.hasOverrideBlockTexture()) { + paneRenderer.set(x, y, z, renderer.overrideBlockTexture, renderer.overrideBlockTexture, renderer.overrideBlockTexture); + } else { + paneRenderer.set(x, y, z, iconPane, iconTop, iconSide); + } boolean connectsNorth = block.canPaneConnectToBlock(world.getBlock(x, y, z - 1)); boolean connectsSouth = block.canPaneConnectToBlock(world.getBlock(x, y, z + 1)); From cb6e8ae6a8d29dc073ca0e24f2457129921cbd0b Mon Sep 17 00:00:00 2001 From: CptSpaceToaster Date: Fri, 23 Jan 2015 22:43:02 -0500 Subject: [PATCH 50/75] I think this is what we needed... no idea --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index 1764c3c5..7b4c06ca 100644 --- a/build.gradle +++ b/build.gradle @@ -34,6 +34,7 @@ project.buildnumber = !dev && System.getenv('BUILD_NUMBER') != null ? System.get version = "${mod_version}.${buildnumber}" group = "com.cricketcraft.chisel" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = dev ? "Chisel2_DEV" : "Chisel2" +mavendir = dev ? file:///var/www/chisel-2-dev/ : file:///var/www/chisel-2/ minecraft { version = "${minecraft_version}-${forge_version}" From 04024a354c881654034df1618a66d7c3c93ce536 Mon Sep 17 00:00:00 2001 From: CptSpaceToaster Date: Fri, 23 Jan 2015 22:49:35 -0500 Subject: [PATCH 51/75] You didn't see anything --- build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/build.gradle b/build.gradle index 7b4c06ca..1764c3c5 100644 --- a/build.gradle +++ b/build.gradle @@ -34,7 +34,6 @@ project.buildnumber = !dev && System.getenv('BUILD_NUMBER') != null ? System.get version = "${mod_version}.${buildnumber}" group = "com.cricketcraft.chisel" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = dev ? "Chisel2_DEV" : "Chisel2" -mavendir = dev ? file:///var/www/chisel-2-dev/ : file:///var/www/chisel-2/ minecraft { version = "${minecraft_version}-${forge_version}" From 76c0afc815c7901a0749ffe0c49fe7cf1c3c9cdd Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sat, 24 Jan 2015 00:56:52 -0500 Subject: [PATCH 52/75] Fix up issues with removing variations --- build.gradle | 22 ++++++++++++++++++- .../chisel/carving/GroupList.java | 6 ++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 1764c3c5..060b85ab 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ buildscript { } apply plugin: 'forge' -apply plugin: 'maven' +apply plugin: 'maven-publish' apply plugin: 'curseforge' import org.ajoberstar.grgit.Grgit @@ -109,6 +109,26 @@ artifacts { archives apiJar } +publishing { + tasks.publish.dependsOn 'build' + publications { + mavenJava(MavenPublication) { + from components.java + + artifact sourcesJar + artifact apiJar + artifact deobfJar + } + } + + repositories { + String prop = dev ? "chisel_mavendir" : "chisel_mavendir_dev" + if (project.hasProperty(prop)) { + maven { url project.getProperty(prop) } + } + } +} + String getChangelogText() { def changelogFile = new File('changelog') String str = '' diff --git a/src/main/java/com/cricketcraft/chisel/carving/GroupList.java b/src/main/java/com/cricketcraft/chisel/carving/GroupList.java index a2bb7159..f4f9560d 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/GroupList.java +++ b/src/main/java/com/cricketcraft/chisel/carving/GroupList.java @@ -227,10 +227,8 @@ public class GroupList implements Set { } List toRemove = Lists.newArrayList(); for (VariationWrapper v : lookup.keySet()) { - if ((g == null || lookup.get(v) == g) && v.v.getBlock() == block && v.v.getBlockMeta() == metadata) { - if (g != null) { - g.removeVariation(v.v); - } + if ((g == null || lookup.get(v).getName().equals(g.getName())) && v.equals(new VariationWrapper(new VariationKey(block, metadata)))) { + lookup.get(v).removeVariation(v.v); toRemove.add(v); } } From 8f435bb3ee686d1bc4fe52cf13ad37798d26c23f Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sat, 24 Jan 2015 14:09:00 -0500 Subject: [PATCH 53/75] Fix crash on left click chisel when custom variations have been added --- .../com/cricketcraft/chisel/item/chisel/ChiselController.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java index 11eba5f7..7b116582 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselController.java @@ -15,7 +15,6 @@ import com.cricketcraft.chisel.api.carving.ICarvingGroup; import com.cricketcraft.chisel.api.carving.ICarvingVariation; import com.cricketcraft.chisel.api.carving.IChiselMode; import com.cricketcraft.chisel.carving.Carving; -import com.cricketcraft.chisel.carving.CarvingVariation; import com.cricketcraft.chisel.utils.General; import cpw.mods.fml.common.eventhandler.SubscribeEvent; @@ -69,7 +68,7 @@ public final class ChiselController { list.add(General.getVariation(stack)); } - ICarvingVariation[] variations = list.toArray(new CarvingVariation[] {}); + ICarvingVariation[] variations = list.toArray(new ICarvingVariation[] {}); if (chisel.canChiselBlock(event.world, event.entityPlayer, x, y, z, block, metadata)) { ItemStack target = General.getChiselTarget(held); From e4b1a79017430cad57f0f5227ff5a8a8186dfb3e Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sat, 24 Jan 2015 16:10:49 -0500 Subject: [PATCH 54/75] Add javadocs to ICarvingRegistry --- gradle.properties | 2 +- .../chisel/api/carving/ICarvingRegistry.java | 131 ++++++++++++++++++ 2 files changed, 132 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 24f276b8..6ea66fda 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,4 +8,4 @@ ccc_version=1.0.4.29 nei_version=1.0.3.74 fmp_version=1.1.1.320 -projectId=225236 \ No newline at end of file +projectId=225236 diff --git a/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingRegistry.java b/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingRegistry.java index 49a1fc3e..1987f378 100644 --- a/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingRegistry.java +++ b/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingRegistry.java @@ -5,6 +5,7 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.world.World; /** * Represents a registry of {@link ICarvingGroup}s @@ -15,32 +16,141 @@ public interface ICarvingRegistry { /* 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); + /** + * 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 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 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 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 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 item/meta pair. + *

+ * 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 getSortedGroupNames(); /* 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 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); + /** + * Removes a group from the registry. + *

+ * 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); /** @@ -67,7 +177,28 @@ public interface ICarvingRegistry { */ ICarvingVariation removeVariation(Block block, int metadata, String group); + /** + * Registers a group to an oredict name. + *

+ * 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. + *

+ * This is the sound that is used when a block from this group is chiseled.
+ * Does not 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); } From eb83ecf7ecfd3b1e5ad35823f59b9c92ce20dde8 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sat, 24 Jan 2015 16:25:24 -0500 Subject: [PATCH 55/75] Fix #175 problem with vertical CTM on x-axis bottom end textures --- .../client/render/RenderBlocksColumn.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksColumn.java b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksColumn.java index e901e88a..ff0c8c6a 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksColumn.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/RenderBlocksColumn.java @@ -56,14 +56,18 @@ public class RenderBlocksColumn extends RenderBlocks { sides[4] = iconTop; sides[5] = iconTop; - if (xp && xn) - sides[0] = submap.icons[2]; - else if (xp) - sides[0] = submap.icons[3]; - else + // for some reason along the x axis the bottom texture on the ends is backwards. This flips it around. + if (xp && xn) { + sides[1] = submap.icons[2]; + sides[0] = sides[1]; + } else if (xp) { + sides[1] = submap.icons[3]; sides[0] = submap.icons[1]; - - sides[1] = sides[2] = sides[3] = sides[0]; + } else { + sides[1] = submap.icons[1]; + sides[0] = submap.icons[3]; + } + sides[2] = sides[3] = sides[1]; } else { boolean zp = connected(blockAccess, x, y, z + 1, block, metadata); boolean zn = connected(blockAccess, x, y, z - 1, block, metadata); From fa2dee3d77ee9a2e37347311b8ca31b273b892ca Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sat, 24 Jan 2015 22:03:30 -0500 Subject: [PATCH 56/75] Fix all worldgen issues. Use 1.8 textures. Implement 1.8 block pillars. Closes #168 Closes #159 Closes #130 --- .../java/com/cricketcraft/chisel/Chisel.java | 21 ++++--- .../com/cricketcraft/chisel/Features.java | 9 ++- .../chisel/world/GeneratorChisel.java | 54 ++++++++++++++---- .../resources/assets/chisel/lang/en_US.lang | 3 + ...PillarSide.png => andesitePillar-side.png} | Bin ...tePillarTop.png => andesitePillar-top.png} | Bin .../blocks/andesite/andesitePolished.png | Bin 0 -> 850 bytes .../blocks/andesite/polishedAndesite.png | Bin 747 -> 0 bytes .../textures/blocks/diorite/diorite.png | Bin 721 -> 984 bytes ...ePillarSide.png => dioritePillar-side.png} | Bin ...itePillarTop.png => dioritePillar-top.png} | Bin .../blocks/diorite/dioritePolished.png | Bin 0 -> 887 bytes .../blocks/diorite/polishedDiorite.png | Bin 610 -> 0 bytes .../textures/blocks/granite/granite.png | Bin 607 -> 979 bytes ...ePillarSide.png => granitePillar-side.png} | Bin ...itePillarTop.png => granitePillar-top.png} | Bin .../blocks/granite/granitePolished.png | Bin 0 -> 804 bytes .../blocks/granite/polishedGranite.png | Bin 508 -> 0 bytes 18 files changed, 65 insertions(+), 22 deletions(-) rename src/main/resources/assets/chisel/textures/blocks/andesite/{andesitePillarSide.png => andesitePillar-side.png} (100%) rename src/main/resources/assets/chisel/textures/blocks/andesite/{andesitePillarTop.png => andesitePillar-top.png} (100%) create mode 100644 src/main/resources/assets/chisel/textures/blocks/andesite/andesitePolished.png delete mode 100644 src/main/resources/assets/chisel/textures/blocks/andesite/polishedAndesite.png rename src/main/resources/assets/chisel/textures/blocks/diorite/{dioritePillarSide.png => dioritePillar-side.png} (100%) rename src/main/resources/assets/chisel/textures/blocks/diorite/{dioritePillarTop.png => dioritePillar-top.png} (100%) create mode 100644 src/main/resources/assets/chisel/textures/blocks/diorite/dioritePolished.png delete mode 100644 src/main/resources/assets/chisel/textures/blocks/diorite/polishedDiorite.png rename src/main/resources/assets/chisel/textures/blocks/granite/{granitePillarSide.png => granitePillar-side.png} (100%) rename src/main/resources/assets/chisel/textures/blocks/granite/{granitePillarTop.png => granitePillar-top.png} (100%) create mode 100644 src/main/resources/assets/chisel/textures/blocks/granite/granitePolished.png delete mode 100644 src/main/resources/assets/chisel/textures/blocks/granite/polishedGranite.png diff --git a/src/main/java/com/cricketcraft/chisel/Chisel.java b/src/main/java/com/cricketcraft/chisel/Chisel.java index 10e5cfb9..0aad18e9 100644 --- a/src/main/java/com/cricketcraft/chisel/Chisel.java +++ b/src/main/java/com/cricketcraft/chisel/Chisel.java @@ -126,11 +126,12 @@ public class Chisel { NetworkRegistry.INSTANCE.registerGuiHandler(this, new ChiselGuiHandler()); - registerWorldgen(Features.MARBLE, ChiselBlocks.marble, Configurations.marbleAmount); - registerWorldgen(Features.LIMESTONE, ChiselBlocks.limestone, Configurations.limestoneAmount); - registerWorldgen(Features.ANDESITE, ChiselBlocks.andesite, Configurations.andesiteAmount); - registerWorldgen(Features.GRANITE, ChiselBlocks.granite, Configurations.graniteAmount); - registerWorldgen(Features.DIORITE, ChiselBlocks.diorite, Configurations.dioriteAmount); + addWorldgen(Features.MARBLE, ChiselBlocks.marble, Configurations.marbleAmount); + addWorldgen(Features.LIMESTONE, ChiselBlocks.limestone, Configurations.limestoneAmount); + addWorldgen(Features.ANDESITE, ChiselBlocks.andesite, Configurations.andesiteAmount, 40, 100, 0.5); + addWorldgen(Features.GRANITE, ChiselBlocks.granite, Configurations.graniteAmount, 40, 100, 0.5); + addWorldgen(Features.DIORITE, ChiselBlocks.diorite, Configurations.dioriteAmount, 40, 100, 0.5); + GameRegistry.registerWorldGenerator(GeneratorChisel.INSTANCE, 1000); proxy.init(); MinecraftForge.EVENT_BUS.register(this); @@ -139,9 +140,15 @@ public class Chisel { FMLInterModComms.sendMessage("Waila", "register", "com.cricketcraft.chisel.compat.WailaCompat.register"); } - private void registerWorldgen(Features feature, Block block, int amount) { + private void addWorldgen(Features feature, Block block, double... data) { if (feature.enabled()) { - GameRegistry.registerWorldGenerator(new GeneratorChisel(block, 32, amount), 1000); + if (data.length == 1) { + GeneratorChisel.INSTANCE.addFeature(block, 32, (int) data[0]); + } else if (data.length > 1 && data.length < 4) { + GeneratorChisel.INSTANCE.addFeature(block, 32, (int) data[0], (int) data[1], (int) data[2]); + } else if (data.length == 4) { + GeneratorChisel.INSTANCE.addFeature(block, 32, (int) data[0], (int) data[1], (int) data[2], data[3]); + } } } diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index bd95546d..92356f19 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -119,7 +119,8 @@ public enum Features { BlockCarvable andesite = (BlockCarvable) new BlockCarvable(Material.rock).setHardness(2.0F).setResistance(10.0F).setCreativeTab(ChiselTabs.tabStoneChiselBlocks); andesite.carverHelper.setChiselBlockName("andesite"); andesite.carverHelper.addVariation("tile.andesite.0.desc", 0, "andesite/andesite"); - andesite.carverHelper.addVariation("tile.andesite.1.desc", 1, "andesite/polishedAndesite"); + andesite.carverHelper.addVariation("tile.andesite.1.desc", 1, "andesite/andesitePolished"); + andesite.carverHelper.addVariation("tile.andesite.2.desc", 2, "andesite/andesitePillar"); andesite.carverHelper.registerAll(andesite, "andesite"); Carving.chisel.registerOre("andesite", "andesite"); } @@ -549,7 +550,8 @@ public enum Features { BlockCarvable diorite = (BlockCarvable) new BlockCarvable(Material.rock).setHardness(2.0F).setResistance(10.0F).setCreativeTab(ChiselTabs.tabStoneChiselBlocks); diorite.carverHelper.setChiselBlockName("diorite"); diorite.carverHelper.addVariation("tile.diorite.0.desc", 0, "diorite/diorite"); - diorite.carverHelper.addVariation("tile.diorite.1.desc", 1, "diorite/polishedDiorite"); + diorite.carverHelper.addVariation("tile.diorite.1.desc", 1, "diorite/dioritePolished"); + diorite.carverHelper.addVariation("tile.diorite.2.desc", 2, "diorite/dioritePillar"); diorite.carverHelper.registerAll(diorite, "diorite"); Carving.chisel.registerOre("diorite", "diorite"); } @@ -885,7 +887,8 @@ public enum Features { BlockCarvable granite = (BlockCarvable) new BlockCarvable(Material.rock).setHardness(2.0F).setResistance(10.0F).setCreativeTab(ChiselTabs.tabStoneChiselBlocks); granite.carverHelper.setChiselBlockName("granite"); granite.carverHelper.addVariation("tile.granite.0.desc", 0, "granite/granite"); - granite.carverHelper.addVariation("tile.granite.1.desc", 1, "granite/polishedGranite"); + granite.carverHelper.addVariation("tile.granite.1.desc", 1, "granite/granitePolished"); + granite.carverHelper.addVariation("tile.granite.1.desc", 2, "granite/granitePillar"); granite.carverHelper.registerAll(granite, "granite"); Carving.chisel.registerOre("granite", "granite"); } diff --git a/src/main/java/com/cricketcraft/chisel/world/GeneratorChisel.java b/src/main/java/com/cricketcraft/chisel/world/GeneratorChisel.java index c03eb7d8..75e9b5e2 100644 --- a/src/main/java/com/cricketcraft/chisel/world/GeneratorChisel.java +++ b/src/main/java/com/cricketcraft/chisel/world/GeneratorChisel.java @@ -1,34 +1,64 @@ package com.cricketcraft.chisel.world; +import java.util.Map; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; + +import com.google.common.collect.Maps; + import cpw.mods.fml.common.IWorldGenerator; public class GeneratorChisel implements IWorldGenerator { - WorldGenMinable gen; - int amount; + private class WorldGenInfo { - public GeneratorChisel(Block block, int count, int am) { - gen = new WorldGenMinable(block, count); - amount = am; + private int amount; + private int minY, maxY; + private double chance; + + private WorldGenInfo(int amount, int minY, int maxY, double chance) { + this.amount = amount; + this.minY = minY; + this.maxY = maxY; + this.chance = chance; + } } - protected void genStandardOre(World world, Random random, int x, int z, int bot, int top) { - for (int l = 0; l < amount; ++l) { - int i1 = x + random.nextInt(16); - int j1 = bot + random.nextInt(top - bot); - int k1 = z + random.nextInt(16); - gen.generate(world, random, i1, j1, k1); + public static final GeneratorChisel INSTANCE = new GeneratorChisel(); + + private final Map map = Maps.newHashMap(); + + public void addFeature(Block block, int count, int amount) { + addFeature(block, count, amount, 40, 128); + } + + public void addFeature(Block block, int count, int amount, int minY, int maxY) { + addFeature(block, count, amount, minY, maxY, 1); + } + + public void addFeature(Block block, int count, int amount, int minY, int maxY, double chance) { + map.put(new WorldGenMinable(block, count), new WorldGenInfo(amount, minY, maxY, chance)); + } + + protected void genStandardOre(WorldGenMinable gen, WorldGenInfo info, World world, Random random, int x, int z) { + for (int l = 0; l < info.amount; ++l) { + if (random.nextDouble() < info.chance) { + int avgX = x + random.nextInt(16); + int avgY = info.minY + random.nextInt(info.maxY - info.minY) + 1; + int avgZ = z + random.nextInt(16); + gen.generate(world, random, avgX, avgY, avgZ); + } } } @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { - genStandardOre(world, random, chunkX * 16, chunkZ * 16, 40, 128); + for (WorldGenMinable gen : map.keySet()) { + genStandardOre(gen, map.get(gen), world, random, chunkX * 16, chunkZ * 16); + } } } diff --git a/src/main/resources/assets/chisel/lang/en_US.lang b/src/main/resources/assets/chisel/lang/en_US.lang index cf7e3b8c..a0ea9dee 100644 --- a/src/main/resources/assets/chisel/lang/en_US.lang +++ b/src/main/resources/assets/chisel/lang/en_US.lang @@ -52,16 +52,19 @@ tile.antiBlock.gray.desc=Gray Anti Block tile.diorite.name=Diorite tile.diorite.0.desc=Generates in your world tile.diorite.1.desc=Polished Diorite +tile.diorite.2.desc=Diorite Pillar #Andesite tile.andesite.name=Andesite tile.andesite.0.desc=Generates in your world tile.andesite.1.desc=Polished Andesite +tile.andesite.2.desc=Andesite Pillar #Granite tile.granite.name=Granite tile.granite.0.desc=Generates in your world tile.granite.1.desc=Polished Granite +tile.granite.2.desc=Granite Pillar #Auto Chisel tile.autoChisel.name=Auto Chisel diff --git a/src/main/resources/assets/chisel/textures/blocks/andesite/andesitePillarSide.png b/src/main/resources/assets/chisel/textures/blocks/andesite/andesitePillar-side.png similarity index 100% rename from src/main/resources/assets/chisel/textures/blocks/andesite/andesitePillarSide.png rename to src/main/resources/assets/chisel/textures/blocks/andesite/andesitePillar-side.png diff --git a/src/main/resources/assets/chisel/textures/blocks/andesite/andesitePillarTop.png b/src/main/resources/assets/chisel/textures/blocks/andesite/andesitePillar-top.png similarity index 100% rename from src/main/resources/assets/chisel/textures/blocks/andesite/andesitePillarTop.png rename to src/main/resources/assets/chisel/textures/blocks/andesite/andesitePillar-top.png diff --git a/src/main/resources/assets/chisel/textures/blocks/andesite/andesitePolished.png b/src/main/resources/assets/chisel/textures/blocks/andesite/andesitePolished.png new file mode 100644 index 0000000000000000000000000000000000000000..a77809c04b651d9f92c7ee1347cdd71823c5453c GIT binary patch literal 850 zcmV-Y1FigtP)Px#24YJ`L;wH)0002_L%V+f000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i*)C z4FU`k#3eKU0013nR9JLFZ*6U5Zgc_CX>@2HM@dakWG-a~00081 zNklf;WlDS z#(tku*C5kWW3mK9$uzD=k~>zbdyFxJ0759nVF487?!e)2U>sAHMIvQ}-tSAsX+}!W zNy;z|9Dg-bWd#UAh$x+4?Tx0LS!PR&f+UfYWsbgFt~5=@hlhKV>WBdzK4d7p5JR9S zN~USYFtk`3P|72O!#T<2az!U;%6?x#1lY3K7}~Z+IE!}*>sp+xQCj2Nf^%T4qb%2~ zRt7Bv6x*E5T5~$rH0_KKn&!H&+hxQkSg&`i*9lifjG3920Q5}LgbvZswFCVv5`w~e zfmtQw`GycAN(lO4V4Nhx$n6Hk?8vee)ATP=NvNtFZ9C$8k6^~xj$&I-RU4Y7;nwxU z0Oxa!lnK)msOu|PmY}mt5@SnMc|zE7yA9-N&d~Qb@5u8UYb`N49zWi*zuVFemaeq` z=&rLIk2Rk^e`1;xN=0IDRQnR=Jl=bx6kM-2#%bpDwMI(8;ZX4WV$o^3X0zGz{Bowq zJz53Oir;T%v{VS8kTTNu17)>kWipzkPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E;VI^GGzb&0$fQ%K~y+T9gIjzpZbY$(&@8Js;2e9&5RJEX&3H{rz^k*=))` ze_waIm-TwJTrT(f?cLqodi}KDm&@hj^ULP?y0F%p1s6g}!MSEkNMW>&36-3i>2!wZ z`|9VfX;EZK4IJl#wO*I=`83O}xiDvEgKqbS5IRlsaXMj41p%rkN{!MZ{I%`6_3-fE z`-0M*4n3`XW2oyg&Xts*kQy=ILBH>XAx02Y!fLfp(om)dQKM0o=My0eswx!^hfK;i z&wuB6K}h6zs@ZH=@9(dk7Z4I~fnxgnVt~0B(?Uc(!7v1bo=04lG8UYlf2%s2oLmAx zX;(@&3`soVQN(7mY&^b22LMnUW*+L=wrxQyN)@Uq9f1{;Tm+N~sW@YJ2-o!o1OMXU zJ7ny1+7{$buJWRoav>Q2x$bsd4nQg5czkm+L6amA=#SfRstzkkLli~?mQ*83A*BHW zWfJ*8px}=&ahgtQwVJitt+H&^?fS0g`5s}6Bv%t?b$L02C!ntgD;W$SkhNjGy_IQd zq#WXFzfU-i@dBrD)O7&^M@&)7FgC!dgtC0<^#))_(_5uNDKs_$9meA<%W@b3aS%Z~ zpJ%PF)ks^$BG(IyA(8Q-i29UcZuEi8y&hO2B%{3Rl3MMv_58emJHAhn1goY_Py0|1 z#91~;l4=ZCj{Q?=q;=*vM^+S#j*r`||Ci%54iD{S^QhH2f=AG#)2X-H2aU$ZR_l{( dAJo6p{{ah_kqLrZ@_+yU002ovPDHLkV1hQFP0#=U diff --git a/src/main/resources/assets/chisel/textures/blocks/diorite/diorite.png b/src/main/resources/assets/chisel/textures/blocks/diorite/diorite.png index c833ac926b78daad6d349143389c9321721da833..711c838b30d14baa52a99f9089ffd45d56fcf7fc 100644 GIT binary patch literal 984 zcmV;}11J26P)Px#24YJ`L;wH)0002_L%V+f000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i*)3 z2^S`X%k7{500US_L_t(I%T1A6Pnrh+h9Bf4^P|<)0V+CB2f7w*Y@5a{wv`)CUDHF- z_ybH9(_i47*GvDv(zV&TG@3Or?!qV%s?}@_>J&t@s2@5r4j-0^B8bRg7pBRcAMhsc z^T=Mj_@&s~+=RhkARa#e;Mubu85$bGWcrG+u|H6$l!QVdEEWq!V=bTY`FzN)UbPLI zOlESq0t*XnLZJ`?0|U6-i)b_&pvaXg&8XFC#>dCW<#O!q?l3()MNdyJvc<)fqR;08 zpt-pTfM_%dz{yD(t@Z+bzaO1W4?t9zOCr=)sNF)wPr_&UR1?J}FsjR$=)oR7%a-mYGNG6Z4+dI)} zzhGiw3Yn~g!NDI;C{%20Y$2PNa1@Ssvf@FdQd3)7gT-Ru=qO1hb4nudiEucI!!gP8 z=Rc83Wtg0tLf+o~-LTPEO(gO!F4qj*-CbBL7GA#mnOv@bMx)`)o8MVm^YQfQAbov( zjE#*`C=@UnYtJu8lEl4xJ>>I6lF1{|=`?3&c>tD||E9IIg_@dbVzD>?9?uF54GoB* zh+L=B4eRv=W@l%S%S$LJQBWupSzYxa2m&oFHoRUh+uK1TNy6!L(As*9ii!#ZK|s;b z(ZS(ik{dT}Qd#*W@8AE0-QI~(sl@O16AbQPw|5eWM5wB&;^ZWaBuQMqevN1}c0Q0! zpYZC{uQW9^5sgOBY6T=oqPMq)OP4Ma2m}yCk@fX;N=r+z*=&rAj3NjZ&MTx+$D~q8 zOeQnCyL(8I#I0L5+1%X1Y&N0QYB@emk004R= z004l4008;_004mL004C`008P>0026e000+nl3&F}00009a7bBm000XT000XT0n*)m z`~Uy|7<5HgbW?9;ba!ELWdLwtX>N2bZe?^JG%heMHD!e|WdHyIGf6~2R7gwhmETJn zK@foVzZ9RP=$mPvFN!Y`L{YRwBMttDq(McLNE2hCAWG4kCUTdkG$zIdB4|%fRIcy+ zjw!x|dFb20u*~j!vpX|8cWaiGR!&Z=+uL@zY$MCdDaWb3yu6~M(`yqGQ<=X<2S?}URRoh*RlJGC#^4|< zt5PWJH5&hdA{@$%kS{espjp)N!6m=@prlgiLSY{rGyb0EQFItaawl*tZwLXiEKN^; zK0PgSZwNH`;y}YtQ0V)6mwmOo+1V*ZB2kX2*Bjg0S=xZSxIKJqyT(R9fI7)D298ylO$!y}kE_Uh^FMc(CXj0N5)|e5*y78=s^!D? zperA~2jP2wLM&2NHkF`MeE1%8<-_-&EB~M0gR=b>6c(^md3)WA00000NkvXXu0mjf DVE8@( diff --git a/src/main/resources/assets/chisel/textures/blocks/diorite/dioritePillarSide.png b/src/main/resources/assets/chisel/textures/blocks/diorite/dioritePillar-side.png similarity index 100% rename from src/main/resources/assets/chisel/textures/blocks/diorite/dioritePillarSide.png rename to src/main/resources/assets/chisel/textures/blocks/diorite/dioritePillar-side.png diff --git a/src/main/resources/assets/chisel/textures/blocks/diorite/dioritePillarTop.png b/src/main/resources/assets/chisel/textures/blocks/diorite/dioritePillar-top.png similarity index 100% rename from src/main/resources/assets/chisel/textures/blocks/diorite/dioritePillarTop.png rename to src/main/resources/assets/chisel/textures/blocks/diorite/dioritePillar-top.png diff --git a/src/main/resources/assets/chisel/textures/blocks/diorite/dioritePolished.png b/src/main/resources/assets/chisel/textures/blocks/diorite/dioritePolished.png new file mode 100644 index 0000000000000000000000000000000000000000..8b4f8e35525f0d9a4f77a52e1be9b958a3d4ee71 GIT binary patch literal 887 zcmV--1Bm>IP)Px#24YJ`L;wH)0002_L%V+f000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i*)3 z2sIq#w-^Ng00Q?(L_t(I%TlIP z-c-Bfe^K=htP)aH^@36jIic=U(vEDU=}OU-FYGu832{Dmfts!72b}kL&pFo&<8XZa zdIDLN>2xju*xlV_Yio05~}*B1r+-?F#^AXXiOR zJwp_|lu9L1sRcfLIwhCO5e`RKUS7g9O-7?J*UIJU`0VU&0P^`G;J+(3ZY=Zh<6jI0 z0}_cO0Div@MG5lm-R~S8zQW_WF8TZsnifUZ)98A7f*1-Z%+1ZCsw(aF1=*}Yx7(vq zIp^}Si)~v7$H&JM3diVrn&EJW;ho?`U5e|p3ZF^$cYBl-4giIzwBoYI_ zacoS}MAJ0N6#!?e+z$ ztE;3^3ph@LNMwd)vxTmw(X=S#a*al#g{N9QXJ==J#l=N7H}BxOJ#5>?X|YUp|zMUm-rI^4bcJy+%;ilT7;{*P3v)>jRD{(Oq(<;(rad@buL zn0|jqK7T~JeL*xDVSRm_a=FH6G~)5&M`+qCk`y2wkK=jp;3oiX-TIbDBt|xC;P?9w zMG=5TqlM!%CWiO!{Xi@hBbl5-lKgnO-K)y#b(>%?fF${ml;# zJhp97DwQb|3T$qE2f)F>udJ=d_$NYXU@{(wM0=3g_rTlROszJ&k) N002ovPDHLkV1j&OnPLC{ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/chisel/textures/blocks/diorite/polishedDiorite.png b/src/main/resources/assets/chisel/textures/blocks/diorite/polishedDiorite.png deleted file mode 100644 index 43f3ceb52fe554e2330e80cf7741eda40b243e9d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 610 zcmV-o0-gPdP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E;VI^GGzb&0na3dyk<)MOzE@UF9v~Gm(P%4gjnuaX%kR}pVFVHt_sbKN5X79cBUi+V4$!70* zz1PprufbplLZQfTI2w;X;G@xdqhZzSmZX4T#2rB@b(7DRIKlaO5^kFJmzPP)df-%5 zEg0NOB(8iuUDGxcbX0(Fcpn(X8K~77@%RNqQhav1Jv5Hs<)uSir_+_32ryYJmSraG z;ehz!;*!Epx7$N$E?1z3Z9n2C6pE6TnFvHV5wN247MD~f64xHj3TcTyJ+(v$4+M4< zE`%ZpG41v?AB!2$=m9~xR;xABtWYYRogHku$slr;WuKnL(a@W-)oPbYP9y5LI%Ig8 zo}T%;rA#J=Og6y=6~al;k;r5M0;c!-eVQE~pRfR%kVEYE2jJW(AWLLoi8LBcxgrQi zr*n~rbKP>MBAA_>Q+Nxc=_J#EzmGh;2Za}#6!E?`F#{35d1W~Qq^^5X%gGpI~2)W2*6LX`CKkniNGtB`uzL?KUCqx wvO6w;%QXcD5Vw1oF1o%Yd~Ho-V@=!m21uGH5BV|Xvj6}907*qoM6N<$g8VNAoB#j- diff --git a/src/main/resources/assets/chisel/textures/blocks/granite/granite.png b/src/main/resources/assets/chisel/textures/blocks/granite/granite.png index 6db8b21a269e77caf45ff2868c1a11608f5f4604..07c7af8510340de84a17817a332b182d99efae3c 100644 GIT binary patch literal 979 zcmV;^11$WBP)Px#24YJ`L;wH)0002_L%V+f000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i*)2 z3@98AXLBn600UD=L_t(I%TOe8u{Gz(0A zVi1iOjWIJC#|uFdpK2Dvi-{p>j1Zk6dvFjz$x4tcZVN13H_FP^75cMfU0rL}*6ydh zgj>4$u(;@XJr5`6%ctr+ccz^7dsvIKg|VSQ=JWTFHrFGqEK^-$N2lbG^LcK^lI*Z= z0Kgy!R1~5U7z6>gFUb0J7RdTIb@Bv@vrz!P>Au7x@&MM*^7@#QD67h}jbmMl6MVX;Mn3uLU5Kd;;T3<(ac80=F;7fhH%R#5{>&CC!#f0HT=4Mkdhe^r(71eZOop zTfkx^?e{RgRN^U~0W;Ru8X=^(`;_f(VIiDvTkMS>y(n1D+C-%I& z25QQS!pm6#8d1hwfs71++DA@sU`+~f3@G#y;jB8hZMU?Ce1*eFn z7wCBJO*+5*2~o1s;@Ci3e#lj?A5Bf|W|yc^0GLb76AlLW>~j}eEqc0djPv2)y=dVi{{^hiw$kIrZhRDn!$Gp7#ktW2D@jPH~aqhp9fg1$nhB7NR013X$N4`>tk#-wQ6E0G(~s+ z2*>yC;zHjIUf=f|g zqi@iA@n~~_=AAnj z^myrb_ZWv>+{5kR5&lL`IvgOBm`BcKFly8Q`~$*hZrAe0n5X~%002ovPDHLkV1iN| ByNdt- literal 607 zcmV-l0-*hgP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E;VI^GGzb&0nkZAK~zXf?bSa^13?gn;r%jpwt@;Gf>;?L zh?2$>A|i;Qg`^PiPjz4w8^IugglGywmm=?X z7apC66rU!ZWGVmMB3|y}ps%g*h*&f<#AHaVFXfXb7R>^MGLFVqBWsn2ld+|IZjo{j zQBhc{h&ZF?2B6`GxRg(Rj$jg+cm+9*qx}40411DgRnJPx#24YJ`L;wH)0002_L%V+f000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i*)2 z3@9)?zaPi|00N{*L_t(I%T<$6Z_`#7hMxx8J&9{4spHm7XbAyDs3MgnZiaHdU$TEU z?FVp$gp^%Os|JlI;EmQwo8r##lGxZjaVpA%TT7hF?~~4X-$&2cIDPf|ZF2se^4O11 zz6SgsCG7Q|6Mp=gYHN=NHyJlsO0bBr8wLP>9G{@9{BzuY&N%*j!SLu1t^xp}FktfW z0{~{Y1YmS>%F|YZdEJ1f!@rk4%73$v5ADmm3rO4?DmoVgz+>$CNZ;gMXp=qQj$xFX7ADXCIP72 zSMMDTXjRrI4V%bw$)#k_vB{;RcR0W#$FywBZl5==Ut?M}X_`^F$x@;)K>8CjA-Gu- z3|h~Q0MLZs`qO)45+jqC$aDGmM&V28sYk>{4lYPBkrm4A+K4iLIQ>)8>e zWfS{TG$9zDyhRg&-FCZt+3fZiPXmN*po%KWrt_HS&))#>&pjMdFDgjMizoXmmodUQ z;OulvtF{SYz@Sr9Lu?fy&C(UU{fDKDi}fuB&JIy{Cza|3O85_U;GQ6!m*Z^RjN_17BzP$~=T4rSxwPBM5 iSIkpMvnEhf6@c&bOgPZ5L(eb(0000Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E;VI^GGzb&0c}Y{K~y+TO_Iw?0#Ovk=Z|U;6omAEili47 zkzt@k#4Jh-gBYlh3Z@W|BHD-x7eTWM0vD}X7PRy4>38loa}_=g=lPw-y}@Xh{=D2| zNc(^Nhp+B6&hO6E@8Ag&|L1)}37y(@fNM~%oUhNPQ7H6IcLkY*o~v8r3|h@_c{Uh6 zUScalN}5Eh%Leewo? zoO}m2E0Z7<(9)im1ogQntyl*U+?Cg)s0MoS>`=MW3Jyxv0WXHU?V}y(**uOO2?c33 z5?{c&yYtfoDOhU0y5HNDrh^}bGAW+ho5J|vcy^?ip!5$M@2w)Uo=Id&Q($(hsSF_E y$wPSx>rh>q;SYlSxhY130}v26i$X~A6bt{5B6O{M_4va80000 Date: Sat, 24 Jan 2015 22:04:47 -0500 Subject: [PATCH 57/75] Fix typo in granite descriptions --- src/main/java/com/cricketcraft/chisel/Features.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index 92356f19..19614349 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -888,7 +888,7 @@ public enum Features { granite.carverHelper.setChiselBlockName("granite"); granite.carverHelper.addVariation("tile.granite.0.desc", 0, "granite/granite"); granite.carverHelper.addVariation("tile.granite.1.desc", 1, "granite/granitePolished"); - granite.carverHelper.addVariation("tile.granite.1.desc", 2, "granite/granitePillar"); + granite.carverHelper.addVariation("tile.granite.2.desc", 2, "granite/granitePillar"); granite.carverHelper.registerAll(granite, "granite"); Carving.chisel.registerOre("granite", "granite"); } From 7139d408075e08de5d81ce607b4815ab0a78c80e Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sat, 24 Jan 2015 22:35:03 -0500 Subject: [PATCH 58/75] Fix #176 bad aged brick texture @Drullkus please feel free to fix my bad art :D --- .../textures/blocks/brickCustom/aged-v4.png | Bin 4660 -> 7434 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/main/resources/assets/chisel/textures/blocks/brickCustom/aged-v4.png b/src/main/resources/assets/chisel/textures/blocks/brickCustom/aged-v4.png index 5f62bb5fe044bcf0b70c35501a6a47c17b47e7e9..93d3c95a386f793f2d5005f11457664837a99a46 100644 GIT binary patch literal 7434 zcmcIp2V4}#+kUrPzoQ-q2y#dV0YRyXf^}38x51-~k&P0b->YX(LAaN1*N?$j?WTff`}`tu)>N0>9m~3k;J;-j@F@O;ehd zo(VvNq1FT9WEoPV=O8^PJ2MTJ*C1UyaSGN+8tdt3f=JiHdVHtek7?7Xdtp5;IVBFY z!E;WFOOC_(Ii!C%ElY-UDg@~ZrzOg=k$wy5W=UDeiAZlkx;R-Dn*l%zae1apnt=5F zNEfC@g!>?UFaTE=-%X#`P0y4~NAm>mNllxPo*18yDY24TOB~(Z-6Vms>?B!crd?R9 zbV_V`oWv(JIW0D220-VUF$%Qs-b&CWyEwYLxY#+_qwVjKKdtO)_2&wNbyl;j&4xbXf`-DiV2FVoE$RcS>AhW@2iJBr)Yf7XFv8ZgaqDr(YvQduKa{ zC)k6=RWVRiSAfcL4r0)UK41z~UvPo zMx+JlK)R9MWH1>)eoV%bQ^}cR4!Mk6PwpTOkOkx!@-lgwEGA!(atbH`rAwJmc9a|C zLxob~s7X{hHHTVEN zJ()d=y_CI~eUN>ceVtvxmUB29eU2^1lM~8`J_i;~gZ*a@FN}dMKoaey{<;C%4@Rsv-@{aSa@=AG1z9!$2@5ztgPv+0( zujl9U&+{Mg>jeTqUxB+|lps+sPq1F_o#3M2nV?yyCA1Ox2*(Svgv*4xg{Ou0h4mtl z$U@{L8YjvWEfeh(ofSP1HK}Q<*{cPq#i`9z%Tp^*yP;OC&Qmv6_g4QzeWrS@`VZT=$Uf9o?2*M!mdy$$Bm7mEY?|FNI!jJuf|(-eSFjdbjmj^dL1a6 zY(N{>7>qK=HrQft-k`F#xc8vm(%y@EAL{+UkTkS03^$x*__g5`L%C5OqX45cqYXx9 zjVk--_VMa7xzCzDr}|VFYa0(SPBdO){Il^(iH^iuk|bF#IVY(xF*FG@$uik)Qe>j+ zYuR^9-vxaS_I+&1H+3_eWV*(*(6q+P*ldK^Y_t7l56pSyZsrN*>&!2hD=aK6qAb3! zIAT$5sb?8vIn#2#gV1srQeQzckP6B-geXM_S-$P*R>C^UtoX4zS_aeVVuKChYJqv{hj+K_21e5 zp`(`LaK{CX#~tgOY@DP{c}}+mhz9r%m^J{g;%d5=W+IzD10q^Qz{fDIw zJ3LI`6h~Xnvk9aiFd}PYVBcTu)6uLU}ahPS; z)UcmMu}6iC${Y0}+%bH1_=VBhqbH2sH@Y!mSj6&(hhwb9WQ{3|RF51Vxi?Y~K@&GktdaUi*GXT+dBv@XtB`rhR>{gHc}`k2sXX2@ zesz3B!q9}=gvvyp#EprylLIGjovfG=I%W5ij-;rhgUQ_FnB-$AS}9Xf&ZYKAot}C< z%{FaeTJcnmscWa!qz9+(${;d6&N!MWMr7(rmQ~j0SI^; zVKZaVjIx>jGryTd&yvn6oNY3D{_JO;dVjio4l!rqoWi-Lb93gF&I_2gXFh-al=;6c z=)Yjqf`-qcK0BUclrt}<1}xgJsC{wV;$N5a zUy{3|b*XgeuU|QSwf?J)Ws{Z_Eq7VIWd(ah%8ENHhpybSN^{lBRVAxOtS(q1S+jUe z!`caJFXax*-MWsyE^A%!`jGWUH<)c$v7vQi!p7Tq!}1PpGTgLilVWq+<{MkQw&ZU$ z+PY+G%eKUA_qGRYFW6zRBlm0e*VDd!u`_b#g>T%x*}KbN*OFaryHj=-?+M>?Zm;X! zz55LJE#FV>&)Q#cVEln=-}-)gG~X_N`$64z?^}*Lq-57e~%uU~$zuXGCb@}$l+t=@mxpVLC z_`AjT;_j8-Pr6_GVA=!a!+DQbj}|}Hc%1vh@X3y+)=v)>yA+>%=KJi*^U=>AmPkup z{hslAYiZ64(Tm(N>)Wi`j<*N5Kk7*C z=uqU;E3^H>w;>+Do){e93my1x+sWOlQ3)?CFd8vxfi}Jf*tiK(cTQ%|2tUqKLZ31* zZ_yY|0%+I<`Fcl;}{*k-;6xwl-i<6!5M3L*u<`P+MCIhkhx7*G(;;&*y;# zhXT*RZXmXIhK4&uz(#Fb5Jn~c1y5EtHbZ@LD>O7Kfx}^g2wiO~F8B;`0U@6a%^e+J zYHiVDz?Th;fN`(U^DBC-LLy&0Dc6g0eCq%28k~Ixl?q6pHY(?ems7-efSUE!8 z$`yd|HszCQ+|e1`U@hrfX*@k-T2d?1nGX>@6FXyBuPBq9N{wY5TEj{7jGfzk?^{XQg-TE2E$ro(#6DKq!RGTekwA%Y~4T z5XK*Rm;lww8ydQb_Uzx!v<)3OvJ2lRmovJ`pSl_&1@}+P9~;u4vMsh*-R<9)fpA{n zv1n*$Y3Z^puE%)*iyD^$&#LP{TgdHE|4;FBWdr_Ipi>0M$?!~T6fLSElypcS(2gi@ zxV=d}a;1`qf86N5;ztqs6#t}MdeI5IceBAL(R?0C{g`;JdM4*O5WVnF&;#Yay+)P8q)EW zKB=nhS}m@BT3ifesBEmYBje%k;&0u#&(x1W3wR$M_ksHtpzvl4hF`cS&2|?7O0zgY zVZruS$_U7C-?K;h5D#QgX8p# zk8~_G^>sjNyp5{vc*Y0td0t%c3f6AOgV$BBKA8J)XDU8`b<78tC&J@=p+tvSeK$U# zK;el+L!|ZxKEdD+zKajsEV>KzXk~>Z)esrs%>Z%8VH=~L3;@S^Q|ZR@vIx4o1Di zU}<5-Oc3({<-;3{-kmQLUb+Ggt6oEDX7+peKx1PgynOi*&cApKw7iGSSx}31L3QM6 zqPkj?oN8J-KwhtaK3W>U(bn!d2QVM#iSOhKVjUfLUfuX!K2cRy2O4NcMLK#AKRg`h z&hwrCA&14-UNtygR(pFJhy{G8u4@E60UHL`TLDeH%@>#tybsSt6YvxWyYY$6{;O&` z2Uq0>Y?i;|1CJj)0v?KYk(yeMgoG!E^F(((z}OPqy7LL#4oi7?IkLGbjylUQo`#YK ze>l(a;ehi3f%t%)67hlNS`Xr;XAy?mkvA1E&``$v2Ld$WoUU_QYd({K1hmAnz;=u)Ee{%3rG7Ma-s2W^uA z#XFXkUdHIxUjXy>@BxZO?5K|==pgSukpCV0UR4dL(ijG>snz*4A$IbBrjimcLPt6d zX_a9A=#E$M3A*F?17M?^iko)l1I<;X3?FEFg#W42c{bF&IUDd-VW@*S?7nyd6c277 zC*?wOMKOcNk-J-r*B<2#1ps_7QxjsUtq|mwe!TagIY34kl#q({9!Q*{s(i&__qK6 delta 4624 zcmV+r67TJbIEX>4Tx07%E3mUmQC*A|D*y?1({%`nm# zdXp|Nfb=dP9RyJrW(F9_0K*JTY>22pL=h1IMUbF?0i&TvtcYSED5zi$NDxqBFp8+C zWJcCXe0h2A<>mLsz2Dkr?{oLrd!Mx~03=TzE-wX^0w9?u;C}~tIMY{!N6@kT00ww~ z0j2;jS?Q_1LGHmoBri7?db-F7{EOZU0Z9D5W$5Wor-T1b(yUaz0078e#O7>HI!na) zB2LN_q>Ak`BBsV9iWx?UnJ-FE#BySeTjZsmeHPhK%H0=h0sk8Wyh&7ga7GLtw0fuTQ>mB{3?=`JbBsZ3rr0E=h- zEE#ca>7pWAnp#_08k!lIeo?6Zy7)IG?(HJI3i#YJh=11ihwZQYQtAL;%!+EW>knJZ zegHbQ0w8z)51Zy803=0yYrpZud1&H!i5Cb`ZH$dGGc%329F~!|pug*XI{XcN@jWB) zcE6X0?#hW}3X=qMaot!cNhv};Jw27l;?NEMJjDMv@UQb&8pw&|@HsqDM5t)WxV$(~ zyLoJ`fPb69qjP!xsfqtE>`z*pYmq4Rp8z$=2uR(a0_5jDfT9oq5_wSE_22vEgAWDb zn-``!u{igi1^xT3aEbVl&W-yV=Mor9X9@Wki)-R*3DAH5Bmou30~MeFbb%o-16IHm zI084Y0{DSo5DwM?7KjJQfDbZ3F4znTKoQsl_J4v(Py^~gBWM99KnFMtE`ZD6I=Bh$ zfCpd%jDzQ32D}0D5CmZ%GDLyoAyr5VGJwn=24oMpK|W9*6b?m0aS#s@Lb=cus0b>B zDxq4a5&9N71zmuyLIcn}XcU@)eudt{2uy;hurjO-8^a9P3HFAA;Wcm^oCfE>`S4D- z0)MW9kHPKm1^7CA2Ofc+!?OrLhzJc)LktlH;)3`g5lAe;M>ZgZNI6o6v>;tbFLDbR zL8g&+C=7~%qN5B^wkS_j2#SSDLv276qbgBHQSGQ6)GgE~Y6kTQO-3uB4bV1dFZ3#O z96A$SfG$Tjpxe-w(09<|=rSbt$WG2xg5%sNal<^ZM@a~?B*8NPm z0oD%dhh<^~*aGZ+>@n;)>>zd=`xZyUsp8CV?zjjX50{54$2H;3;s$XOxOu!3UJGx7 z_rtUC+4vHCJ-!Qn13!+RCrA@?2zG>ELIPnkp@PstxI}nJcts=<)rr=`03w&TiGNr@ zJWjkq93{RZ$&mC(E~H43khGI@gmj*CkMxR6CTo)&$q{4$c_+D%e3AT^{8oY@VI<)t z!Is!4Q6(L4DIHeoQ<_y)QT9+yRo<_BQF&U0rsAlQpi-uCR%J?+qH3?oRV`CJr}~U8 zOLw9t(JSaZ^cgiJHBU96TCG~Y+Pu1sdWd?SdaL>)4T1(kBUYnKqg!J}Q&rPfGgq@& z^S%~di=h>-wNI;8Yff87JAX`jn|6oxq>h}9mrjmOv(7_ZvaW+}nr@x$Z9R-0LoZS9 zfZk1gSl>cFUcXBJh5>9~X}~o&U@)*0z0`UsZ)x4qVMCIklVOHov*D-_&B(_n%b zg|Vh_gz;|UUgJ+D7A8q1^(GHYWlUF?=9zYx{%WRg#xkoiyKPQ3cYinEXx?f5a+$$0 z&a#8c?pjbRd@Z(FbX$D1w6f$|wpdPCX<9{FRa*@+s0@EbG2@Cg+S=KAqxEU)cQ%$b z0-F;yzt|euCfYXHPA=D3&RJf+e9TVWj%inGH)2n>kG4N#KjNU~z;vi{c;cwx$aZXS zoN&@}N^m;n^upQ1nSbxx<~-+O2v6 zoyU1kw5PY{ZqH#aWiOUjqu0y|s}<{4^mvoJgS;!fpZMte@O`>`Vc!+Ldwd_R)LO|~ z+2IHLy!`g~J@VJ_PxJpi02AOJP!;er&@?bNus4Vj6cyAI^nWJUIk+VFL5OaMFr+(F zGBh%@F?24>HLNsjWR>x%^{cLjD}-~yJ0q|Wp%D!cv#Z@!?_E6}X%SfvIkZM+P1c&L zYZcZetvwSZ8O4k`8I6t(i*Abk!1QC*F=u1EVya_iST3x6tmkY;b{Tt$W5+4wOvKv7 zmc~xT*~RUNn}3RTh%b+y=DKhzxi1qu6KWFX68#d7BrYU{CAB8wlB1JP@nm?3yq*-5 zl&qA2RD;xl)R8osw7qFFd~be3I+VU9y;DFH{Y>=MJ7e% zMIVY;#n-+v{i@=tg`KfG`%5fK4(`J2;_VvR?Xdf3sdQ;h>DV6MJ?&-mvcj_0d!zPV zEnik%vwx4UPq=TS!l$Bhzvlj3`#)61SKg^|u4=7Ts@_pOcYu9h@Sx+tmKx=nqMG-I zxQFi6depYpY1fq>#vIN#{Iou_zV~a!*NqJd4MhzfkMNF+91T3$(`eP$*re1{(hN5X zo2QON9=rLC>o=V(hAp+NwAP~I;JEPkvu~rn9e+CEeWLp$<7CTsTHjT-QQ8XIq4woA$o+&v?IGcZV;atwS+4HIAr!T}^80(Je zesFQs#oIjrJ^h!wFI~Cpe)(drQ}4Mec2`bcwYhrg8sl2Wb<6AReHMLfKUnzcQP4Kl7f3AL^`%U7zUmSnwn^`q8{*wQ4;n(6<@~@7(UiP|s z)_?Z#o8&k1bA@l^-yVI(c-Q+r?ES=i<_GMDijR69yFPh;dbp6hu<#rAg!B8%JG^X@ zjSMh<-V7TMA`gut5}^P92Zl*RK~z}7rI%ZbT~!&!f9tZZ=bX8ZEhue?ln#~BcAy1O zOw^2pp(Z3m^ig@xHxnQ9K}by>RMZe-3=h6wA_<5DiVo0$7I2^nrJXY~ zXU@KzeOo^4J)3hn(>BEQa8A})`&(DVa8X2o*(;%5%?m%qQjz!*Mx!}ZO90Ox~<(trTkQu333 zpZ<(plO1+nJV9cxoUcRLUi zov}9ket=+f^m;u`Jn?(NL4vC-zWcyYY}-b6!x*I$jx?-gIVed`l&nN4LBCIbmL&AE zlC&tWl_JhFJYBi3qa@3V3)o7M79~@@Los)d?&1PU3HnKjZ&|Fy36q}7gI~CfCtrMx zZyeso`dhE#SPI#;HRBy0DFs>zCLN8h6uUYtiXx}T1|)foZ)G=~F}WeGr9lsJ~G z!&XungO-vB*8yPCa{*A6#e+wGk21(AyFpffqKih|M@gcMBqPO~l^z2}J8h;4iCJnOH$ zgcJfxDLhLPq$$Je!Ksr?lD)IC&W=O3S9Lx#N@IBHsi%mNgroQ0PZ$J$2qCI{1S9#O zmxJWPq$;aSUW?O_niWzIr#W7&1!0!4p&w;gj?{T>3S6z3-}P~(v|(*^h2Q?_1j}*4 zv}e;#GJH#5dp>CtBOOasWo1boJARxZ%K%u7s~1~K2IOUl6apz^9lH`+$tDaNBhE9l zP(*2tt2N4UP)f7Z4~dF@g4IDzUK+~M(CbG8X^!q(_bHq-<>!wdC&@D&`|I=EckkWo z9v>fZs{xdjh#h;FRg$78kU~(_*A$f+l;*S?t18!nw~gdP zoThlTjTA89RlVWt!b?p1E^$^=y&%joCS8ZLC_j8t%R;FtKSmCJXNfcKUtnpqUmuXy z-x(8L6#}gU%WFM4AUJiBK^Sm<^Wj@YY#m!SI%3zJg)MlX zcNy((Z@~km(Th=@Nb;%_0oMBK=!x+yc|vaRz|sd7_{A?DXSI9blG;Da13<$Ao~2kz z24q=Ie~2gIv=X$5&e$fN*syPS;FXh$^n-|J&aQCRw?5yLToT8$S}oEvB}w8#u8gAUm_Li5H&v$BUfluJX|Ley}A^L{Y@~^XGZ?y;XEL5_5}Q5H)U}OcHu= z!dh+!`!PGFCUB;wn?BG{l5mThnVFsC-IZudp6ITBuQSnV(V5-OcfRsXbk*+#?OI4i z`+dPo%V%XhVtdQx=9}iwLXGgiR`&MnEO)fpLp)KfcYD?08~S35K|K1%!{%~4@Yb7e z;&~pOv9S?B+K|=ZR=kz{#yEHG9G#*0hP~$OX)fjgQ}ckZG~2V3a?pddbBzu(Jg~UV zblbgutbLHC^!ov=RttaIX8Zq}2d-qFB{A(zo8>Us(td;o&YgSzBk@2KMGV_ZB^� z7!igMnbMc#iG~N_`g)aa+ld8NKzNDXP?jYReEUBB_L~!&4-%B6x%LxR(`mPHU59QE zUy>)9oXPX57lc`ctJUaY%>$RZ7f30QQc@a2kY~6G-uqw~x4sKpiYG1};?YMQHm2q` z0euk2po<|bL7z1G(5`_^To1Ohg_WuJ4!>_ag{VTcv0000 Date: Sat, 24 Jan 2015 23:22:55 -0500 Subject: [PATCH 59/75] Fix chiseling stained glass always showing white variations. Closes #174 --- .../chisel/carving/CarvableVariation.java | 6 +++--- .../cricketcraft/chisel/carving/Carving.java | 17 ++++++++++++++--- .../assets/chisel/textures/chisel2Gui.png | Bin 266140 -> 266140 bytes 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/carving/CarvableVariation.java b/src/main/java/com/cricketcraft/chisel/carving/CarvableVariation.java index dc5c776d..65c5a06f 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/CarvableVariation.java +++ b/src/main/java/com/cricketcraft/chisel/carving/CarvableVariation.java @@ -9,7 +9,7 @@ import com.cricketcraft.chisel.client.render.TextureSubmap; public class CarvableVariation { public String blockName; - private String description; + public String descriptionUnloc; public int metadata; public int kind; @@ -30,11 +30,11 @@ public class CarvableVariation { public TextureSubmap submapSmall; public String getDescription() { - return I18n.format(description); + return I18n.format(descriptionUnloc); } public void setDescriptionUnloc(String desc) { - this.description = desc; + this.descriptionUnloc = desc; } static class CarvableVariationCTM { diff --git a/src/main/java/com/cricketcraft/chisel/carving/Carving.java b/src/main/java/com/cricketcraft/chisel/carving/Carving.java index acea6c4c..17aa371b 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/Carving.java +++ b/src/main/java/com/cricketcraft/chisel/carving/Carving.java @@ -19,7 +19,7 @@ public class Carving implements ICarvingRegistry { GroupList groups = new GroupList(); - public static final Carving chisel = new Carving(); + public static final ICarvingRegistry chisel = new Carving(); public static final Carving needle = new Carving(); private Carving() { @@ -60,9 +60,20 @@ public class Carving implements ICarvingRegistry { public List getItemsForChiseling(ItemStack chiseledItem) { ArrayList items = new ArrayList(); - int damage = chiseledItem.getItemDamage(); + ICarvingGroup group = null; + + int[] oreids = OreDictionary.getOreIDs(chiseledItem); + for (int i : oreids) { + group = groups.getGroupByOre(OreDictionary.getOreName(i)); + if (group != null) { + break; + } + } + + if (group == null) { + group = getGroup(Block.getBlockFromItem(chiseledItem.getItem()), chiseledItem.getItemDamage()); + } - ICarvingGroup group = getGroup(Block.getBlockFromItem(chiseledItem.getItem()), damage); if (group == null) return items; diff --git a/src/main/resources/assets/chisel/textures/chisel2Gui.png b/src/main/resources/assets/chisel/textures/chisel2Gui.png index ef0f58525741891d425dfaaf49870a5623ca169b..b21ae9dd6b466c20107da74619f6d94e6330b3da 100644 GIT binary patch delta 153 zcmbO;UtrFBfej~lI3!s(rIVB2w{5=2^PHKL(aOq-VfqC#W|ip=#F#lYzZAH@%=mx$ zc_U_(i5plZE7Y=VekSr+oQ2cl?#juGz2YEMiqi|&7#$`H7&c4~xWy!~9mw0u2ITr| zPPlnc7|3whtWf)kx%sJ2`%@oAAZFVB)Q5TTArbx4=hj_*pd`Zp1fH&bF6*2UngABb BIpY8T delta 149 zcmbO;UtrFBfej~lIQW=Uc`EwDR6;#GE=F{ z#0|WY6>3>FKNI;Z&hpA9%5gGduQ*7F;`9PGMu*7)h7HpLZZS!02lDo^0l7Y#6K)<9 x1~ObWE7ZPXZhq?1{?vyNh?%xO^Q*>&p2S&uOQfv2mV%Q~loCIB9{H|hWY From a4f779ef0fe1a0227b2748a4cfcc0d66a38336aa Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sat, 24 Jan 2015 23:32:51 -0500 Subject: [PATCH 60/75] Add config to prevent chiseling between vanilla leaf types. Closes #171 --- .../com/cricketcraft/chisel/Features.java | 22 ++++++++++++++++++- .../chisel/config/Configurations.java | 2 ++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index 19614349..7d67c240 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -1,5 +1,7 @@ package com.cricketcraft.chisel; +import java.util.List; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; @@ -12,6 +14,7 @@ import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; +import com.cricketcraft.chisel.api.carving.ICarvingVariation; import com.cricketcraft.chisel.block.BlockAutoChisel; import com.cricketcraft.chisel.block.BlockBeaconBase; import com.cricketcraft.chisel.block.BlockCarvable; @@ -53,6 +56,7 @@ import com.cricketcraft.chisel.block.IStairsCreator; import com.cricketcraft.chisel.carving.CarvableHelper; import com.cricketcraft.chisel.carving.CarvableVariation; import com.cricketcraft.chisel.carving.Carving; +import com.cricketcraft.chisel.carving.CarvingGroup; import com.cricketcraft.chisel.config.Configurations; import com.cricketcraft.chisel.entity.EntityBallOMoss; import com.cricketcraft.chisel.entity.EntityCloudInABottle; @@ -68,11 +72,11 @@ import com.cricketcraft.chisel.item.ItemSmashingRock; import com.cricketcraft.chisel.item.ItemUpgrade; import com.cricketcraft.chisel.item.chisel.ItemChisel; import com.cricketcraft.chisel.item.chisel.ItemChisel.ChiselType; +import com.google.common.collect.Lists; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; - import static com.cricketcraft.chisel.init.ChiselBlocks.*; import static com.cricketcraft.chisel.utils.General.*; @@ -1206,6 +1210,22 @@ public enum Features { @Override void addBlocks() { BlockLeaf leaves = (BlockLeaf) new BlockLeaf(Material.leaves).setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(0.2F).setStepSound(Block.soundTypeGrass); + Carving.chisel.addGroup(new CarvingGroup("leaves") { + + public List getVariations() { + if (Configurations.chiselBackToVanillaLeaves) { + return super.getVariations(); + } else { + List ret = Lists.newArrayList(); + for (ICarvingVariation v : super.getVariations()) { + if (v.getBlock() != Blocks.leaves && v.getBlock() != Blocks.leaves2) { + ret.add(v); + } + } + return ret; + } + } + }); Carving.chisel.addVariation("leaves", Blocks.leaves, 0, 0); Carving.chisel.addVariation("leaves", Blocks.leaves, 1, 0); Carving.chisel.addVariation("leaves", Blocks.leaves, 2, 0); diff --git a/src/main/java/com/cricketcraft/chisel/config/Configurations.java b/src/main/java/com/cricketcraft/chisel/config/Configurations.java index 644f0697..266f9917 100644 --- a/src/main/java/com/cricketcraft/chisel/config/Configurations.java +++ b/src/main/java/com/cricketcraft/chisel/config/Configurations.java @@ -22,6 +22,7 @@ public class Configurations { public static boolean chiselRecipe; public static boolean enableFMP; public static boolean chiselStoneToCobbleBricks; + public static boolean chiselBackToVanillaLeaves; public static int marbleAmount; public static int limestoneAmount; @@ -62,6 +63,7 @@ public class Configurations { chiselRecipe = config.get(category, "chiselAlternateRecipe", false, "Use alternative crafting recipe for the chisel").getBoolean(false); enableFMP = config.get(category, "enableFMP", true, "Do you want to enable FMP").getBoolean(true); chiselStoneToCobbleBricks = config.get(category, "chiselStoneToCobbleBricks", true, "Chisel stone to cobblestone and bricks by left clicking.").getBoolean(false); + chiselBackToVanillaLeaves = config.get(category, "chiselBackToVanillaLeaves", false, "If this is true, you can chisel from the chisel leaves back to vanilla ones. If it is false, you cannot.").getBoolean(false); /* worldgen */ category = "worldgen"; From 06f2aff70c1ffc5f4cd6f8ccd8a3722cd0c46df0 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sun, 25 Jan 2015 15:08:29 -0500 Subject: [PATCH 61/75] Fix typo causing some oredict blocks to not be chiseleable in world Closes #177 --- src/main/java/com/cricketcraft/chisel/api/ICarvable.java | 9 ++++++--- .../java/com/cricketcraft/chisel/carving/Carving.java | 2 +- .../cricketcraft/chisel/inventory/ContainerChisel.java | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/api/ICarvable.java b/src/main/java/com/cricketcraft/chisel/api/ICarvable.java index 151c4cf7..7b7c7ec1 100644 --- a/src/main/java/com/cricketcraft/chisel/api/ICarvable.java +++ b/src/main/java/com/cricketcraft/chisel/api/ICarvable.java @@ -1,11 +1,14 @@ package com.cricketcraft.chisel.api; -import net.minecraft.item.ItemStack; -import net.minecraft.world.IBlockAccess; - import com.cricketcraft.chisel.carving.CarvableHelper; import com.cricketcraft.chisel.carving.CarvableVariation; +import net.minecraft.item.ItemStack; +import net.minecraft.world.IBlockAccess; + +/** + * 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 { /** diff --git a/src/main/java/com/cricketcraft/chisel/carving/Carving.java b/src/main/java/com/cricketcraft/chisel/carving/Carving.java index 17aa371b..03d889cb 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/Carving.java +++ b/src/main/java/com/cricketcraft/chisel/carving/Carving.java @@ -112,7 +112,7 @@ public class Carving implements ICarvingRegistry { @Override public ICarvingGroup getGroup(Block block, int metadata) { - int[] ids = OreDictionary.getOreIDs(new ItemStack(block, metadata)); + int[] ids = OreDictionary.getOreIDs(new ItemStack(block, 1, metadata)); if (ids.length > 0) { for (int id : ids) { ICarvingGroup oreGroup = groups.getGroupByOre(OreDictionary.getOreName(id)); diff --git a/src/main/java/com/cricketcraft/chisel/inventory/ContainerChisel.java b/src/main/java/com/cricketcraft/chisel/inventory/ContainerChisel.java index ac841217..f6962945 100644 --- a/src/main/java/com/cricketcraft/chisel/inventory/ContainerChisel.java +++ b/src/main/java/com/cricketcraft/chisel/inventory/ContainerChisel.java @@ -129,7 +129,7 @@ public class ContainerChisel extends Container { public void onChiselSlotChanged() { ItemStack stack = playerInventory.mainInventory[currentIndex]; - if (!stack.isItemEqual(chisel)) + if (stack == null || !stack.isItemEqual(chisel)) finished = true; if (finished) From c4c7185452ba8fe7654b80e9df723f858942448d Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sun, 25 Jan 2015 15:18:53 -0500 Subject: [PATCH 62/75] Update version to 2.3.4 and update changelog --- build.gradle | 2 ++ changelog | 16 ++++++++++++++++ gradle.properties | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 060b85ab..99d55c77 100644 --- a/build.gradle +++ b/build.gradle @@ -129,6 +129,8 @@ publishing { } } +println('Changelog\n:' + getChangelogText()) + String getChangelogText() { def changelogFile = new File('changelog') String str = '' diff --git a/changelog b/changelog index cbd87f3e..74418497 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,19 @@ +2.3.4: +New +- Add config to prevent chiseling between vanilla leaf types +- Use vanilla 1.8 textures for the 1.8 blocks, implement 1.8 block pillars + +Fixes +- All blocks now have proper breaking animations +- #175 Fix bad texture on bottom sides of CTMV blocks +- #168 Fix only one type of block generating per world +- #176 Fix bad aged brick texture +- #174 Fix chiseling stained glass always giving white variations + +API +- Add ability for custom chisels to define their own modes +- Add support for removing variations and groups via the API + 2.3.3: Fix crash when left clicking certain blocks with the chisel diff --git a/gradle.properties b/gradle.properties index 6ea66fda..12c5f69f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -mod_version=2.3.3 +mod_version=2.3.4 minecraft_version=1.7.10 forge_version=10.13.2.1277 From f1b5779acbdcd6075745c710c5a0d6a33675ee3d Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sun, 25 Jan 2015 15:25:19 -0500 Subject: [PATCH 63/75] Improve changelog formatting and fix wrong maven dir property name --- build.gradle | 7 ++++--- changelog | 2 -- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 99d55c77..292d0967 100644 --- a/build.gradle +++ b/build.gradle @@ -122,14 +122,14 @@ publishing { } repositories { - String prop = dev ? "chisel_mavendir" : "chisel_mavendir_dev" + String prop = dev ? "chisel_mavendir" : "chisel_dev_mavendir" if (project.hasProperty(prop)) { maven { url project.getProperty(prop) } } } } -println('Changelog\n:' + getChangelogText()) +println('Changelog:\n' + getChangelogText()) String getChangelogText() { def changelogFile = new File('changelog') @@ -141,7 +141,8 @@ String getChangelogText() { return } if (it.size() > 1) { - str += "$it" + (lineCount == 0 ? '\n\n' : '\n') + def temp = "$it" + (lineCount == 0 ? '\n\n' : '\n') + str += (it.startsWith('-') ? '' : '\n') + "$temp" lineCount++ return } else { diff --git a/changelog b/changelog index 74418497..5912ada6 100644 --- a/changelog +++ b/changelog @@ -2,14 +2,12 @@ New - Add config to prevent chiseling between vanilla leaf types - Use vanilla 1.8 textures for the 1.8 blocks, implement 1.8 block pillars - Fixes - All blocks now have proper breaking animations - #175 Fix bad texture on bottom sides of CTMV blocks - #168 Fix only one type of block generating per world - #176 Fix bad aged brick texture - #174 Fix chiseling stained glass always giving white variations - API - Add ability for custom chisels to define their own modes - Add support for removing variations and groups via the API From 3bd4a62e72e8f93fd693cdd003c02986b5ec91a2 Mon Sep 17 00:00:00 2001 From: warlordjones Date: Sun, 25 Jan 2015 20:23:14 +0000 Subject: [PATCH 64/75] Implement new Yellow bricktype --- .../java/com/cricketcraft/chisel/Features.java | 5 ++--- src/main/resources/assets/chisel/lang/en_US.lang | 1 + .../textures/blocks/brickCustom/yellow.png | Bin 0 -> 3346 bytes 3 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 src/main/resources/assets/chisel/textures/blocks/brickCustom/yellow.png diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index 7d67c240..4384e0f3 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -291,8 +291,7 @@ public enum Features { // brickCustom.carverHelper.addVariation("tile.brickCustom.4.desc", // 4, "brickCustom/cracked"); brickCustom.carverHelper.addVariation("tile.brickCustom.5.desc", 5, "brickCustom/aged"); - // brickCustom.carverHelper.addVariation("tile.brickCustom.6.desc", - // 6, "brickCustom/mossy"); + brickCustom.carverHelper.addVariation("tile.brickCustom.6.desc", 6, "brickCustom/yellow"); brickCustom.carverHelper.registerAll(brickCustom, "brickCustom"); Carving.chisel.registerOre("brickCustom", "brickCustom"); } @@ -1211,7 +1210,7 @@ public enum Features { void addBlocks() { BlockLeaf leaves = (BlockLeaf) new BlockLeaf(Material.leaves).setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(0.2F).setStepSound(Block.soundTypeGrass); Carving.chisel.addGroup(new CarvingGroup("leaves") { - + public List getVariations() { if (Configurations.chiselBackToVanillaLeaves) { return super.getVariations(); diff --git a/src/main/resources/assets/chisel/lang/en_US.lang b/src/main/resources/assets/chisel/lang/en_US.lang index a0ea9dee..a5c6a5d2 100644 --- a/src/main/resources/assets/chisel/lang/en_US.lang +++ b/src/main/resources/assets/chisel/lang/en_US.lang @@ -248,6 +248,7 @@ tile.brickCustom.1.desc=Large Bricks tile.brickCustom.2.desc=Mortarless Bricks tile.brickCustom.3.desc=Varied Bricks tile.brickCustom.5.desc=Aged Bricks +tile.brickCustom.6.desc=Yellow Bricks #Chisel 1 diff --git a/src/main/resources/assets/chisel/textures/blocks/brickCustom/yellow.png b/src/main/resources/assets/chisel/textures/blocks/brickCustom/yellow.png new file mode 100644 index 0000000000000000000000000000000000000000..217f263e0e37ee0ae18596866612ea6c33a41c28 GIT binary patch literal 3346 zcmV+t4ej!YP)EX>4Tx07%E3mUmQC*A|D*y?1({%`nm#dXp|Nfb=dP9RyJrW(F9_0K*JTY>22p zL=h1IMUbF?0i&TvtcYSED5zi$NDxqBFp8+CWJcCXe0h2A<>mLsz2Dkr?{oLrd!Mx~ z03=TzE-wX^0w9?u;0Jm*(^rK@(6Rjh26%u0rT{Qm>8ZX!?!iDLFE@L0LWj&=4?(nOT_siPRbOditRHZrp6?S8AgejFG^6va$=5K z|`EW#NwP&*~x4%_lS6VhL9s-#7D#h8C*`Lh;NHnGf9}t74chfY%+(L z4giWIwhK6{coCb3n8XhbbP@4#0C1$ZFF5847I3lz;zPNlq-OKEaq$AWE=!MYYHiJ+ zdvY?9I0Av8Ka-Wn(gPeepdb@piwLhwjRWWeSr7baCBSDM=|pK0Q5^$>Pur z|2)M1IPkCYSQ^NQ`z*pYmq4Rp8z$= z2uR(a0_5jDfT9oq5_wSE_22vEgAWDbn-``!u{igi1^xT3aEbVl&W-yV=Mor9X9@Wk zi)-R*3DAH5Bmou30~MeFbb%o-16IHmI084Y0{DSo5DwM?7KjJQfDbZ3F4znTKoQsl z_JT@K1L{E|XaOfc2RIEbfXm=IxC!on2Vew@gXdrdyaDqN1YsdEM1kZXRY(gmfXpBU zWDmJPK2RVO4n;$85DyYUxzHA<2r7jtp<1XB`W89`U4X7a1JFHa6qn9`(3jA6(BtSg7z~Dn(ZN_@JTc*z z1k5^2G3EfK6>}alfEmNgVzF3xtO3>z>xX4x1=s@Ye(W*qIqV>I9QzhW#Hr%UaPGJW z91oX=E5|kA&f*4f6S#T26kZE&gZIO;@!9wid_BGke*-^`pC?EYbO?5YU_t_6Gogae zLbybDNO(mg64i;;!~i0fxQSRnJWjkq93{RZ$&mC(E~H43khGI@gmj*CkMxR6CTo)& z$q{4$c_+D%e3AT^{8oY@VI<)t!Is!4Q6EtGo7CCWGzL)D>rQ4^>|)NiQ$)EQYB*=4e!vRSfKvS(yRXb4T4=0!`QmC#Pm zhG_4XC@*nZ!dbFoNz0PKC3A9$a*lEwxk9;CxjS<2<>~Tn@`>`hkG4N# zKjNU~z;vi{c;cwx$aZXSoN&@}N^m;n^upQ1neW`@Jm+HLvfkyqE8^^jVTFG14;RpP@{Py@g^4IZC^Zz~o6W||E74S6BG%z=?H;57x71R{; zCfGT+B=|vyZiq0XJ5(|>GPE&tF3dHoG;Cy*@v8N!u7@jxbHh6$uo0mV4H2`e-B#~i zJsxQhSr9q2MrTddnyYIS)+Vhz6D1kNj5-;Ojt+}%ivGa#W7aWeW4vOjV`f+`tbMHK zY)5t(dx~SnDdkMW+QpW}PR7~A?TMR;cZe^KpXR!7E4eQdJQHdX<`Vr9k0dT6g(bBn zMJ7e%MIVY;#n-+v{i@=tg`KfG`%5fK4(`J2;_VvR?Xdf3sdQ;h>DV6M zJ?&-mvcj_0d!zPVEnik%vyZS(xNoGwr=oMe=Kfv#KUBt7-l=k~YOPkP-cdbwfPG-_ zpyR=o8s(azn)ipehwj#T)V9}Y*Oec}9L_lWv_7=H_iM)2jSUJ7MGYU1@Q#ce4LsV@ zXw}%*q|{W>3^xm#r;bG)yZMdlH=QkpEw!z*)}rI!xbXP1Z==5*I^lhy`y}IJ%XeDe zRku;v3frOf?DmPgz@Xmo#D^7KH*><&kZ}k0<(`u)y&d8oAIZHU3e|F(q&bit1 zspqFJ#9bKcj_Q7Jan;4!Jpn!am%J}sx$J)VVy{#0xhr;8PG7aTdg>bETE}(E>+O9O zeQiHj{Lt2K+24M{>PF{H>ziEz%LmR5It*U8<$CM#ZLizc@2tEtFcdO$cQ|r*xkvZnNio#z9&IX9*nWZp8u5o(}(f= zr{t&Q6RH!9lV+2rr`)G*K3n~4{CVp0`RRh6rGKt|q5I;yUmSnwn^`q8{*wQ4;n(6< z@~@7(UiP|s)_?Z#o8&k1bA@l^-yVI(c-Q+r?ES=i<_GMDijR69yFPh;dbp6hu<#rA zg!B8%JG^WF000JJOGiWi{{a60|De66lK=n!32;bRa{vGf6951U69E94oEQKA00(qQ zO+^Ra0T~n&Bd9BwbN~PXWJyFpR5;6Jle=ycQ4of|bJ??3JC5zhgn$I85LKW-bP=hb z=B;=Jo&bfDFYitIBI(e1CKBY@jL^-c(MQ>y)H3;Q>oVWoldG(%*D)_Th$TNVua;CY5G-+o<- z0a&Z)?XFuLWXpmmbk`D+$l-b3b{970J9E8|YK}O(r6}u?ovs5B&>BQgMq$)LMg#e8 cFE&E@11%;D5A_3$)c^nh07*qoM6N<$f{HU*y8r+H literal 0 HcmV?d00001 From 70ec42f12ce8d395aee3bc24b47ad14d62e45961 Mon Sep 17 00:00:00 2001 From: warlordjones Date: Sun, 25 Jan 2015 20:40:39 +0000 Subject: [PATCH 65/75] Allow chiseling between oredictionaried copper blocks. In prep for adding blocktypes for copper. --- .../java/com/cricketcraft/chisel/Features.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index 4384e0f3..41bb1f6e 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -1,5 +1,6 @@ package com.cricketcraft.chisel; +import java.util.ArrayList; import java.util.List; import net.minecraft.block.Block; @@ -522,6 +523,21 @@ public enum Features { } }, + COPPER + { + @Override + void addBlocks() { + ArrayList oreBlocks = OreDictionary.getOres("blockCopper"); + //This if can probably be done at feature level, but I don't know how to do that... + if(oreBlocks != OreDictionary.EMPTY_LIST) + { + for(int i = 0; i < oreBlocks.size(); i++) + Carving.chisel.addVariation("copperblock", Block.getBlockFromItem(oreBlocks.get(i).getItem()), oreBlocks.get(i).getItemDamage(), i); + Carving.chisel.registerOre("copperblock", "copperblock"); + } + } + }, + DIAMOND_BLOCK { @Override From 1574ed2c95a89af9b2ec9c9791d5f81f328244df Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sun, 25 Jan 2015 16:24:19 -0500 Subject: [PATCH 66/75] Update changelog --- changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog b/changelog index 5912ada6..2a9d90cd 100644 --- a/changelog +++ b/changelog @@ -2,6 +2,8 @@ New - Add config to prevent chiseling between vanilla leaf types - Use vanilla 1.8 textures for the 1.8 blocks, implement 1.8 block pillars +- Add new yellow brick type +- Add chisling between different copper block types Fixes - All blocks now have proper breaking animations - #175 Fix bad texture on bottom sides of CTMV blocks From 45aa1100959c1b2675f2ace12208b31745ad6ffc Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sun, 25 Jan 2015 18:29:37 -0500 Subject: [PATCH 67/75] Fix build.gradle for maven --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 292d0967..c72cabec 100644 --- a/build.gradle +++ b/build.gradle @@ -113,7 +113,7 @@ publishing { tasks.publish.dependsOn 'build' publications { mavenJava(MavenPublication) { - from components.java + from artifact jar artifact sourcesJar artifact apiJar From 9a4e8b1bdf54e236633d4733a5681bfeabbd993c Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sun, 25 Jan 2015 18:45:18 -0500 Subject: [PATCH 68/75] Fix maven project name --- settings.gradle | 1 + 1 file changed, 1 insertion(+) create mode 100644 settings.gradle diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..1b169179 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'Chisel2' \ No newline at end of file From 59e950c9d718f656f7dc06601a11116db9a0cab3 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sun, 25 Jan 2015 19:10:24 -0500 Subject: [PATCH 69/75] Not sure what happened here, fix build.gradle again --- build.gradle | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index c72cabec..75b239d9 100644 --- a/build.gradle +++ b/build.gradle @@ -113,11 +113,10 @@ publishing { tasks.publish.dependsOn 'build' publications { mavenJava(MavenPublication) { - from artifact jar - + artifact jar + artifact deobfJar artifact sourcesJar artifact apiJar - artifact deobfJar } } From 415cf2213ad7a7637a9480a3204041f2da9f40e6 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sun, 25 Jan 2015 20:11:43 -0500 Subject: [PATCH 70/75] Fix copper feature --- src/main/java/com/cricketcraft/chisel/Features.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index 41bb1f6e..ca8135bc 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -525,16 +525,11 @@ public enum Features { COPPER { + @Override void addBlocks() { - ArrayList oreBlocks = OreDictionary.getOres("blockCopper"); - //This if can probably be done at feature level, but I don't know how to do that... - if(oreBlocks != OreDictionary.EMPTY_LIST) - { - for(int i = 0; i < oreBlocks.size(); i++) - Carving.chisel.addVariation("copperblock", Block.getBlockFromItem(oreBlocks.get(i).getItem()), oreBlocks.get(i).getItemDamage(), i); - Carving.chisel.registerOre("copperblock", "copperblock"); - } + Carving.chisel.addGroup(new CarvingGroup("copperblock")); + Carving.chisel.registerOre("copperblock", "blockCopper"); } }, From a36e0df65bdbf144ef70ed65d2fb215d806c5e7b Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sun, 25 Jan 2015 20:13:29 -0500 Subject: [PATCH 71/75] Update version to 2.3.5 and update changelog --- changelog | 4 ++++ gradle.properties | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/changelog b/changelog index 2a9d90cd..ff9b3a09 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,7 @@ +2.3.5: +Fixes +- Fix crash with copper block feature + 2.3.4: New - Add config to prevent chiseling between vanilla leaf types diff --git a/gradle.properties b/gradle.properties index 12c5f69f..9357a0cd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -mod_version=2.3.4 +mod_version=2.3.5 minecraft_version=1.7.10 forge_version=10.13.2.1277 From a7eec93e56e92d4f962aaccf9c7785de27b79d87 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Sun, 25 Jan 2015 20:21:35 -0500 Subject: [PATCH 72/75] Fix reversed logic for picking maven folder --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 75b239d9..391da333 100644 --- a/build.gradle +++ b/build.gradle @@ -121,7 +121,7 @@ publishing { } repositories { - String prop = dev ? "chisel_mavendir" : "chisel_dev_mavendir" + String prop = dev ? "chisel_dev_mavendir" : "chisel_mavendir" if (project.hasProperty(prop)) { maven { url project.getProperty(prop) } } From 049b0fb3bb4458b19bc0471e39f5d174b7a1daf6 Mon Sep 17 00:00:00 2001 From: Cricket Date: Mon, 26 Jan 2015 16:58:51 -0500 Subject: [PATCH 73/75] Recipe fix for #180 --- .../com/cricketcraft/chisel/Features.java | 90 +++++-------------- 1 file changed, 23 insertions(+), 67 deletions(-) diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index ca8135bc..ab5452fe 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -1,8 +1,25 @@ package com.cricketcraft.chisel; -import java.util.ArrayList; -import java.util.List; - +import com.cricketcraft.chisel.api.carving.ICarvingVariation; +import com.cricketcraft.chisel.block.*; +import com.cricketcraft.chisel.carving.CarvableHelper; +import com.cricketcraft.chisel.carving.CarvableVariation; +import com.cricketcraft.chisel.carving.Carving; +import com.cricketcraft.chisel.carving.CarvingGroup; +import com.cricketcraft.chisel.config.Configurations; +import com.cricketcraft.chisel.entity.EntityBallOMoss; +import com.cricketcraft.chisel.entity.EntityCloudInABottle; +import com.cricketcraft.chisel.entity.EntitySmashingRock; +import com.cricketcraft.chisel.init.ChiselBlocks; +import com.cricketcraft.chisel.init.ChiselItems; +import com.cricketcraft.chisel.init.ChiselTabs; +import com.cricketcraft.chisel.item.*; +import com.cricketcraft.chisel.item.chisel.ItemChisel; +import com.cricketcraft.chisel.item.chisel.ItemChisel.ChiselType; +import com.google.common.collect.Lists; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.registry.EntityRegistry; +import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; @@ -15,71 +32,10 @@ import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; -import com.cricketcraft.chisel.api.carving.ICarvingVariation; -import com.cricketcraft.chisel.block.BlockAutoChisel; -import com.cricketcraft.chisel.block.BlockBeaconBase; -import com.cricketcraft.chisel.block.BlockCarvable; -import com.cricketcraft.chisel.block.BlockCarvableAntiBlock; -import com.cricketcraft.chisel.block.BlockCarvableBookshelf; -import com.cricketcraft.chisel.block.BlockCarvableGlass; -import com.cricketcraft.chisel.block.BlockCarvableGlow; -import com.cricketcraft.chisel.block.BlockCarvableGlowstone; -import com.cricketcraft.chisel.block.BlockCarvableIce; -import com.cricketcraft.chisel.block.BlockCarvableIcePillar; -import com.cricketcraft.chisel.block.BlockCarvableIceStairs; -import com.cricketcraft.chisel.block.BlockCarvableLayered; -import com.cricketcraft.chisel.block.BlockCarvablePackedIce; -import com.cricketcraft.chisel.block.BlockCarvablePackedIcePillar; -import com.cricketcraft.chisel.block.BlockCarvablePackedIceStairs; -import com.cricketcraft.chisel.block.BlockCarvablePane; -import com.cricketcraft.chisel.block.BlockCarvablePillar; -import com.cricketcraft.chisel.block.BlockCarvablePowered; -import com.cricketcraft.chisel.block.BlockCarvablePumpkin; -import com.cricketcraft.chisel.block.BlockCarvableSlab; -import com.cricketcraft.chisel.block.BlockCarvableStairs; -import com.cricketcraft.chisel.block.BlockCarvableTorch; -import com.cricketcraft.chisel.block.BlockCloud; -import com.cricketcraft.chisel.block.BlockConcrete; -import com.cricketcraft.chisel.block.BlockEldritch; -import com.cricketcraft.chisel.block.BlockGrimstone; -import com.cricketcraft.chisel.block.BlockHolystone; -import com.cricketcraft.chisel.block.BlockLavastone; -import com.cricketcraft.chisel.block.BlockLeaf; -import com.cricketcraft.chisel.block.BlockMarbleCarpet; -import com.cricketcraft.chisel.block.BlockMarbleTexturedOre; -import com.cricketcraft.chisel.block.BlockPresent; -import com.cricketcraft.chisel.block.BlockRoadLine; -import com.cricketcraft.chisel.block.BlockSnakestone; -import com.cricketcraft.chisel.block.BlockSnakestoneObsidian; -import com.cricketcraft.chisel.block.BlockWaterstone; -import com.cricketcraft.chisel.block.CarvableStairsMaker; -import com.cricketcraft.chisel.block.IStairsCreator; -import com.cricketcraft.chisel.carving.CarvableHelper; -import com.cricketcraft.chisel.carving.CarvableVariation; -import com.cricketcraft.chisel.carving.Carving; -import com.cricketcraft.chisel.carving.CarvingGroup; -import com.cricketcraft.chisel.config.Configurations; -import com.cricketcraft.chisel.entity.EntityBallOMoss; -import com.cricketcraft.chisel.entity.EntityCloudInABottle; -import com.cricketcraft.chisel.entity.EntitySmashingRock; -import com.cricketcraft.chisel.init.ChiselBlocks; -import com.cricketcraft.chisel.init.ChiselItems; -import com.cricketcraft.chisel.init.ChiselTabs; -import com.cricketcraft.chisel.item.ItemBallOMoss; -import com.cricketcraft.chisel.item.ItemCarvable; -import com.cricketcraft.chisel.item.ItemCarvableSlab; -import com.cricketcraft.chisel.item.ItemCloudInABottle; -import com.cricketcraft.chisel.item.ItemSmashingRock; -import com.cricketcraft.chisel.item.ItemUpgrade; -import com.cricketcraft.chisel.item.chisel.ItemChisel; -import com.cricketcraft.chisel.item.chisel.ItemChisel.ChiselType; -import com.google.common.collect.Lists; +import java.util.List; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.registry.EntityRegistry; -import cpw.mods.fml.common.registry.GameRegistry; import static com.cricketcraft.chisel.init.ChiselBlocks.*; -import static com.cricketcraft.chisel.utils.General.*; +import static com.cricketcraft.chisel.utils.General.sGNames; public enum Features { @@ -728,7 +684,7 @@ public enum Features { @Override void addRecipes() { - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.futura, 8, 0), "SSS", "SGS", "SSS", 'S', "stone", 'G', "dustRedstone")); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselBlocks.futura, 8, 0), "SBS", "BGB", "SBS", 'S', "stone", 'G', "dustRedstone", 'B', new ItemStack(Blocks.stonebrick, 1))); } }, From be06c852e8a233737180c53b352cd67be449ca6c Mon Sep 17 00:00:00 2001 From: Cricket Date: Mon, 26 Jan 2015 17:23:34 -0500 Subject: [PATCH 74/75] Yeah that's a typo --- .../com/cricketcraft/chisel/client/GeneralChiselClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cricketcraft/chisel/client/GeneralChiselClient.java b/src/main/java/com/cricketcraft/chisel/client/GeneralChiselClient.java index 14f72411..95494049 100644 --- a/src/main/java/com/cricketcraft/chisel/client/GeneralChiselClient.java +++ b/src/main/java/com/cricketcraft/chisel/client/GeneralChiselClient.java @@ -165,7 +165,7 @@ public class GeneralChiselClient { } public static void spawnSnakestoneObsidianFX(World world, BlockSnakestoneObsidian block, int x, int y, int z) { - if (Configurations.particlesTickrate == 0 || tick++ % Configurations.particlesTickrate == 0) { + if (Configurations.particlesTickrate != 0 || tick++ % Configurations.particlesTickrate != 0) { EntitySnakestoneObsidianFX res = new EntitySnakestoneObsidianFX(world, block, x, y, z); Minecraft.getMinecraft().effectRenderer.addEffect(res); } From 8faa70ba46a4e24e0c9ecc42f98fc8d53986708b Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Mon, 26 Jan 2015 22:41:48 -0500 Subject: [PATCH 75/75] Rewrite presents. Still a bit WIP, needs sounds and lid animation --- .../com/cricketcraft/chisel/Features.java | 18 +- .../chisel/block/BlockPresent.java | 294 ++++++---------- .../block/tileentity/TileEntityPresent.java | 325 +++++++++++++----- .../chisel/carving/CarvableHelper.java | 4 +- .../render/item/ItemPresentRenderer.java | 74 ---- .../client/render/tile/RenderPresent.java | 212 ++++++------ .../chisel/init/ChiselBlocks.java | 4 +- .../inventory/InventoryLargePresent.java | 103 ------ .../chisel/network/PacketHandler.java | 2 + .../message/MessagePresentConnect.java | 60 ++++ .../chisel/proxy/ClientProxy.java | 9 +- .../chisel/proxy/CommonProxy.java | 2 +- 12 files changed, 543 insertions(+), 564 deletions(-) delete mode 100644 src/main/java/com/cricketcraft/chisel/client/render/item/ItemPresentRenderer.java delete mode 100644 src/main/java/com/cricketcraft/chisel/inventory/InventoryLargePresent.java create mode 100644 src/main/java/com/cricketcraft/chisel/network/message/MessagePresentConnect.java diff --git a/src/main/java/com/cricketcraft/chisel/Features.java b/src/main/java/com/cricketcraft/chisel/Features.java index ca8135bc..bc0784af 100644 --- a/src/main/java/com/cricketcraft/chisel/Features.java +++ b/src/main/java/com/cricketcraft/chisel/Features.java @@ -1,6 +1,5 @@ package com.cricketcraft.chisel; -import java.util.ArrayList; import java.util.List; import net.minecraft.block.Block; @@ -66,6 +65,7 @@ import com.cricketcraft.chisel.init.ChiselBlocks; import com.cricketcraft.chisel.init.ChiselItems; import com.cricketcraft.chisel.init.ChiselTabs; import com.cricketcraft.chisel.item.ItemBallOMoss; +import com.cricketcraft.chisel.item.ItemBlockPresent; import com.cricketcraft.chisel.item.ItemCarvable; import com.cricketcraft.chisel.item.ItemCarvableSlab; import com.cricketcraft.chisel.item.ItemCloudInABottle; @@ -1310,7 +1310,7 @@ public enum Features { limestone_slab.carverHelper.addVariation("tile.limestoneSlab.13.desc", 13, "limestone/terrain-pistonback-lightfour"); limestone_slab.carverHelper.addVariation("tile.limestoneSlab.14.desc", 14, "limestone/terrain-pistonback-lightmarker"); limestone_slab.carverHelper.addVariation("tile.limestoneSlab.15.desc", 15, "limestone/terrain-pistonback-lightpanel"); - limestone_slab.carverHelper.register(limestone_slab, "limestone_slab", ItemCarvableSlab.class); + limestone_slab.carverHelper.registerAll(limestone_slab, "limestone_slab", ItemCarvableSlab.class); registerSlabTop(limestone_slab, limestone_slab.top); Carving.chisel.registerOre("limestone_slab", "limestone_slab"); @@ -1388,7 +1388,7 @@ public enum Features { marble_slab.carverHelper.addVariation("tile.marbleSlab.13.desc", 13, "marbleslab/marble-arranged-bricks"); marble_slab.carverHelper.addVariation("tile.marbleSlab.14.desc", 14, "marbleslab/marble-fancy-bricks"); marble_slab.carverHelper.addVariation("tile.marbleSlab.15.desc", 15, "marbleslab/marble-blocks"); - marble_slab.carverHelper.register(marble_slab, "marble_slab", ItemCarvableSlab.class); + marble_slab.carverHelper.registerAll(marble_slab, "marble_slab", ItemCarvableSlab.class); registerSlabTop(marble_slab, marble_slab.top); Carving.chisel.registerOre("marble_slab", "marble_slab"); @@ -1507,7 +1507,7 @@ public enum Features { marble_pillar_slab.carverHelper.addVariation("tile.marblePillarSlab.14.desc", 14, "marblepillarslab/carved"); marble_pillar_slab.carverHelper.addVariation("tile.marblePillarSlab.15.desc", 15, "marblepillarslab/ornamental"); } - marble_pillar_slab.carverHelper.register(marble_pillar_slab, "marble_pillar_slab", ItemCarvableSlab.class); + marble_pillar_slab.carverHelper.registerAll(marble_pillar_slab, "marble_pillar_slab", ItemCarvableSlab.class); registerSlabTop(marble_pillar_slab, marble_pillar_slab.top); } @@ -1724,17 +1724,17 @@ public enum Features { @Override void addBlocks() { - for (int x = 0; x < 16; x++) { - present[x] = (BlockPresent) new BlockPresent(x).setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(2.0F).setResistance(10.0F).setBlockName("present"); - GameRegistry.registerBlock(present[x], "chest" + x); - Carving.chisel.addVariation("present", present[x], 0, (x + 1)); + BlockPresent present = (BlockPresent) new BlockPresent().setCreativeTab(ChiselTabs.tabOtherChiselBlocks).setHardness(2.0F).setResistance(10.0F).setBlockName("present"); + for (int i = 0; i < 16; i++) { + present.carverHelper.addVariation("tile.present.desc." + i, i, Blocks.chest); } + present.carverHelper.registerAll(present, "present", ItemBlockPresent.class); Carving.chisel.registerOre("present", "chest"); } @Override void addRecipes() { - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ChiselBlocks.present[meta]), new ItemStack(Blocks.chest, 1), dyeOres[meta])); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ChiselBlocks.present, 1, meta), new ItemStack(Blocks.chest, 1), dyeOres[meta])); } @Override diff --git a/src/main/java/com/cricketcraft/chisel/block/BlockPresent.java b/src/main/java/com/cricketcraft/chisel/block/BlockPresent.java index 6bef6e30..dc8aff01 100644 --- a/src/main/java/com/cricketcraft/chisel/block/BlockPresent.java +++ b/src/main/java/com/cricketcraft/chisel/block/BlockPresent.java @@ -1,19 +1,16 @@ package com.cricketcraft.chisel.block; -import java.util.Iterator; -import java.util.Random; +import java.util.List; import net.minecraft.block.Block; -import net.minecraft.block.BlockChest; +import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.Entity; +import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.passive.EntityOcelot; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; @@ -21,46 +18,42 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import com.cricketcraft.chisel.Chisel; import com.cricketcraft.chisel.api.ICarvable; import com.cricketcraft.chisel.block.tileentity.TileEntityPresent; import com.cricketcraft.chisel.carving.CarvableHelper; import com.cricketcraft.chisel.carving.CarvableVariation; -import com.cricketcraft.chisel.inventory.InventoryLargePresent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockPresent extends BlockChest implements ICarvable { +public class BlockPresent extends Block implements ICarvable { - private final Random random = new Random(); - private int type; public CarvableHelper carverHelper; + + private float minX, minY, minZ, maxX, maxY, maxZ; - public BlockPresent(int type) { - super(1); - this.type = type; + public BlockPresent() { + super(Material.wood); carverHelper = new CarvableHelper(); - setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0875F, 0.9365F); + minX = 0.0625F; + minZ = 0.0625F; + maxX = 0.9375F; + maxY = 0.875F; + maxZ = 0.9375F; + setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ); } - public String getKindOfChest(int type) { + public String getModelTexture(int type) { return "textures/blocks/present/presentChest" + type; } - - private static boolean isCatSittingOnMe(World world, int x, int y, int z) { - Iterator iterator = world.getEntitiesWithinAABB(EntityOcelot.class, AxisAlignedBB.getBoundingBox(x, y + 1, z, x + 1, y + 2, z + 1)).iterator(); - EntityOcelot ocelot; - - do { - if (!iterator.hasNext()) { - return false; - } - - Entity entity = (Entity) iterator.next(); - ocelot = (EntityOcelot) entity; - } while (!ocelot.isSitting()); - - return true; + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void getSubBlocks(Item item, CreativeTabs tab, List list) { + for (int i = 0; i < 16; i++) { + list.add(new ItemStack(item, 1, i)); + } } @Override @@ -79,96 +72,23 @@ public class BlockPresent extends BlockChest implements ICarvable { } @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLivingBase, ItemStack itemStack) { - Block front = world.getBlock(x, y, z - 1); - Block back = world.getBlock(x, y, z + 1); - Block left = world.getBlock(x - 1, y, z); - Block right = world.getBlock(x + 1, y, z); - byte metadata = 0; - int rot = MathHelper.floor_double((entityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; - - if (rot == 0) { - metadata = 2; - } - - if (rot == 1) { - metadata = 5; - } - - if (rot == 2) { - metadata = 3; - } - - if (rot == 3) { - metadata = 4; - } - - if (front != this && back != this && left != this && right != this) { - world.setBlockMetadataWithNotify(x, y, z, metadata, 3); - } else { - if ((front == this || back == this) && (metadata == 4 || metadata == 5)) { - if (front == this) { - world.setBlockMetadataWithNotify(x, y, z - 1, metadata, 3); - } else { - world.setBlockMetadataWithNotify(x, y, z + 1, metadata, 3); - } - - world.setBlockMetadataWithNotify(x, y, z, metadata, 3); - } - - if ((left == this || right == this) && (metadata == 2 || metadata == 3)) { - if (left == this) { - world.setBlockMetadataWithNotify(x - 1, y, z, metadata, 3); - } else { - world.setBlockMetadataWithNotify(x + 1, y, z, metadata, 3); - } - - world.setBlockMetadataWithNotify(x, y, z, metadata, 3); - } - } - } - - @Override - public boolean canPlaceBlockAt(World world, int x, int y, int z) { - int l = 0; - - if (world.getBlock(x - 1, y, z) == this) { - ++l; - } - - if (world.getBlock(x + 1, y, z) == this) { - ++l; - } - - if (world.getBlock(x, y, z - 1) == this) { - ++l; - } - - if (world.getBlock(x, y, z + 1) == this) { - ++l; - } - - return l > 1 ? false : (areSurroundingBlocksMe(world, x, y - 1, z) ? false : (areSurroundingBlocksMe(world, x, y + 1, z) ? false : (areSurroundingBlocksMe(world, x, y, z - 1) ? false - : !areSurroundingBlocksMe(world, x, y, z + 1)))); - } - - private boolean areSurroundingBlocksMe(World world, int x, int y, int z) { - return world.getBlock(x, y, z) != this ? false : (world.getBlock(x - 1, y, z) == this ? true : (world.getBlock(x + 1, y, z) == this ? true : (world.getBlock(x, y, z - 1) == this ? true - : world.getBlock(x, y, z + 1) == this))); - } - - @Override - public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) { - super.onNeighborBlockChange(world, x, y, z, neighbor); - TileEntityPresent tileEntityPresent = (TileEntityPresent) world.getTileEntity(x, y, z); - - if (tileEntityPresent != null) { - tileEntityPresent.updateContainingBlockInfo(); + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) { + super.onBlockPlacedBy(world, x, y, z, player, stack); + int heading = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + TileEntityPresent te = (TileEntityPresent) world.getTileEntity(x, y, z); + world.setBlockMetadataWithNotify(x, y, z, heading, 3); + te.findConnections(); + if (te.isConnected()) { + TileEntityPresent other = te.getConnection(); + world.setBlockMetadataWithNotify(other.xCoord, other.yCoord, other.zCoord, heading, 3); } + te.setType(stack.getItemDamage()); + world.markBlockForUpdate(x, y, z); } @Override public void breakBlock(World world, int x, int y, int z, Block present, int meta) { + TileEntityPresent tileEntityPresent = (TileEntityPresent) world.getTileEntity(x, y, z); if (tileEntityPresent != null) { @@ -176,28 +96,7 @@ public class BlockPresent extends BlockChest implements ICarvable { ItemStack itemStack = tileEntityPresent.getStackInSlot(c); if (itemStack != null) { - float f = random.nextFloat() * 0.8F + 0.1F; - float f1 = random.nextFloat() * 0.8F + 0.1F; - EntityItem entityItem; - - for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemStack.stackSize > 0; world.spawnEntityInWorld(entityItem)) { - int stack = random.nextInt(21) + 10; - - if (stack > itemStack.stackSize) { - stack = itemStack.stackSize; - } - - itemStack.stackSize -= stack; - entityItem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemStack.getItem(), stack, itemStack.getItemDamage())); - float motion = 0.05F; - entityItem.motionX = random.nextGaussian() * motion; - entityItem.motionY = random.nextGaussian() * motion + 0.2F; - entityItem.motionZ = random.nextGaussian() * motion; - - if (itemStack.hasTagCompound()) { - entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy()); - } - } + dropBlockAsItem(world, x, y, z, itemStack); } } @@ -208,23 +107,75 @@ public class BlockPresent extends BlockChest implements ICarvable { } @Override - public TileEntity createNewTileEntity(World world, int par2) { - return new TileEntityPresent(type); + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int hitX, float hitY, float hitZ, float p_149727_9_) { + if (!world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)) { + player.openGui(Chisel.instance, 2, world, x, y, z); + return true; + } + return false; } @Override - public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int direction) { - if (!canProvidePower()) { - return 0; + public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) { + return getBoundingBox((TileEntityPresent) world.getTileEntity(x, y, z)); + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { + return getBoundingBox((TileEntityPresent) world.getTileEntity(x, y, z)); + } + + public AxisAlignedBB getBoundingBox(TileEntityPresent me) { + if (me == null) { + return AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ); + } + int x = me.xCoord, y = me.yCoord, z = me.zCoord; + if (me.isConnected()) { + ForgeDirection dir = me.getConnectionDir(); + if (dir != ForgeDirection.NORTH && (!me.isParent() || dir == ForgeDirection.SOUTH)) { + return AxisAlignedBB.getBoundingBox(x + minX, y + minY, z + minZ, x + maxX + dir.offsetX, y + maxY, z + maxZ + dir.offsetZ); + } else { + return AxisAlignedBB.getBoundingBox(x + dir.offsetX + minX, y + minY, z + dir.offsetZ + minZ, x + maxX, y + maxY, z + maxZ); + } + } + return AxisAlignedBB.getBoundingBox(x + minX, y + minY, z + minZ, x + maxX, y + maxY, z + maxZ); + } + + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) + { + TileEntityPresent te = (TileEntityPresent) world.getTileEntity(x, y, z); + if (!te.isConnected()) { + setBlockBounds(0.0625F, 0, 0.0625F, 0.9375F, 0.875F, 0.9365F); } else { - int players = ((TileEntityPresent) world.getTileEntity(x, y, z)).numPlayersUsing; - return MathHelper.clamp_int(players, 0, 15); + ForgeDirection dir = te.getConnectionDir(); + switch (dir) { + case EAST: + setBlockBounds(0.0625F, 0, 0.0625F, 1, 0.875F, 0.9365F); + break; + case NORTH: + setBlockBounds(0.0625F, 0, 0, 0.9375F, 0.875F, 0.9365F); + break; + case SOUTH: + setBlockBounds(0.0625F, 0, 0.0625F, 0.9375F, 0.875F, 1); + break; + case WEST: + setBlockBounds(0, 0, 0.0625F, 0.9375F, 0.875F, 0.9365F); + break; + default: + setBlockBounds(0.0625F, 0, 0.0625F, 0.9375F, 0.875F, 0.9365F); + break; + } } } + + @Override + public boolean hasTileEntity(int metadata) { + return true; + } @Override - public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int strength) { - return strength == 1 ? isProvidingWeakPower(world, x, y, z, strength) : 0; + public TileEntity createTileEntity(World world, int metadata) { + return new TileEntityPresent(); } @Override @@ -234,7 +185,11 @@ public class BlockPresent extends BlockChest implements ICarvable { @Override public int getComparatorInputOverride(World world, int x, int y, int z, int strength) { - return Container.calcRedstoneFromInventory(getInventory(world, x, y, z)); + TileEntity te = world.getTileEntity(x, y, z); + if (te instanceof TileEntityPresent) { + return Container.calcRedstoneFromInventory((TileEntityPresent) te); + } + return 0; } @Override @@ -243,47 +198,10 @@ public class BlockPresent extends BlockChest implements ICarvable { this.blockIcon = register.registerIcon("planks_oak"); } - public IInventory getInventory(World world, int x, int y, int z) { - Object object = world.getTileEntity(x, y, z); - - if (object == null) { - return null; - } else if (world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)) { - return null; - } else if (isCatSittingOnMe(world, x, y, z)) { - return null; - } else if (world.getBlock(x - 1, y, z) == this && (world.isSideSolid(x - 1, y + 1, z, ForgeDirection.DOWN) || isCatSittingOnMe(world, x, y - 1, z))) { - return null; - } else if (world.getBlock(x + 1, y, z) == this && (world.isSideSolid(x + 1, y + 1, z, ForgeDirection.DOWN) || isCatSittingOnMe(world, x, y + 1, z))) { - return null; - } else if (world.getBlock(x, y, z - 1) == this && (world.isSideSolid(x, y + 1, z - 1, ForgeDirection.DOWN) || isCatSittingOnMe(world, x, y, z - 1))) { - return null; - } else if (world.getBlock(x, y, z + 1) == this && (world.isSideSolid(x, y + 1, z + 1, ForgeDirection.DOWN) || isCatSittingOnMe(world, x, y, z + 1))) { - return null; - } else { - if (world.getBlock(x - 1, y, z) == this) { - object = new InventoryLargePresent("container.chestDouble", (TileEntityPresent) world.getTileEntity(x - 1, y, z), (IInventory) object); - } - - if (world.getBlock(x + 1, y, z) == this) { - object = new InventoryLargePresent("container.chestDouble", (TileEntityPresent) world.getTileEntity(x + 1, y, z), (IInventory) object); - } - - if (world.getBlock(x, y, z - 1) == this) { - object = new InventoryLargePresent("container.chestDouble", (TileEntityPresent) world.getTileEntity(x, y, z - 1), (IInventory) object); - } - - if (world.getBlock(x, y, z + 1) == this) { - object = new InventoryLargePresent("container.chestDouble", (TileEntityPresent) world.getTileEntity(x, y, z + 1), (IInventory) object); - } - - return (IInventory) object; - } - } - @Override public CarvableVariation getVariation(IBlockAccess world, int x, int y, int z, int metadata) { - return carverHelper.getVariation(metadata); + TileEntity te = world.getTileEntity(x, y, z); + return te instanceof TileEntityPresent ? carverHelper.getVariation(((TileEntityPresent) te).getType()) : carverHelper.getVariation(metadata); } @Override diff --git a/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityPresent.java b/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityPresent.java index 80c8d638..9baf49f0 100644 --- a/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityPresent.java +++ b/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityPresent.java @@ -1,110 +1,271 @@ package com.cricketcraft.chisel.block.tileentity; -import java.util.Iterator; -import java.util.List; - import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; -import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import net.minecraftforge.common.util.ForgeDirection; -import com.cricketcraft.chisel.inventory.ContainerPresent; -import com.cricketcraft.chisel.inventory.InventoryLargePresent; +import com.cricketcraft.chisel.init.ChiselBlocks; +import com.cricketcraft.chisel.network.PacketHandler; +import com.cricketcraft.chisel.network.message.MessagePresentConnect; -public class TileEntityPresent extends TileEntityChest { +public class TileEntityPresent extends TileEntity implements IInventory { - public int type; - private int ticksSinceSync; - - public TileEntityPresent(int type) { - this.type = type; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer player) { - return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : player.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) <= 64.0D; - } + private TileEntityPresent connection = null; + private ForgeDirection cachedDir = null; + private boolean isParent; + private ItemStack[] inventory = new ItemStack[27]; + private int type; + private boolean autoSearch = true; @Override public void updateEntity() { - super.updateEntity(); - this.checkForAdjacentChests(); - ++this.ticksSinceSync; - float f; + if (isConnected() && connection.isInvalid()) { + disconnect(); + } - if (!this.worldObj.isRemote && this.numPlayersUsing != 0 && (this.ticksSinceSync + this.xCoord + this.yCoord + this.zCoord) % 200 == 0) { - this.numPlayersUsing = 0; - f = 5.0F; - List list = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(this.xCoord - f, this.yCoord - f, - this.zCoord - f, this.xCoord + 1 + f, this.yCoord + 1 + f, this.zCoord + 1 + f)); - Iterator iterator = list.iterator(); + if (autoSearch && worldObj != null /* ugh */) { + if (cachedDir != null) { + connectTo(cachedDir); + } else { + findConnections(); + } + autoSearch = false; + } + } - while (iterator.hasNext()) { - EntityPlayer entityplayer = (EntityPlayer) iterator.next(); + public boolean isConnected() { + return connection != null; + } - if (entityplayer.openContainer instanceof ContainerPresent) { - IInventory iinventory = ((ContainerChest) entityplayer.openContainer).getLowerChestInventory(); + private boolean connectTo(TileEntityPresent present, ForgeDirection dir) { + if (present.type == type && !present.isConnected() && Math.abs(present.xCoord - xCoord + present.yCoord - yCoord + present.zCoord - zCoord) == 1) { + connection = present; + connection.connection = this; + connection.cachedDir = dir.getOpposite(); + cachedDir = dir; + isParent = !present.isParent; + PacketHandler.INSTANCE.sendToDimension(new MessagePresentConnect(this, dir, true), worldObj.provider.dimensionId); + return true; + } + return false; + } - if (iinventory == this || iinventory instanceof InventoryLargePresent && ((InventoryLargePresent) iinventory).isPartOfLargePresent(this)) { - ++this.numPlayersUsing; + public boolean connectTo(ForgeDirection dir) { + TileEntity te = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ); + if (te instanceof TileEntityPresent) { + return connectTo((TileEntityPresent) te, dir); + } + return false; + } + + public void disconnect() { + if (isConnected()) { + this.connection.cachedDir = null; + this.connection.connection = null; + this.cachedDir = null; + this.connection = null; + PacketHandler.INSTANCE.sendToDimension(new MessagePresentConnect(this, ForgeDirection.UNKNOWN, false), worldObj.provider.dimensionId); + } + } + + public TileEntityPresent getConnection() { + return connection; + } + + public ForgeDirection getConnectionDir() { + return cachedDir == null ? ForgeDirection.UNKNOWN : cachedDir; + } + + public boolean isParent() { + return isParent || !isConnected(); + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public void findConnections() { + if (!isConnected()) { + for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { + if (dir != ForgeDirection.UP && dir != ForgeDirection.DOWN) { + if (connectTo(dir)) { + break; } } } } + } + + public TileEntityPresent getParent() { + return isParent || connection == null ? this : connection; + } - this.prevLidAngle = this.lidAngle; - f = 0.1F; - double d2; + @Override + public AxisAlignedBB getRenderBoundingBox() { + return ChiselBlocks.present.getBoundingBox(this); + } - if (this.numPlayersUsing > 0 && this.lidAngle == 0.0F && this.adjacentChestZNeg == null && this.adjacentChestXNeg == null) { - double d1 = this.xCoord + 0.5D; - d2 = this.zCoord + 0.5D; + @Override + public void writeToNBT(NBTTagCompound tag) + { + super.writeToNBT(tag); + NBTTagList nbttaglist = new NBTTagList(); - if (this.adjacentChestZPos != null) { - d2 += 0.5D; + for (int i = 0; i < inventory.length; ++i) + { + if (inventory[i] != null) + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte) i); + inventory[i].writeToNBT(nbttagcompound1); + nbttaglist.appendTag(nbttagcompound1); } - - if (this.adjacentChestXPos != null) { - d1 += 0.5D; - } - - this.worldObj.playSoundEffect(d1, this.yCoord + 0.5D, d2, "random.chestopen", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); } - if (this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F) { - float f1 = this.lidAngle; - - if (this.numPlayersUsing > 0) { - this.lidAngle += f; - } else { - this.lidAngle -= f; - } - - if (this.lidAngle > 1.0F) { - this.lidAngle = 1.0F; - } - - float f2 = 0.5F; - - if (this.lidAngle < f2 && f1 >= f2 && this.adjacentChestZNeg == null && this.adjacentChestXNeg == null) { - d2 = this.xCoord + 0.5D; - double d0 = this.zCoord + 0.5D; - - if (this.adjacentChestZPos != null) { - d0 += 0.5D; - } - - if (this.adjacentChestXPos != null) { - d2 += 0.5D; - } - - this.worldObj.playSoundEffect(d2, this.yCoord + 0.5D, d0, "random.chestclosed", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); - } - - if (this.lidAngle < 0.0F) { - this.lidAngle = 0.0F; - } + tag.setTag("Items", nbttaglist); + tag.setBoolean("isParent", isParent); + tag.setInteger("presentType", type); + if (cachedDir != null) { + tag.setInteger("conDir", cachedDir.ordinal()); } } + + @Override + public void readFromNBT(NBTTagCompound tag) + { + super.readFromNBT(tag); + NBTTagList nbttaglist = tag.getTagList("Items", 10); + inventory = new ItemStack[this.getSizeInventory()]; + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound1.getByte("Slot") & 255; + + if (j >= 0 && j < inventory.length) + { + inventory[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); + } + } + + this.isParent = tag.getBoolean("isParent"); + + this.type = tag.getInteger("presentType"); + if (tag.hasKey("conDir")) { + cachedDir = ForgeDirection.values()[tag.getInteger("conDir")]; + } + autoSearch = true; + } + + /* IInventory */ + + @Override + public int getSizeInventory() { + return isConnected() ? inventory.length + connection.inventory.length : inventory.length; + } + + @Override + public ItemStack getStackInSlot(int slot) { + if (slot >= inventory.length) { + return isConnected() ? connection.inventory[slot % inventory.length] : null; + } else { + return inventory[slot]; + } + } + + @Override + public ItemStack decrStackSize(int slot, int amount) + { + ItemStack[] inv = inventory; + if (isConnected() && slot >= inventory.length) { + inv = connection.inventory; + } + + if (inv[slot] != null) + { + ItemStack itemstack; + + if (inv[slot].stackSize <= amount) + { + itemstack = inv[slot]; + inv[slot] = null; + this.markDirty(); + return itemstack; + } + else + { + itemstack = inv[slot].splitStack(amount); + + if (inv[slot].stackSize == 0) + { + inv[slot] = null; + } + + this.markDirty(); + return itemstack; + } + } + else + { + return null; + } + } + + @Override + public ItemStack getStackInSlotOnClosing(int slot) { + return getStackInSlot(slot); + } + + @Override + public void setInventorySlotContents(int slot, ItemStack stack) { + if (slot < inventory.length) { + inventory[slot] = stack; + } else if (isConnected()) { + connection.inventory[slot % inventory.length] = stack; + } + } + + @Override + public String getInventoryName() { + return "chisel.present"; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer p_70300_1_) { + return true; + } + + @Override + public void openInventory() { + ; + } + + @Override + public void closeInventory() { + ; + } + + @Override + public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) { + return true; + } } diff --git a/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java b/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java index cbbc938e..81db120f 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java +++ b/src/main/java/com/cricketcraft/chisel/carving/CarvableHelper.java @@ -255,7 +255,7 @@ public class CarvableHelper { } public void registerAll(Block block, String name) { - register(block, name, ItemCarvable.class); + registerAll(block, name, ItemCarvable.class); } public void registerBlock(Block block, String name) { @@ -267,7 +267,7 @@ public class CarvableHelper { GameRegistry.registerBlock(block, cl, name); } - public void register(Block block, String name, Class cl) { + public void registerAll(Block block, String name, Class cl) { registerBlock(block, name, cl); registerVariations(name, block); } diff --git a/src/main/java/com/cricketcraft/chisel/client/render/item/ItemPresentRenderer.java b/src/main/java/com/cricketcraft/chisel/client/render/item/ItemPresentRenderer.java deleted file mode 100644 index bd629928..00000000 --- a/src/main/java/com/cricketcraft/chisel/client/render/item/ItemPresentRenderer.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.cricketcraft.chisel.client.render.item; - -import net.minecraft.client.model.ModelChest; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.IItemRenderer; - -import org.lwjgl.opengl.GL11; - -import com.cricketcraft.chisel.Chisel; -import com.cricketcraft.chisel.block.BlockPresent; - -import cpw.mods.fml.client.FMLClientHandler; - -public class ItemPresentRenderer implements IItemRenderer { - - private final ModelChest model = new ModelChest(); - BlockPresent present; - private int meta; - - public ItemPresentRenderer(int type) { - present = new BlockPresent(type); - this.meta = type; - } - - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return type != ItemRenderType.FIRST_PERSON_MAP; - } - - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { - return true; - } - - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(Chisel.MOD_ID, present.getKindOfChest(meta) + ".png")); - switch (type) { - case ENTITY: - renderBlock(0.0F, 1.0F, 0.0F); - break; - case EQUIPPED: - renderBlock(0.5F, 1.5F, 0.5F); - break; - case EQUIPPED_FIRST_PERSON: - renderBlock(0.5F, 1.0F, 0.5F); - break; - case INVENTORY: - renderInventory(1.0F, 1.0F, 1.0F); - break; - default: - break; - } - } - - private void renderBlock(float x, float y, float z) { - GL11.glPushMatrix(); - GL11.glTranslatef(x, y, z); - GL11.glScaled(-1, -1, 1); - model.renderAll(); - GL11.glPopMatrix(); - } - - private void renderInventory(float x, float y, float z) { - GL11.glPushMatrix(); - GL11.glTranslatef(x, y, z); - GL11.glRotatef(180F, 1F, 0, 0); - GL11.glRotatef(-90F, 0, 1F, 0); - GL11.glScalef(1.0F, 1.0F, 1.0F); - model.renderAll(); - GL11.glPopMatrix(); - } -} diff --git a/src/main/java/com/cricketcraft/chisel/client/render/tile/RenderPresent.java b/src/main/java/com/cricketcraft/chisel/client/render/tile/RenderPresent.java index 59d8bac5..dcf906cf 100644 --- a/src/main/java/com/cricketcraft/chisel/client/render/tile/RenderPresent.java +++ b/src/main/java/com/cricketcraft/chisel/client/render/tile/RenderPresent.java @@ -1,126 +1,144 @@ package com.cricketcraft.chisel.client.render.tile; -import net.minecraft.block.Block; +import java.util.HashMap; + import net.minecraft.client.model.ModelChest; import net.minecraft.client.model.ModelLargeChest; -import net.minecraft.client.renderer.tileentity.TileEntityChestRenderer; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.IItemRenderer; +import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import com.cricketcraft.chisel.Chisel; -import com.cricketcraft.chisel.block.BlockPresent; import com.cricketcraft.chisel.block.tileentity.TileEntityPresent; +import com.cricketcraft.chisel.init.ChiselBlocks; +import com.google.common.collect.Maps; -import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.client.FMLClientHandler; -public class RenderPresent extends TileEntityChestRenderer { +public class RenderPresent extends TileEntitySpecialRenderer implements IItemRenderer { private ModelChest smallChest = new ModelChest(); private ModelChest largeChest = new ModelLargeChest(); - - public RenderPresent() { - } + + private HashMap textureCache = Maps.newHashMap(); public void renderTileEntityAt(TileEntityPresent present, double x, double y, double z, float partialTicks) { - int i; - - if (!present.hasWorldObj()) { - i = 0; - } else { - Block block = present.getBlockType(); - i = present.getBlockMetadata(); - - if (block instanceof BlockPresent && i == 0) { - try { - ((BlockPresent) block).func_149954_e(present.getWorldObj(), present.xCoord, present.yCoord, present.zCoord); - } catch (ClassCastException e) { - FMLLog.severe("[Chisel 2] Attempted to render a present at %d, %d, %d that was not a present", present.xCoord, present.yCoord, present.zCoord); - } - i = present.getBlockMetadata(); + GL11.glPushMatrix(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F); + GL11.glScalef(1.0F, -1.0F, -1.0F); + int meta = present.getBlockMetadata(); + bindTexture(present); + if (!present.isConnected()) { + GL11.glRotatef(90 * meta + 180, 0, 1, 0); + switch(present.getBlockMetadata()) { + case 0: + GL11.glTranslatef(-1, 0, -1); + break; + case 1: + GL11.glTranslatef(0, 0, -1); + break; + case 3: + GL11.glTranslatef(-1, 0, 0); + break; } - - present.checkForAdjacentChests(); + smallChest.renderAll(); + } else if (present.isParent()) { + ForgeDirection dir = present.getConnectionDir(); + switch(dir) { + case NORTH: + GL11.glRotatef(-90, 0, 1, 0); + GL11.glTranslatef(0, 0, -1); + break; + case SOUTH: + GL11.glRotatef(-90, 0, 1, 0); + GL11.glTranslatef(-1, 0, -1); + break; + case WEST: + GL11.glTranslatef(-1, 0, 0); + break; + default: + break; + } + if (meta == 0 || meta == 3) { + GL11.glRotatef(180, 0, 1, 0); + GL11.glTranslatef(-2, 0, -1); + } + largeChest.renderAll(); } - - if (present.adjacentChestZNeg == null && present.adjacentChestXNeg == null) { - BlockPresent blockPresent = (BlockPresent) present.getWorldObj().getBlock(present.xCoord, present.yCoord, present.zCoord); - ModelChest smallOrLargeChest; - if (present.adjacentChestZPos == null && present.adjacentChestXPos == null) { - smallOrLargeChest = smallChest; - this.bindTexture(new ResourceLocation(Chisel.MOD_ID, blockPresent.getKindOfChest(present.type) + ".png")); - } else { - smallOrLargeChest = largeChest; - this.bindTexture(new ResourceLocation(Chisel.MOD_ID, blockPresent.getKindOfChest(present.type) + "_double.png")); - } - - GL11.glPushMatrix(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F); - GL11.glScalef(1.0F, -1.0F, -1.0F); - GL11.glTranslatef(0.5F, 0.5F, 0.5F); - short short1 = 0; - - if (i == 2) { - short1 = 180; - } - - if (i == 3) { - short1 = 0; - } - - if (i == 4) { - short1 = 90; - } - - if (i == 5) { - short1 = -90; - } - - if (i == 2 && present.adjacentChestXPos != null) { - GL11.glTranslatef(1.0F, 0.0F, 0.0F); - } - - if (i == 5 && present.adjacentChestZPos != null) { - GL11.glTranslatef(0.0F, 0.0F, -1.0F); - } - - GL11.glRotatef(short1, 0.0F, 1.0F, 0.0F); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - float f1 = present.prevLidAngle + (present.lidAngle - present.prevLidAngle) * partialTicks; - float f2; - - if (present.adjacentChestZNeg != null) { - f2 = present.adjacentChestZNeg.prevLidAngle + (present.adjacentChestZNeg.lidAngle - present.adjacentChestZNeg.prevLidAngle) * partialTicks; - - if (f2 > f1) { - f1 = f2; - } - } - - if (present.adjacentChestXNeg != null) { - f2 = present.adjacentChestXNeg.prevLidAngle + (present.adjacentChestXNeg.lidAngle - present.adjacentChestXNeg.prevLidAngle) * partialTicks; - - if (f2 > f1) { - f1 = f2; - } - } - - f1 = 1.0F - f1; - f1 = 1.0F - f1 * f1 * f1; - smallOrLargeChest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F); - smallOrLargeChest.renderAll(); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - GL11.glPopMatrix(); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPopMatrix(); + } + + private void bindTexture(TileEntityPresent present) { + int idx = present.getType() + (present.isConnected() ? 0 : 16); + ResourceLocation rl = textureCache.get(idx); + if (rl == null) { + String res = ChiselBlocks.present.getModelTexture(present.getType()); + res += present.isConnected() ? "_double.png" : ".png"; + rl = new ResourceLocation("chisel", res); + textureCache.put(idx, rl); } + bindTexture(rl); } @Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTicks) { this.renderTileEntityAt((TileEntityPresent) tileEntity, x, y, z, partialTicks); } + + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return type != ItemRenderType.FIRST_PERSON_MAP; + } + + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return true; + } + + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(Chisel.MOD_ID, ChiselBlocks.present.getModelTexture(item.getItemDamage()) + ".png")); + switch (type) { + case ENTITY: + renderBlock(0.0F, 1.0F, 0.0F); + break; + case EQUIPPED: + renderBlock(0.5F, 1.5F, 0.5F); + break; + case EQUIPPED_FIRST_PERSON: + renderBlock(0.5F, 1.0F, 0.5F); + break; + case INVENTORY: + renderInventory(1.0F, 1.0F, 1.0F); + break; + default: + break; + } + } + + private void renderBlock(float x, float y, float z) { + GL11.glPushMatrix(); + GL11.glTranslatef(x, y, z); + GL11.glScaled(-1, -1, 1); + smallChest.renderAll(); + GL11.glPopMatrix(); + } + + private void renderInventory(float x, float y, float z) { + GL11.glPushMatrix(); + GL11.glTranslatef(x, y, z); + GL11.glRotatef(180F, 1F, 0, 0); + GL11.glRotatef(-90F, 0, 1F, 0); + GL11.glScalef(1.0F, 1.0F, 1.0F); + smallChest.renderAll(); + GL11.glPopMatrix(); + } } diff --git a/src/main/java/com/cricketcraft/chisel/init/ChiselBlocks.java b/src/main/java/com/cricketcraft/chisel/init/ChiselBlocks.java index 545aa927..b61cd287 100644 --- a/src/main/java/com/cricketcraft/chisel/init/ChiselBlocks.java +++ b/src/main/java/com/cricketcraft/chisel/init/ChiselBlocks.java @@ -113,6 +113,8 @@ public final class ChiselBlocks { public static final BlockCarvable bloodRune = null; public static final BlockCarvable bloodBrick = null; + public static final BlockPresent present = null; + // Arrays can't be final because of how @ObjectHolder works public static BlockCarvableStairs[] marbleStairs = new BlockCarvableStairs[8]; public static BlockCarvableStairs[] limestoneStairs = new BlockCarvableStairs[8]; @@ -123,8 +125,6 @@ public final class ChiselBlocks { public static BlockCarvable[] planks = new BlockCarvable[6]; - public static BlockPresent[] present = new BlockPresent[16]; - public static BlockCarvablePumpkin[] pumpkin = new BlockCarvablePumpkin[16]; public static BlockCarvablePumpkin[] jackolantern = new BlockCarvablePumpkin[16]; diff --git a/src/main/java/com/cricketcraft/chisel/inventory/InventoryLargePresent.java b/src/main/java/com/cricketcraft/chisel/inventory/InventoryLargePresent.java deleted file mode 100644 index b8c85c79..00000000 --- a/src/main/java/com/cricketcraft/chisel/inventory/InventoryLargePresent.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.cricketcraft.chisel.inventory; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; - -public class InventoryLargePresent implements IInventory { - - private String name; - private IInventory upper, lower; - - public InventoryLargePresent(String name, IInventory upper, IInventory lower) { - this.name = name; - - if (upper == null) { - upper = lower; - } - - if (lower == null) { - lower = upper; - } - - this.upper = upper; - this.lower = lower; - } - - @Override - public int getSizeInventory() { - return upper.getSizeInventory() + lower.getSizeInventory(); - } - - public boolean isPartOfLargePresent(IInventory inventory) { - return upper == inventory || lower == inventory; - } - - @Override - public ItemStack getStackInSlot(int slot) { - return slot >= upper.getSizeInventory() ? lower.getStackInSlot(slot - upper.getSizeInventory()) : upper.getStackInSlot(slot); - } - - @Override - public ItemStack decrStackSize(int slot, int size) { - return slot >= upper.getSizeInventory() ? lower.getStackInSlot(slot - upper.getSizeInventory()) : upper.getStackInSlot(slot); - } - - @Override - public ItemStack getStackInSlotOnClosing(int slot) { - return slot >= upper.getSizeInventory() ? lower.getStackInSlotOnClosing(slot - upper.getSizeInventory()) : upper.getStackInSlotOnClosing(slot); - } - - @Override - public void setInventorySlotContents(int slot, ItemStack stack) { - if (slot >= upper.getSizeInventory()) { - lower.setInventorySlotContents(slot - upper.getSizeInventory(), stack); - } else { - upper.setInventorySlotContents(slot, stack); - } - } - - @Override - public String getInventoryName() { - return upper.hasCustomInventoryName() ? upper.getInventoryName() : (lower.hasCustomInventoryName() ? lower.getInventoryName() : name); - } - - @Override - public boolean hasCustomInventoryName() { - return upper.hasCustomInventoryName() || lower.hasCustomInventoryName(); - } - - @Override - public int getInventoryStackLimit() { - return upper.getInventoryStackLimit(); - } - - @Override - public void markDirty() { - upper.markDirty(); - lower.markDirty(); - } - - @Override - public boolean isUseableByPlayer(EntityPlayer player) { - return upper.isUseableByPlayer(player) && lower.isUseableByPlayer(player); - } - - @Override - public void openInventory() { - upper.openInventory(); - lower.openInventory(); - } - - @Override - public void closeInventory() { - upper.closeInventory(); - ; - lower.closeInventory(); - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack stack) { - return true; - } -} diff --git a/src/main/java/com/cricketcraft/chisel/network/PacketHandler.java b/src/main/java/com/cricketcraft/chisel/network/PacketHandler.java index 44e742a3..290e2cd9 100644 --- a/src/main/java/com/cricketcraft/chisel/network/PacketHandler.java +++ b/src/main/java/com/cricketcraft/chisel/network/PacketHandler.java @@ -4,6 +4,7 @@ import com.cricketcraft.chisel.Chisel; import com.cricketcraft.chisel.network.message.MessageAutoChisel; import com.cricketcraft.chisel.network.message.MessageChiselMode; import com.cricketcraft.chisel.network.message.MessageChiselSound; +import com.cricketcraft.chisel.network.message.MessagePresentConnect; import com.cricketcraft.chisel.network.message.MessageSlotUpdate; import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; @@ -20,5 +21,6 @@ public class PacketHandler { INSTANCE.registerMessage(MessageSlotUpdate.Handler.class, MessageSlotUpdate.class, id++, Side.CLIENT); INSTANCE.registerMessage(MessageAutoChisel.Handler.class, MessageAutoChisel.class, id++, Side.CLIENT); INSTANCE.registerMessage(MessageChiselMode.Handler.class, MessageChiselMode.class, id++, Side.SERVER); + INSTANCE.registerMessage(MessagePresentConnect.Handler.class, MessagePresentConnect.class, id++, Side.CLIENT); } } \ No newline at end of file diff --git a/src/main/java/com/cricketcraft/chisel/network/message/MessagePresentConnect.java b/src/main/java/com/cricketcraft/chisel/network/message/MessagePresentConnect.java new file mode 100644 index 00000000..b0f94b76 --- /dev/null +++ b/src/main/java/com/cricketcraft/chisel/network/message/MessagePresentConnect.java @@ -0,0 +1,60 @@ +package com.cricketcraft.chisel.network.message; + +import io.netty.buffer.ByteBuf; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; + +import com.cricketcraft.chisel.block.tileentity.TileEntityPresent; +import com.cricketcraft.chisel.network.message.base.MessageCoords; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; + + +public class MessagePresentConnect extends MessageCoords { + + private ForgeDirection dir; + private boolean connect; + + public MessagePresentConnect() { + super(); + } + + public MessagePresentConnect(TileEntityPresent present, ForgeDirection dir, boolean connecting) { + super(present); + this.dir = dir; + this.connect = connecting; + } + + @Override + public void toBytes(ByteBuf buf) { + super.toBytes(buf); + buf.writeInt(dir.ordinal()); + buf.writeBoolean(connect); + } + + @Override + public void fromBytes(ByteBuf buf) { + super.fromBytes(buf); + dir = ForgeDirection.values()[buf.readInt()]; + connect = buf.readBoolean(); + } + + public static class Handler implements IMessageHandler { + + @Override + public IMessage onMessage(MessagePresentConnect message, MessageContext ctx) { + TileEntity te = message.getTileEntity(ctx); + if (te instanceof TileEntityPresent) { + if (message.connect) { + ((TileEntityPresent) te).connectTo(message.dir); + } else { + ((TileEntityPresent) te).disconnect(); + } + } + return null; + } + } + +} diff --git a/src/main/java/com/cricketcraft/chisel/proxy/ClientProxy.java b/src/main/java/com/cricketcraft/chisel/proxy/ClientProxy.java index 9a57427d..4b032ec4 100644 --- a/src/main/java/com/cricketcraft/chisel/proxy/ClientProxy.java +++ b/src/main/java/com/cricketcraft/chisel/proxy/ClientProxy.java @@ -23,7 +23,6 @@ import com.cricketcraft.chisel.client.render.BlockSnakeStoneRenderer; import com.cricketcraft.chisel.client.render.BlockTexturedOreRenderer; import com.cricketcraft.chisel.client.render.RenderStandardBlockNoSunlight; import com.cricketcraft.chisel.client.render.item.ItemChiselRenderer; -import com.cricketcraft.chisel.client.render.item.ItemPresentRenderer; import com.cricketcraft.chisel.client.render.tile.RenderAutoChisel; import com.cricketcraft.chisel.client.render.tile.RenderPresent; import com.cricketcraft.chisel.entity.EntityBallOMoss; @@ -65,11 +64,9 @@ public class ClientProxy extends CommonProxy { MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ChiselBlocks.autoChisel), rac); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAutoChisel.class, rac); - ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPresent.class, new RenderPresent()); - - for (int x = 0; x < 16; x++) { - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ChiselBlocks.present[x]), new ItemPresentRenderer(x)); - } + RenderPresent rp = new RenderPresent(); + MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ChiselBlocks.present), rp); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPresent.class, rp); RenderingRegistry.registerEntityRenderingHandler(EntityCloudInABottle.class, new RenderSnowball(ChiselItems.cloudinabottle)); RenderingRegistry.registerEntityRenderingHandler(EntityBallOMoss.class, new RenderSnowball(ChiselItems.ballomoss)); diff --git a/src/main/java/com/cricketcraft/chisel/proxy/CommonProxy.java b/src/main/java/com/cricketcraft/chisel/proxy/CommonProxy.java index aa2a8bb9..620ac259 100644 --- a/src/main/java/com/cricketcraft/chisel/proxy/CommonProxy.java +++ b/src/main/java/com/cricketcraft/chisel/proxy/CommonProxy.java @@ -12,7 +12,7 @@ public class CommonProxy { public void registerTileEntities() { GameRegistry.registerTileEntity(TileEntityAutoChisel.class, "autoChisel"); - GameRegistry.registerTileEntity(TileEntityPresent.class, "tile.present.present"); + GameRegistry.registerTileEntity(TileEntityPresent.class, "tile.chisel.present"); } public void preInit() {