From 3c05e7f9f64c4386979d604a4668167b12814945 Mon Sep 17 00:00:00 2001 From: Matt Caughey Date: Wed, 6 Nov 2013 10:52:04 -0500 Subject: [PATCH] Added a root plant --- common/biomesoplenty/api/BlockReferences.java | 1 + .../biomesoplenty/biomes/BiomeDecoratorBOP.java | 13 +++++++++++++ .../biomes/BiomeGenOriginValley.java | 1 + common/biomesoplenty/blocks/BlockBOPPlant.java | 10 +++++++++- .../blocks/renderers/PlantsRenderer.java | 2 ++ .../biomesoplenty/itemblocks/ItemBlockPlant.java | 7 +++++-- resources/assets/biomesoplenty/lang/en_US.lang | 1 + .../biomesoplenty/textures/blocks/item_root.png | Bin 0 -> 645 bytes .../assets/biomesoplenty/textures/blocks/root.png | Bin 0 -> 589 bytes 9 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 resources/assets/biomesoplenty/textures/blocks/item_root.png create mode 100644 resources/assets/biomesoplenty/textures/blocks/root.png diff --git a/common/biomesoplenty/api/BlockReferences.java b/common/biomesoplenty/api/BlockReferences.java index dbdbcf6bd..9a3c96227 100644 --- a/common/biomesoplenty/api/BlockReferences.java +++ b/common/biomesoplenty/api/BlockReferences.java @@ -173,6 +173,7 @@ public class BlockReferences { tinyCactus (Blocks.plants, 12), witherwart (Blocks.plants, 13), reed (Blocks.plants, 14), + root (Blocks.plants, 15), treeMoss (Blocks.treeMoss, 0), moss (Blocks.moss, 0), diff --git a/common/biomesoplenty/biomes/BiomeDecoratorBOP.java b/common/biomesoplenty/biomes/BiomeDecoratorBOP.java index 172ef5120..8583ccbba 100644 --- a/common/biomesoplenty/biomes/BiomeDecoratorBOP.java +++ b/common/biomesoplenty/biomes/BiomeDecoratorBOP.java @@ -52,6 +52,7 @@ import biomesoplenty.worldgen.WorldGenBOPBush; import biomesoplenty.worldgen.WorldGenBOPDarkFlowers; import biomesoplenty.worldgen.WorldGenBOPFlowers; import biomesoplenty.worldgen.WorldGenBOPPumpkin; +import biomesoplenty.worldgen.WorldGenBOPTallGrass; import biomesoplenty.worldgen.WorldGenBadlands; import biomesoplenty.worldgen.WorldGenBadlands2; import biomesoplenty.worldgen.WorldGenBadlands3; @@ -241,6 +242,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator public WorldGenerator redwoodShrubGen; public WorldGenerator koruGen; public WorldGenerator waspHiveGen; + public WorldGenerator rootGen; public WorldGenerator boneSpineGen; public WorldGenerator boneSpine2Gen; @@ -341,6 +343,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator public int redwoodShrubsPerChunk; public int koruPerChunk; public int waspHivesPerChunk; + public int rootsPerChunk; public int boneSpinesPerChunk; public int boneSpines2PerChunk; @@ -551,6 +554,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator waterReedGen = new WorldGenWaterReeds(); redwoodShrubGen = new WorldGenRedwoodShrub(0,0); koruGen = new WorldGenTallGrass(Blocks.foliage.get().blockID, 12); + rootGen = new WorldGenBOPTallGrass(Blocks.plants.get().blockID, 15); pitGen = new WorldGenPit(Blocks.ash.get().blockID); waterlilyPerChunk = 0; lilyflowersPerChunk = 0; @@ -646,6 +650,7 @@ public class BiomeDecoratorBOP extends BiomeDecorator redwoodShrubsPerChunk = 0; koruPerChunk = 0; waspHivesPerChunk = 0; + rootsPerChunk = 7; generateLakes = true; generateAsh = false; generateMycelium = false; @@ -1328,6 +1333,14 @@ public class BiomeDecoratorBOP extends BiomeDecorator koruGen.generate(currentWorld, randomGenerator, var3, var4, var5); } + for (var2 = 0; var2 < rootsPerChunk; ++var2) + { + var3 = chunk_X + randomGenerator.nextInt(16) + 8; + var4 = randomGenerator.nextInt(256); + var5 = chunk_Z + randomGenerator.nextInt(16) + 8; + rootGen.generate(currentWorld, randomGenerator, var3, var4, var5); + } + for (var2 = 0; var2 < waspHivesPerChunk; ++var2) { int var420 = randomGenerator.nextInt(4); diff --git a/common/biomesoplenty/biomes/BiomeGenOriginValley.java b/common/biomesoplenty/biomes/BiomeGenOriginValley.java index 1f4387f3d..277cd098b 100644 --- a/common/biomesoplenty/biomes/BiomeGenOriginValley.java +++ b/common/biomesoplenty/biomes/BiomeGenOriginValley.java @@ -25,6 +25,7 @@ public class BiomeGenOriginValley extends BiomeGenBase customBiomeDecorator.sandPerChunk = 0; customBiomeDecorator.sandPerChunk2 = 0; customBiomeDecorator.clayPerChunk = 0; + customBiomeDecorator.rootsPerChunk = -999; } /** diff --git a/common/biomesoplenty/blocks/BlockBOPPlant.java b/common/biomesoplenty/blocks/BlockBOPPlant.java index 01be06fd1..219efc371 100644 --- a/common/biomesoplenty/blocks/BlockBOPPlant.java +++ b/common/biomesoplenty/blocks/BlockBOPPlant.java @@ -30,7 +30,7 @@ import cpw.mods.fml.relauncher.SideOnly; public class BlockBOPPlant extends BlockFlower implements IShearable { - private static final String[] plants = new String[] {"deadgrass", "desertgrass", "desertsprouts", "dunegrass", "holytallgrass", "thorn", "barley", "cattail", "rivercane", "cattailtop", "cattailbottom", "wildcarrot", "cactus", "witherwart", "reed"}; + private static final String[] plants = new String[] {"deadgrass", "desertgrass", "desertsprouts", "dunegrass", "holytallgrass", "thorn", "barley", "cattail", "rivercane", "cattailtop", "cattailbottom", "wildcarrot", "cactus", "witherwart", "reed", "root"}; private Icon[] textures; public Icon reedbottom; @@ -150,6 +150,7 @@ public class BlockBOPPlant extends BlockFlower implements IShearable public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int side, ItemStack itemStack) { int id = world.getBlockId(x, y - 1, z); + int idRoot = world.getBlockId(x, y + 1, z); int meta = itemStack.getItemDamage(); if (itemStack.itemID == blockID) { @@ -192,6 +193,9 @@ public class BlockBOPPlant extends BlockFlower implements IShearable case 14: // Reed return id == Block.waterStill.blockID; + case 15: // Reed + return idRoot == Block.grass.blockID || idRoot == Block.dirt.blockID || idRoot == Block.tilledField.blockID || idRoot == Blocks.longGrass.get().blockID; + default: return id == Block.grass.blockID || id == Block.dirt.blockID || id == Block.tilledField.blockID; } @@ -212,6 +216,8 @@ public class BlockBOPPlant extends BlockFlower implements IShearable return this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z)); else if (meta == 8) return block == null || block.isBlockReplaceable(world, x, y, z); + else if (meta == 15) + return this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y + 1, z)); else return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) && this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z)); } @@ -219,6 +225,8 @@ public class BlockBOPPlant extends BlockFlower implements IShearable { if (meta == 5 || meta == 13) return this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z), world.getBlockMetadata(x, y, z)); + else if (meta == 15) + return this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y + 1, z), world.getBlockMetadata(x, y, z)); else return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) && this.canThisPlantGrowOnThisBlockID(world.getBlockId(x, y - 1, z), world.getBlockMetadata(x, y, z)); } diff --git a/common/biomesoplenty/blocks/renderers/PlantsRenderer.java b/common/biomesoplenty/blocks/renderers/PlantsRenderer.java index abd8abe8f..ca7baa88d 100644 --- a/common/biomesoplenty/blocks/renderers/PlantsRenderer.java +++ b/common/biomesoplenty/blocks/renderers/PlantsRenderer.java @@ -47,6 +47,8 @@ public class PlantsRenderer implements ISimpleBlockRenderingHandler { return renderCrossedSquares(block, x, y, z, renderer, false); } + if (meta == 15) + return renderer.renderCrossedSquares(block, x, y, z); } return true; } diff --git a/common/biomesoplenty/itemblocks/ItemBlockPlant.java b/common/biomesoplenty/itemblocks/ItemBlockPlant.java index dc0199ea6..dd152ef7e 100644 --- a/common/biomesoplenty/itemblocks/ItemBlockPlant.java +++ b/common/biomesoplenty/itemblocks/ItemBlockPlant.java @@ -16,7 +16,7 @@ import cpw.mods.fml.relauncher.SideOnly; public class ItemBlockPlant extends ItemBlock { - private static final String[] plants = new String[] {"deadgrass", "desertgrass", "desertsprouts", "dunegrass", "holytallgrass", "thorn", "barley", "cattail", "rivercane", "cattailtop", "cattailbottom", "wildcarrot", "cactus", "witherwart", "reed"}; + private static final String[] plants = new String[] {"deadgrass", "desertgrass", "desertsprouts", "dunegrass", "holytallgrass", "thorn", "barley", "cattail", "rivercane", "cattailtop", "cattailbottom", "wildcarrot", "cactus", "witherwart", "reed", "root"}; @SideOnly(Side.CLIENT) private Icon[] textures; @@ -37,13 +37,14 @@ public class ItemBlockPlant extends ItemBlock @SideOnly(Side.CLIENT) public void registerIcons(IconRegister iconRegister) { - textures = new Icon[5]; + textures = new Icon[6]; textures[0] = iconRegister.registerIcon("biomesoplenty:item_barley"); textures[1] = iconRegister.registerIcon("biomesoplenty:item_cattail"); textures[2] = iconRegister.registerIcon("biomesoplenty:item_rivercane"); textures[3] = iconRegister.registerIcon("biomesoplenty:item_witherwart"); textures[4] = iconRegister.registerIcon("biomesoplenty:item_reed"); + textures[5] = iconRegister.registerIcon("biomesoplenty:item_root"); } @Override @@ -70,6 +71,8 @@ public class ItemBlockPlant extends ItemBlock return textures[3]; else if (meta == 14) return textures[4]; + else if (meta == 15) + return textures[5]; else return Block.blocksList[itemID].getIcon(0, meta); } diff --git a/resources/assets/biomesoplenty/lang/en_US.lang b/resources/assets/biomesoplenty/lang/en_US.lang index 7b81f7092..426515c4c 100644 --- a/resources/assets/biomesoplenty/lang/en_US.lang +++ b/resources/assets/biomesoplenty/lang/en_US.lang @@ -32,6 +32,7 @@ tile.bop.plants.rivercane.name=River Cane tile.bop.plants.cactus.name=Tiny Cactus tile.bop.plants.witherwart.name=Wither Wart tile.bop.plants.reed.name=Reed +tile.bop.plants.root.name=Root tile.bop.flowers.clover.name=Clover tile.bop.flowers.swampflower.name=Swampflower diff --git a/resources/assets/biomesoplenty/textures/blocks/item_root.png b/resources/assets/biomesoplenty/textures/blocks/item_root.png new file mode 100644 index 0000000000000000000000000000000000000000..a42f6263aa53ffb4c33b81e0025e2851f79abe39 GIT binary patch literal 645 zcmV;00($+4P)N2bPDNB8 zb~7$DE-^7j^FlWO00IF?L_t(IPgPS}OO#;{e*cVKBqUm2%uUayhXJg@Op}Y&L5`p^yEK7<#Jh= z@f(E=uMehiwLfKjzTZTssKY`QuvsFJkj9LkZ4Tq~^AOIrT%he_Bt_~tX|u`A@iNF{ z{&fR>eR+@ViDvA2TJd{t(n|RcXp+gK6i_=CsLcL+^T6FvjU9Ijw#J)qzU{)sXg$b~ z-=&K-;SS>QxGa^(>mOfYZ=nshCq7Je*5GKZ7l*zMyn9gz1ryp#ro$lTCdI!$7eRF2 za0`B{cH#1?8#BFiSQu!8j?EJb11^P{#d^Yv-7!HsUhBhj&tuH?J;BnOr&itlUCE>K zaKqFqgVj<%8iC%m_Q&PabAUpOw=OMrq;#FlS-w` zhxRI&lL#DzG}%DuQuEx*rLCjOLy1HphTGPKa#=(P27}_WK+%=8j6fqC4vTiqr)QA>VW00000NkvXXu0mjfj`<;Z literal 0 HcmV?d00001 diff --git a/resources/assets/biomesoplenty/textures/blocks/root.png b/resources/assets/biomesoplenty/textures/blocks/root.png new file mode 100644 index 0000000000000000000000000000000000000000..46e2f94899b69d307ec841bad6b8977febc0092a GIT binary patch literal 589 zcmV-T0N2bPDNB8 zb~7$DE-^7j^FlWO00GHKL_t(IPi>M!*j*{`)TQRyN-Qgre8MZhvf6y2?>J00q%Zz_f&S@j4P*Pp-^zY4x*AtOexuF zwUoceEXtp6aXDCUTXS)&EiH%96QgMz0NK`+*92Okmpj0Zk>(g~voqZrC z2pWxs`+XRbTCL{R=LSVfV8h|fkF<)gM;N<*zpsXN^ZC5G!jXxE%GGLBSL`*LP2FRY z2Y?tSIK`p8Qx!I>S0^b+y?CgXX&hzHn@>xRl>>+zr6U^SQcJKtVBeeo>ZA|J$UrCn zI-O3q4?Al}FFexAWIx|qkjvww?5#{nxm?zBvu}+J11_M9ARwlRKlfkh2ytgl5eK0F z53Cn=5r5XFj+nX6TNyeUzb3yYVEgr`Y(_^^gfkPeg!+NZ<#Ou8ACZA6Sj~Pipq;kB zE|H1V>NMW68c$MHgfL|u+mGar)Xw}E{1^Bl#ubZ2UCB