diff --git a/build.gradle b/build.gradle index 77aeaa43..391da333 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,27 @@ artifacts { archives apiJar } +publishing { + tasks.publish.dependsOn 'build' + publications { + mavenJava(MavenPublication) { + artifact jar + artifact deobfJar + artifact sourcesJar + artifact apiJar + } + } + + repositories { + String prop = dev ? "chisel_dev_mavendir" : "chisel_mavendir" + if (project.hasProperty(prop)) { + maven { url project.getProperty(prop) } + } + } +} + +println('Changelog:\n' + getChangelogText()) + String getChangelogText() { def changelogFile = new File('changelog') String str = '' @@ -119,7 +140,9 @@ 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 { done = true @@ -139,5 +162,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 } diff --git a/changelog b/changelog index 89961bbe..ff9b3a09 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,46 @@ +2.3.5: +Fixes +- Fix crash with copper block feature + +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 +- 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 +- #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 + +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 + +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 +207,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..9357a0cd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -mod_version=2.2.2 +mod_version=2.3.5 minecraft_version=1.7.10 forge_version=10.13.2.1277 @@ -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/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 diff --git a/src/main/java/com/cricketcraft/chisel/Chisel.java b/src/main/java/com/cricketcraft/chisel/Chisel.java index 0b3ec73e..0aad18e9 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"; @@ -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(); @@ -128,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); @@ -141,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 ef851980..97702a42 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; @@ -61,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; @@ -68,6 +73,7 @@ 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; @@ -119,7 +125,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"); } @@ -131,18 +138,23 @@ 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"); } - antiBlock.carverHelper.registerAll(antiBlock, "antiBlock"); - Carving.chisel.registerOre("antiBlock", "antiBlock"); + antiBlock.carverHelper.registerBlock(antiBlock, "antiBlock"); + OreDictionary.registerOre("antiBlock", antiBlock); } @Override void addRecipes() { - // TODO Add a recipe + 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 @@ -281,8 +293,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"); } @@ -513,6 +524,16 @@ public enum Features { } }, + COPPER + { + + @Override + void addBlocks() { + Carving.chisel.addGroup(new CarvingGroup("copperblock")); + Carving.chisel.registerOre("copperblock", "blockCopper"); + } + }, + DIAMOND_BLOCK { @Override @@ -544,7 +565,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"); } @@ -694,8 +716,9 @@ 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"); @@ -703,6 +726,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), "SBS", "BGB", "SBS", 'S', "stone", 'G', "dustRedstone", 'B', new ItemStack(Blocks.stonebrick, 1))); + } }, GLASS { @@ -874,7 +902,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.2.desc", 2, "granite/granitePillar"); granite.carverHelper.registerAll(granite, "granite"); Carving.chisel.registerOre("granite", "granite"); } @@ -1100,7 +1129,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)); @@ -1192,6 +1221,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); @@ -1266,7 +1311,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"); @@ -1344,7 +1389,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"); @@ -1463,7 +1508,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); } @@ -1481,7 +1526,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"); @@ -1637,7 +1683,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"); @@ -1651,11 +1697,27 @@ 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 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", ('p'), ChiselBlocks.paperwall)); } }, @@ -1663,17 +1725,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.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, 1, meta), new ItemStack(Blocks.chest, 1), dyeOres[meta])); } @Override @@ -1724,6 +1786,19 @@ public enum Features { */ 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 @@ -1883,7 +1958,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)); @@ -1928,7 +2004,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"); } @@ -1981,7 +2057,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"); } }, @@ -2102,7 +2179,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])); } }, @@ -2331,6 +2408,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"); } @@ -2431,30 +2509,51 @@ 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() { + 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()) { @@ -2466,13 +2565,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; } } @@ -2480,8 +2593,10 @@ public enum Features { } static void preInit() { + Chisel.logger.info("Starting pre-init..."); loadBlocks(); loadItems(); + Chisel.logger.info("Pre-init finished."); } private Features parent; @@ -2518,7 +2633,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/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/ChiselMode.java b/src/main/java/com/cricketcraft/chisel/api/ChiselMode.java deleted file mode 100644 index 8686c0d1..00000000 --- a/src/main/java/com/cricketcraft/chisel/api/ChiselMode.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.cricketcraft.chisel.api; - -public enum ChiselMode { - - SINGLE, CIRCLETHREE, COLLUM, SIDEWAYS -} diff --git a/src/main/java/com/cricketcraft/chisel/api/IAdvancedChisel.java b/src/main/java/com/cricketcraft/chisel/api/IAdvancedChisel.java new file mode 100644 index 00000000..6a01ed97 --- /dev/null +++ b/src/main/java/com/cricketcraft/chisel/api/IAdvancedChisel.java @@ -0,0 +1,35 @@ +package com.cricketcraft.chisel.api; + +import com.cricketcraft.chisel.api.carving.IChiselMode; + +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/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/api/IChiselItem.java b/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java index 72e6fca9..43812d82 100644 --- a/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java +++ b/src/main/java/com/cricketcraft/chisel/api/IChiselItem.java @@ -2,14 +2,15 @@ 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; +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 @@ -29,16 +30,13 @@ public interface IChiselItem extends IChiselMode { * * @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 chisel should be damaged. False otherwise. */ - void onChisel(World world, IInventory inv, int slot, ItemStack chisel, ItemStack 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. @@ -47,23 +45,21 @@ public interface IChiselItem extends IChiselMode { * * @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. * * @param world * World object + * @param player + * {@link EntityPlayer The player} holding the chisel. * @param x * X coord of the block being chiseled * @param y @@ -76,5 +72,14 @@ public interface IChiselItem extends IChiselMode { * 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. + * + * @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/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); -} 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..ffe97843 100644 --- a/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingGroup.java +++ b/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingGroup.java @@ -57,10 +57,18 @@ 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 */ void addVariation(ICarvingVariation variation); + + /** + * Removes a variation to this group. Do not call this from external code, as it will fail to remove the inverse lookup from the registry. + * + * @param variation + * An {@link ICarvingVariation} to add to this group + */ + boolean removeVariation(ICarvingVariation variation); } 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..1987f378 --- /dev/null +++ b/src/main/java/com/cricketcraft/chisel/api/carving/ICarvingRegistry.java @@ -0,0 +1,204 @@ +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; +import net.minecraft.world.World; + +/** + * Represents a registry of {@link ICarvingGroup}s + *

+ * To obtain chisel's instance of this class, use {@link CarvingUtils#getChiselRegistry()} + */ +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); + + /** + * 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); + + /** + * 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); +} 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/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/TileEntityAutoChisel.java b/src/main/java/com/cricketcraft/chisel/block/tileentity/TileEntityAutoChisel.java index 11a14ec5..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; @@ -21,6 +21,7 @@ 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; @@ -58,7 +59,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; @@ -177,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; @@ -207,9 +208,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) { - ((IChiselItem) inventory[CHISEL].getItem()).onChisel(worldObj, this, CHISEL, inventory[CHISEL], inventory[TARGET]); - PacketHandler.INSTANCE.sendToDimension(new MessageAutoChisel(this, chiseled, true), worldObj.provider.dimensionId); + boolean breakChisel = false; + 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); + breakChisel = true; + } + } + 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) { @@ -269,7 +280,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(); } @@ -318,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: @@ -361,7 +372,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; } } @@ -401,14 +412,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/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 7b37b1cc..81db120f 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; @@ -258,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) { @@ -270,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/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 6caafb76..03d889cb 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/Carving.java +++ b/src/main/java/com/cricketcraft/chisel/carving/Carving.java @@ -12,19 +12,34 @@ 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(); - public static final Carving chisel = new Carving(); + public static final ICarvingRegistry chisel = new Carving(); public static final Carving needle = new Carving(); private Carving() { } - public List getVariations(Block block, int metadata) { + @Override + 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; + } + + @Override + public List getGroupVariations(Block block, int metadata) { ICarvingGroup group = getGroup(block, metadata); if (group == null) return null; @@ -32,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; @@ -40,12 +56,24 @@ 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(); + 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; @@ -82,8 +110,9 @@ public class Carving { return items; } + @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)); @@ -96,17 +125,44 @@ public class Carving { return groups.getGroup(block, metadata); } + @Override public ICarvingGroup getGroup(String name) { return groups.getGroupByName(name); } + @Override + public ICarvingGroup removeGroup(String groupName) { + 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) { + 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); } + @Override 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); @@ -118,10 +174,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) { @@ -131,6 +189,7 @@ public class Carving { } } + @Override public void setVariationSound(String name, String sound) { ICarvingGroup group = groups.getGroupByName(name); if (group != null) { @@ -140,16 +199,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 08e64389..6a1286d5 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 @@ -37,6 +36,17 @@ public class CarvingGroup implements ICarvingGroup { } }); } + + @Override + public boolean removeVariation(ICarvingVariation variation) { + ICarvingVariation toRemove = null; + for (ICarvingVariation v : variations) { + if (v.getBlock() == variation.getBlock() && v.getBlockMeta() == variation.getBlockMeta()) { + toRemove = v; + } + } + return toRemove == null ? false : variations.remove(toRemove); + } @Override public String getName() { diff --git a/src/main/java/com/cricketcraft/chisel/carving/GroupList.java b/src/main/java/com/cricketcraft/chisel/carving/GroupList.java index a33db007..f4f9560d 100644 --- a/src/main/java/com/cricketcraft/chisel/carving/GroupList.java +++ b/src/main/java/com/cricketcraft/chisel/carving/GroupList.java @@ -3,6 +3,7 @@ package com.cricketcraft.chisel.carving; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Set; import net.minecraft.block.Block; @@ -11,6 +12,7 @@ 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.Lists; import com.google.common.collect.Maps; public class GroupList implements Set { @@ -129,6 +131,15 @@ public class GroupList implements Set { @Override public boolean remove(Object o) { if (o instanceof ICarvingGroup) { + List toRemove = Lists.newArrayList(); + for (VariationWrapper v : lookup.keySet()) { + if (lookup.get(v).getName().equals(((ICarvingGroup) o).getName())) { + toRemove.add(v); + } + } + for (VariationWrapper v : toRemove) { + lookup.remove(v); + } return groups.remove(((ICarvingGroup) o).getName()) != null; } return false; @@ -205,6 +216,28 @@ 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).getName().equals(g.getName())) && v.equals(new VariationWrapper(new VariationKey(block, metadata)))) { + lookup.get(v).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/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); } 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 38353a33..58c8074d 100644 --- a/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java +++ b/src/main/java/com/cricketcraft/chisel/client/gui/GuiChisel.java @@ -1,5 +1,6 @@ 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; @@ -8,15 +9,23 @@ 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.IChiselMode; 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; import com.cricketcraft.chisel.utils.GeneralClient; public class GuiChisel extends GuiContainer { public EntityPlayer player; public ContainerChisel container; + private IChiselMode currentMode; public GuiChisel(InventoryPlayer iinventory, InventoryChiselSelection menu) { super(new ContainerChisel(iinventory, menu)); @@ -33,12 +42,42 @@ public class GuiChisel extends GuiContainer { inventorySlots.onContainerClosed(player); } + @SuppressWarnings("unchecked") + @Override + public void initGui() { + super.initGui(); + currentMode = General.getChiselMode(container.chisel); + + 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); + + if (showMode()) { + line = I18n.format(this.container.inventory.getInventoryName() + ".mode"); + fontRendererObj.drawString(line, fontRendererObj.getStringWidth(line) / 2 + 6, 85, 0x404040); + } } @Override @@ -56,13 +95,29 @@ 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) { + 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); + } + @Override protected void func_146977_a(Slot slot) { if (slot instanceof SlotChiselInput) { 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: 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)); 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); 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); 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/RenderAutoChisel.java b/src/main/java/com/cricketcraft/chisel/client/render/tile/RenderAutoChisel.java index ef65c41b..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)); + } } } } @@ -186,9 +190,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/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/config/Configurations.java b/src/main/java/com/cricketcraft/chisel/config/Configurations.java index dfb63382..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; @@ -39,11 +40,14 @@ public class Configurations { public static int ironChiselMaxDamage; 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; public static int roadLineToolLevel; - + public static boolean refreshConfig() { String category; @@ -59,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"; @@ -78,19 +83,23 @@ 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(); + 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"; 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(); } @@ -101,8 +110,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]; diff --git a/src/main/java/com/cricketcraft/chisel/init/ChiselBlocks.java b/src/main/java/com/cricketcraft/chisel/init/ChiselBlocks.java index 3dc56a73..b61cd287 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,9 @@ 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]; @@ -122,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/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/inventory/ContainerChisel.java b/src/main/java/com/cricketcraft/chisel/inventory/ContainerChisel.java index e837fdc2..f6962945 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; @@ -128,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) diff --git a/src/main/java/com/cricketcraft/chisel/inventory/InventoryChiselSelection.java b/src/main/java/com/cricketcraft/chisel/inventory/InventoryChiselSelection.java index ffc34e94..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; @@ -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,10 +121,10 @@ 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); + List list = container.carving.getItemsForChiseling(chiseledItem); activeVariations = 0; while (activeVariations < normalSlots && activeVariations < list.size()) { 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/inventory/SlotChiselSelection.java b/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java index 9c2a53db..2170a7f3 100644 --- a/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java +++ b/src/main/java/com/cricketcraft/chisel/inventory/SlotChiselSelection.java @@ -4,8 +4,12 @@ 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.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 { @@ -55,8 +59,18 @@ public class SlotChiselSelection extends Slot { selInventory.updateItems(); - ((IChiselItem)container.chisel.getItem()).onChisel(player.worldObj, player.inventory, player.inventory.currentItem, container.chisel, 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; + } + } + 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 19fe29f0..7b116582 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.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.api.carving.IChiselMode; 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() { } @@ -50,21 +50,35 @@ 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; + if (group == null) { + return; + } + + 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[] {}); + ICarvingVariation[] variations = list.toArray(new ICarvingVariation[] {}); - 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]; 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 { @@ -73,17 +87,24 @@ 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; } } 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 && chisel.canOpenGui(event.world, event.entityPlayer, held)) { event.entityPlayer.openGui(Chisel.instance, 0, event.world, 0, 0, 0); } @@ -91,18 +112,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/ChiselMode.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselMode.java new file mode 100644 index 00000000..0d2446c5 --- /dev/null +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ChiselMode.java @@ -0,0 +1,125 @@ +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; + +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 implements IChiselMode { + + 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); + 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); + } + } + } + } + }, + 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); + } + } + } + } + }; + + /** + * 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); + ItemStack held = player.getCurrentEquippedItem(); + 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) + } + + 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.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 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/item/chisel/ItemChisel.java b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java index 2eed31dc..4d9e68aa 100644 --- a/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java +++ b/src/main/java/com/cricketcraft/chisel/item/chisel/ItemChisel.java @@ -3,35 +3,41 @@ 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.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.util.MathHelper; -import net.minecraft.util.StatCollector; 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.ICarvingRegistry; +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; +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; } } - public static Carving carving = Carving.chisel; + public static ICarvingRegistry carving = Carving.chisel; private ChiselType type; @@ -39,7 +45,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); } @@ -60,16 +65,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); } } @@ -78,38 +86,42 @@ public class ItemChisel extends Item implements IChiselItem { return true; } + @SuppressWarnings("rawtypes") @Override - public ChiselMode getChiselMode(ItemStack itemStack) { - return ChiselMode.SINGLE; + 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; } @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; } @Override - public void onChisel(World world, IInventory inv, int slot, ItemStack chisel, ItemStack target) { - if (Configurations.allowChiselDamage) { - chisel.setItemDamage(chisel.getItemDamage() + 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); - } + public boolean onChisel(World world, ItemStack chisel, ICarvingVariation target) { + return Configurations.allowChiselDamage; } @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; } + + @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/PacketHandler.java b/src/main/java/com/cricketcraft/chisel/network/PacketHandler.java index ffbb42de..290e2cd9 100644 --- a/src/main/java/com/cricketcraft/chisel/network/PacketHandler.java +++ b/src/main/java/com/cricketcraft/chisel/network/PacketHandler.java @@ -2,7 +2,9 @@ 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.MessagePresentConnect; import com.cricketcraft.chisel.network.message.MessageSlotUpdate; import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; @@ -18,5 +20,7 @@ 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); + 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/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/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..855c41a7 --- /dev/null +++ b/src/main/java/com/cricketcraft/chisel/network/message/MessageChiselMode.java @@ -0,0 +1,51 @@ +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.IChiselMode; +import com.cricketcraft.chisel.item.chisel.ChiselMode; +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(IChiselMode iChiselMode) { + this.mode = iChiselMode.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) { + 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/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; } } 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() { diff --git a/src/main/java/com/cricketcraft/chisel/utils/General.java b/src/main/java/com/cricketcraft/chisel/utils/General.java index 572c14fe..b2a5eab8 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,13 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; +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; +import com.cricketcraft.chisel.carving.CarvingVariation; +import com.cricketcraft.chisel.item.chisel.ChiselMode; + public class General { public static Random rand = new Random(); @@ -98,8 +106,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 +123,29 @@ public class General { stack.setTagCompound(new NBTTagCompound()); } } + + private static final String MODE_KEY = "chiselMode"; + 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, IChiselMode mode) { + initTag(chisel); + chisel.stackTagCompound.setString(MODE_KEY, mode.name()); + } + + public static ICarvingVariation getVariation(ItemStack stack) { + ICarvingVariation v = Carving.chisel.getVariation(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage()); + return v == null ? new CarvingVariation(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 99) : v; + } } 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 97b30bd6..7d40c6ac 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. @@ -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 @@ -108,6 +111,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 @@ -246,6 +250,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 @@ -760,22 +765,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 @@ -824,22 +819,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 @@ -1155,6 +1140,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 @@ -1234,3 +1220,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 diff --git a/src/main/resources/assets/chisel/lang/ru_RU.lang b/src/main/resources/assets/chisel/lang/ru_RU.lang index 71e12246..b9930188 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.gui=ПКМ, чтобы открыть интерфейс +item.chisel.chisel.desc.lc1=ЛКМ, чтобы менять блоки прямо в мире +item.chisel.chisel.desc.lc2=Может ориентироваться на блок в инвентаре +item.chisel.chisel.desc.modes=Обладает разными режимами для обработки. + +item.chisel.chisel_diamond.name=Алмазная стамеска + 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,24 @@ 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=В ходе криогенной заморозки +tile.warningSign.14.desc=Необходим кислород + #Energised Void Stone Blocks tile.voidstone2.name=Заряженный пустотный камень tile.voidstone2.0.desc=Необработанный заряженный пустотный камень @@ -92,7 +126,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 +137,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 +177,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 +239,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 +572,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=Железный блок @@ -724,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=Ледяные ступеньки @@ -788,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=Ступеньки из плотного льда @@ -1119,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=Скрещенная бумажная стена @@ -1186,43 +1202,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 +1213,9 @@ itemGroup.tabChisel=Chisel: Предметы #Container container.chisel=Стамеска container.chisel.title=Обработка блоков -container.chisel.titleShort=Обработка \ No newline at end of file +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/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 00000000..a77809c0 Binary files /dev/null and b/src/main/resources/assets/chisel/textures/blocks/andesite/andesitePolished.png differ diff --git a/src/main/resources/assets/chisel/textures/blocks/andesite/polishedAndesite.png b/src/main/resources/assets/chisel/textures/blocks/andesite/polishedAndesite.png deleted file mode 100644 index ef62cfcc..00000000 Binary files a/src/main/resources/assets/chisel/textures/blocks/andesite/polishedAndesite.png and /dev/null differ 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 5f62bb5f..93d3c95a 100644 Binary files a/src/main/resources/assets/chisel/textures/blocks/brickCustom/aged-v4.png and b/src/main/resources/assets/chisel/textures/blocks/brickCustom/aged-v4.png differ 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 00000000..217f263e Binary files /dev/null and b/src/main/resources/assets/chisel/textures/blocks/brickCustom/yellow.png differ 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 c833ac92..711c838b 100644 Binary files a/src/main/resources/assets/chisel/textures/blocks/diorite/diorite.png and b/src/main/resources/assets/chisel/textures/blocks/diorite/diorite.png differ 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 00000000..8b4f8e35 Binary files /dev/null and b/src/main/resources/assets/chisel/textures/blocks/diorite/dioritePolished.png differ 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 43f3ceb5..00000000 Binary files a/src/main/resources/assets/chisel/textures/blocks/diorite/polishedDiorite.png and /dev/null differ 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 6db8b21a..07c7af85 100644 Binary files a/src/main/resources/assets/chisel/textures/blocks/granite/granite.png and b/src/main/resources/assets/chisel/textures/blocks/granite/granite.png differ diff --git a/src/main/resources/assets/chisel/textures/blocks/granite/granitePillarSide.png b/src/main/resources/assets/chisel/textures/blocks/granite/granitePillar-side.png similarity index 100% rename from src/main/resources/assets/chisel/textures/blocks/granite/granitePillarSide.png rename to src/main/resources/assets/chisel/textures/blocks/granite/granitePillar-side.png diff --git a/src/main/resources/assets/chisel/textures/blocks/granite/granitePillarTop.png b/src/main/resources/assets/chisel/textures/blocks/granite/granitePillar-top.png similarity index 100% rename from src/main/resources/assets/chisel/textures/blocks/granite/granitePillarTop.png rename to src/main/resources/assets/chisel/textures/blocks/granite/granitePillar-top.png diff --git a/src/main/resources/assets/chisel/textures/blocks/granite/granitePolished.png b/src/main/resources/assets/chisel/textures/blocks/granite/granitePolished.png new file mode 100644 index 00000000..d5b37f1b Binary files /dev/null and b/src/main/resources/assets/chisel/textures/blocks/granite/granitePolished.png differ diff --git a/src/main/resources/assets/chisel/textures/blocks/granite/polishedGranite.png b/src/main/resources/assets/chisel/textures/blocks/granite/polishedGranite.png deleted file mode 100644 index 078539b7..00000000 Binary files a/src/main/resources/assets/chisel/textures/blocks/granite/polishedGranite.png and /dev/null differ 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 00000000..27f6e41e Binary files /dev/null and b/src/main/resources/assets/chisel/textures/blocks/warning/oxygen.png differ diff --git a/src/main/resources/assets/chisel/textures/chisel2Gui.png b/src/main/resources/assets/chisel/textures/chisel2Gui.png index ef0f5852..b21ae9dd 100644 Binary files a/src/main/resources/assets/chisel/textures/chisel2Gui.png and b/src/main/resources/assets/chisel/textures/chisel2Gui.png differ 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