From bb2c1c3944574b3eebc95245e0424daa4802b38d Mon Sep 17 00:00:00 2001 From: Forstride Date: Mon, 22 May 2017 22:14:42 -0400 Subject: [PATCH] Allowed palm/mangrove saplings to grow on sand, made palm leaves non-decayable --- .../biomesoplenty/api/block/BlockQueries.java | 1 + .../common/biome/overworld/BiomeGenOasis.java | 6 +++--- .../overworld/BiomeGenTropicalIsland.java | 2 +- .../common/block/BlockBOPSapling.java | 17 ++++++++++++----- .../common/init/ModBlockQueries.java | 2 ++ .../common/util/block/BlockQuery.java | 9 +++++---- .../generator/tree/GeneratorMangroveTree.java | 2 +- .../generator/tree/GeneratorPalmTree.java | 3 ++- .../textures/items/sand_bucket.png | Bin 321 -> 395 bytes .../biomesoplenty/textures/items/soul.png | Bin 0 -> 301 bytes 10 files changed, 27 insertions(+), 15 deletions(-) create mode 100644 src/main/resources/assets/biomesoplenty/textures/items/soul.png diff --git a/src/main/java/biomesoplenty/api/block/BlockQueries.java b/src/main/java/biomesoplenty/api/block/BlockQueries.java index 8a36fc4c5..e4566e115 100644 --- a/src/main/java/biomesoplenty/api/block/BlockQueries.java +++ b/src/main/java/biomesoplenty/api/block/BlockQueries.java @@ -26,6 +26,7 @@ public class BlockQueries public static IBlockPosQuery fertile; public static IBlockPosQuery fertileOrNetherrack; + public static IBlockPosQuery fertileOrSand; public static IBlockPosQuery sustainsCave; public static IBlockPosQuery sustainsNether; public static IBlockPosQuery endish; diff --git a/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenOasis.java b/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenOasis.java index 3360c272c..64ef237dc 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenOasis.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenOasis.java @@ -70,10 +70,10 @@ public class BiomeGenOasis extends BOPOverworldBiome this.addGenerator("lakes", GeneratorStage.SAND, (new GeneratorLakes.Builder()).amountPerChunk(1.5F).waterLakeForBiome(this).create()); // trees - GeneratorWeighted treeGenerator = new GeneratorWeighted(10.0F); + GeneratorWeighted treeGenerator = new GeneratorWeighted(7.0F); this.addGenerator("trees", GeneratorStage.TREE, treeGenerator); - treeGenerator.add("palm", 4, (new GeneratorPalmTree.Builder()).log(BOPWoods.PALM).leaves(BlockBOPLeaves.paging.getVariantState(BOPTrees.PALM).withProperty(BlockOldLeaf.CHECK_DECAY, Boolean.valueOf(false))).create()); - treeGenerator.add("jungle_twiglet", 1, (new GeneratorTwigletTree.Builder()).minHeight(2).maxHeight(2).log(BlockPlanks.EnumType.JUNGLE).leaves(BlockPlanks.EnumType.JUNGLE).trunkFruit(Blocks.COCOA.getDefaultState()).create()); + treeGenerator.add("palm", 4, (new GeneratorPalmTree.Builder()).log(BOPWoods.PALM).leaves(BlockBOPLeaves.paging.getVariantState(BOPTrees.PALM).withProperty(BlockOldLeaf.DECAYABLE, Boolean.valueOf(false))).create()); + treeGenerator.add("jungle_twiglet", 2, (new GeneratorTwigletTree.Builder()).minHeight(2).maxHeight(2).log(BlockPlanks.EnumType.JUNGLE).leaves(BlockPlanks.EnumType.JUNGLE).trunkFruit(Blocks.COCOA.getDefaultState()).create()); // grasses GeneratorWeighted grassGenerator = new GeneratorWeighted(4.0F); diff --git a/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenTropicalIsland.java b/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenTropicalIsland.java index 8142b9190..08485997b 100644 --- a/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenTropicalIsland.java +++ b/src/main/java/biomesoplenty/common/biome/overworld/BiomeGenTropicalIsland.java @@ -58,7 +58,7 @@ public class BiomeGenTropicalIsland extends BOPOverworldBiome // trees GeneratorWeighted treeGenerator = new GeneratorWeighted(25.0F); this.addGenerator("trees", GeneratorStage.TREE, treeGenerator); - treeGenerator.add("palm", 4, (new GeneratorPalmTree.Builder()).log(BOPWoods.PALM).leaves(BlockBOPLeaves.paging.getVariantState(BOPTrees.PALM).withProperty(BlockOldLeaf.CHECK_DECAY, Boolean.valueOf(false))).create()); + treeGenerator.add("palm", 4, (new GeneratorPalmTree.Builder()).log(BOPWoods.PALM).leaves(BlockBOPLeaves.paging.getVariantState(BOPTrees.PALM).withProperty(BlockOldLeaf.DECAYABLE, Boolean.valueOf(false))).create()); treeGenerator.add("jungle_twiglet", 2, (new GeneratorTwigletTree.Builder()).minHeight(2).maxHeight(2).log(BlockPlanks.EnumType.JUNGLE).leaves(BlockPlanks.EnumType.JUNGLE).trunkFruit(Blocks.COCOA.getDefaultState()).create()); // grasses diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPSapling.java b/src/main/java/biomesoplenty/common/block/BlockBOPSapling.java index 0dd935bd4..abd6555b0 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPSapling.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPSapling.java @@ -14,6 +14,7 @@ import biomesoplenty.api.block.BOPBlocks; import biomesoplenty.api.block.BlockQueries; import biomesoplenty.api.enums.BOPTrees; import biomesoplenty.api.enums.BOPWoods; +import biomesoplenty.common.block.BlockBOPMushroom.MushroomType; import biomesoplenty.common.item.ItemBOPSapling; import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import biomesoplenty.common.util.block.VariantPagingHelper; @@ -123,12 +124,18 @@ public class BlockBOPSapling extends BlockBOPDecoration implements IGrowable, IP BOPTrees tree = (BOPTrees)state.getValue(this.variantProperty); return ((Integer)state.getValue(STAGE)).intValue() * 8 + paging.getIndex(tree); } - - // TODO: override for loftwood - what is that? + + // which types of mushroom can live on which types of block @Override public boolean canBlockStay(World world, BlockPos pos, IBlockState state) - { - return BlockQueries.fertile.matches(world, pos.down()); + { + switch ((BOPTrees) state.getValue(this.variantProperty)) + { + case PALM: case MANGROVE: + return BlockQueries.fertileOrSand.matches(world, pos.down()); + default: + return BlockQueries.fertile.matches(world, pos.down()); + } } @Override @@ -209,7 +216,7 @@ public class BlockBOPSapling extends BlockBOPDecoration implements IGrowable, IP case MANGROVE: return new GeneratorMangroveTree.Builder().log(BOPWoods.MANGROVE).leaves(BOPTrees.MANGROVE).create(); case PALM: - return new GeneratorPalmTree.Builder().log(BOPWoods.PALM).leaves(BlockBOPLeaves.paging.getVariantState(BOPTrees.PALM).withProperty(BlockOldLeaf.CHECK_DECAY, Boolean.valueOf(false))).updateNeighbours(true).create(); + return new GeneratorPalmTree.Builder().log(BOPWoods.PALM).leaves(BlockBOPLeaves.paging.getVariantState(BOPTrees.PALM).withProperty(BlockOldLeaf.DECAYABLE, Boolean.valueOf(false))).updateNeighbours(true).create(); case REDWOOD: return new GeneratorRedwoodTree.Builder().create(); case WILLOW: diff --git a/src/main/java/biomesoplenty/common/init/ModBlockQueries.java b/src/main/java/biomesoplenty/common/init/ModBlockQueries.java index a0c6a093c..572d2a4f8 100644 --- a/src/main/java/biomesoplenty/common/init/ModBlockQueries.java +++ b/src/main/java/biomesoplenty/common/init/ModBlockQueries.java @@ -17,6 +17,7 @@ import static biomesoplenty.api.block.BlockQueries.breakable; import static biomesoplenty.api.block.BlockQueries.endish; import static biomesoplenty.api.block.BlockQueries.fertile; import static biomesoplenty.api.block.BlockQueries.fertileOrNetherrack; +import static biomesoplenty.api.block.BlockQueries.fertileOrSand; import static biomesoplenty.api.block.BlockQueries.fertileSeaBed; import static biomesoplenty.api.block.BlockQueries.groundBlocks; import static biomesoplenty.api.block.BlockQueries.hasWater; @@ -145,6 +146,7 @@ public class ModBlockQueries fertile = BlockQuery.buildAnd().sustainsPlant(EnumPlantType.Plains).create(); fertileOrNetherrack = BlockQuery.buildOr().sustainsPlant(EnumPlantType.Plains).blocks(Blocks.NETHERRACK).states(BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.OVERGROWN_NETHERRACK), BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.MYCELIAL_NETHERRACK)).create(); + fertileOrSand = BlockQuery.buildOr().sustainsPlant(EnumPlantType.Plains).blocks(Blocks.SAND).create(); sustainsCave = BlockQuery.buildAnd().sustainsPlant(EnumPlantType.Cave).create(); sustainsNether = BlockQuery.buildAnd().sustainsPlant(EnumPlantType.Nether).create(); endish = BlockQuery.buildOr().blocks(Blocks.END_STONE).states(BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.SPECTRAL_MOSS)).create(); diff --git a/src/main/java/biomesoplenty/common/util/block/BlockQuery.java b/src/main/java/biomesoplenty/common/util/block/BlockQuery.java index ca71d349a..69adbeb48 100644 --- a/src/main/java/biomesoplenty/common/util/block/BlockQuery.java +++ b/src/main/java/biomesoplenty/common/util/block/BlockQuery.java @@ -23,6 +23,7 @@ import com.google.common.collect.Sets; import biomesoplenty.api.block.BOPBlocks; import biomesoplenty.api.block.BlockQueries; import biomesoplenty.api.block.IBlockPosQuery; +import biomesoplenty.common.block.BlockBOPGrass; import biomesoplenty.common.block.ISustainsPlantType; import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; @@ -290,14 +291,14 @@ public class BlockQuery // Otherwise fall back to the vanilla code switch (this.plantType) { - case Desert: return block == Blocks.SAND || block == Blocks.HARDENED_CLAY || block == Blocks.STAINED_HARDENED_CLAY || block == Blocks.DIRT; - case Nether: return block == Blocks.SOUL_SAND; + case Desert: return block == Blocks.SAND || block == Blocks.HARDENED_CLAY || block == Blocks.STAINED_HARDENED_CLAY || block == Blocks.DIRT || block == BOPBlocks.dirt; + case Nether: return block == Blocks.SOUL_SAND || state == BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.OVERGROWN_NETHERRACK); case Crop: return block == Blocks.FARMLAND || block == BOPBlocks.farmland_0 || block == BOPBlocks.farmland_1; case Cave: return block.isSideSolid(state, world, pos, EnumFacing.UP); - case Plains: return block == Blocks.GRASS || block == Blocks.DIRT || block == Blocks.FARMLAND || block == BOPBlocks.farmland_0 || block == BOPBlocks.farmland_1 || block == Blocks.MYCELIUM; + case Plains: return block == Blocks.GRASS || state == BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.LOAMY) || state == BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.SILTY) || state == BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.SANDY) || state == BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.DAISY) || block == Blocks.DIRT || block == BOPBlocks.dirt || block == Blocks.FARMLAND || block == BOPBlocks.farmland_0 || block == BOPBlocks.farmland_1 || block == Blocks.MYCELIUM; case Water: return state.getMaterial() == Material.WATER && ((Integer)state.getValue(BlockLiquid.LEVEL)) == 0; case Beach: - boolean isBeach = block == Blocks.GRASS || block == Blocks.DIRT || block == Blocks.SAND || block == Blocks.MYCELIUM; + boolean isBeach = block == Blocks.GRASS || state == BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.LOAMY) || state == BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.SILTY) || state == BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.SANDY) || state == BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.DAISY) || block == Blocks.DIRT || block == BOPBlocks.dirt || block == Blocks.SAND || block == Blocks.MYCELIUM; boolean hasWater = (world.getBlockState(pos.east()).getMaterial() == Material.WATER || world.getBlockState(pos.west()).getMaterial() == Material.WATER || world.getBlockState(pos.north()).getMaterial() == Material.WATER || diff --git a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorMangroveTree.java b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorMangroveTree.java index a25cfcaf9..035cf7c86 100644 --- a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorMangroveTree.java +++ b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorMangroveTree.java @@ -49,7 +49,7 @@ public class GeneratorMangroveTree extends GeneratorTreeBase { // defaults this.amountPerChunk = 1.0F; - this.placeOn = BlockQueries.fertile; + this.placeOn = BlockQueries.fertileOrSand; this.replace = BlockQueries.airOrLeaves; this.rootsReplace = BlockQueries.rootsCanDigThrough; this.log = Blocks.LOG.getDefaultState(); diff --git a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorPalmTree.java b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorPalmTree.java index c073e7997..21788fed7 100644 --- a/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorPalmTree.java +++ b/src/main/java/biomesoplenty/common/world/generator/tree/GeneratorPalmTree.java @@ -31,7 +31,7 @@ public class GeneratorPalmTree extends GeneratorTreeBase this.amountPerChunk = 1.0F; this.minHeight = 10; this.maxHeight = 14; - this.placeOn = BlockQueries.fertile; + this.placeOn = BlockQueries.fertileOrSand; this.replace = BlockQueries.airOrLeaves; this.log = Blocks.LOG.getDefaultState(); this.leaves = Blocks.LEAVES.getDefaultState(); @@ -106,6 +106,7 @@ public class GeneratorPalmTree extends GeneratorTreeBase if (step == heightMinusTop) { // Generate top of tree + this.setLog(world, offsetPos); generateLeavesTop(world, offsetPos, leavesRadius); break; } diff --git a/src/main/resources/assets/biomesoplenty/textures/items/sand_bucket.png b/src/main/resources/assets/biomesoplenty/textures/items/sand_bucket.png index daa792e9a1e543c1c52e7a6c6769fa4ed044a28e..2123b864afbae11713746b517bcc11e8a2517fb3 100644 GIT binary patch delta 316 zcmV-C0mJ^m0*eEXJPN-601m$aI0aKAkwzeYHbiN!^#A|?2uVaiR5(v#7@WY=)bu|L z2L=YhF;p5ifN82r@cmyHZ2vz$(Dr{#oY(*INLQek4}OC{8Y`pS|HnJ({%?yk`9Cq$ z;s4}xr~e%>=Ks6mEdRGeoBeM|3;N%XB7Z}ii+?X0K+g1Fx&?8 zN{JD^{$4-|mu O0000sf{+x;NXEvA$j-YQSqNhDJ@f$Wr)A- zho$p+W-ryElj~uX7NK}r7B2VA*w)*koBh;D5X|~o3(UB!lvI6;>1s;*b z3=DjGL736~_k^`TLCF%=h?3y^w370~qEv>0#LT=By}Z;C1rt33Jwr2>%=KS^idK2L zIEGmGFP&h>$7IOE@>!TmWuAj)p($_t+3-&ahv(hMxbDfvc+{hB?%W8?+kZcbt19(e z{wd@&Fa1r!fv?*njXS@s>2z3Y8n^oGf;dkP{eqQSw>dMO*E(S&{J@lDr(Jeig}Z7q zLqh4g`OHzxjtvUo|6lPlsEX87$=+ySs(bXR^er#5=oyt2{VeT5=cX|o@HY13W9H6U rtHgHy3(p2;Hz%K(A5l{u6{1-oD!M