Allowed palm/mangrove saplings to grow on sand, made palm leaves non-decayable

This commit is contained in:
Forstride 2017-05-22 22:14:42 -04:00
parent 1324d30ab9
commit bb2c1c3944
10 changed files with 27 additions and 15 deletions

View file

@ -26,6 +26,7 @@ public class BlockQueries
public static IBlockPosQuery fertile; public static IBlockPosQuery fertile;
public static IBlockPosQuery fertileOrNetherrack; public static IBlockPosQuery fertileOrNetherrack;
public static IBlockPosQuery fertileOrSand;
public static IBlockPosQuery sustainsCave; public static IBlockPosQuery sustainsCave;
public static IBlockPosQuery sustainsNether; public static IBlockPosQuery sustainsNether;
public static IBlockPosQuery endish; public static IBlockPosQuery endish;

View file

@ -70,10 +70,10 @@ public class BiomeGenOasis extends BOPOverworldBiome
this.addGenerator("lakes", GeneratorStage.SAND, (new GeneratorLakes.Builder()).amountPerChunk(1.5F).waterLakeForBiome(this).create()); this.addGenerator("lakes", GeneratorStage.SAND, (new GeneratorLakes.Builder()).amountPerChunk(1.5F).waterLakeForBiome(this).create());
// trees // trees
GeneratorWeighted treeGenerator = new GeneratorWeighted(10.0F); GeneratorWeighted treeGenerator = new GeneratorWeighted(7.0F);
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator); 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", 1, (new GeneratorTwigletTree.Builder()).minHeight(2).maxHeight(2).log(BlockPlanks.EnumType.JUNGLE).leaves(BlockPlanks.EnumType.JUNGLE).trunkFruit(Blocks.COCOA.getDefaultState()).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 // grasses
GeneratorWeighted grassGenerator = new GeneratorWeighted(4.0F); GeneratorWeighted grassGenerator = new GeneratorWeighted(4.0F);

View file

@ -58,7 +58,7 @@ public class BiomeGenTropicalIsland extends BOPOverworldBiome
// trees // trees
GeneratorWeighted treeGenerator = new GeneratorWeighted(25.0F); GeneratorWeighted treeGenerator = new GeneratorWeighted(25.0F);
this.addGenerator("trees", GeneratorStage.TREE, treeGenerator); 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()); 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 // grasses

View file

@ -14,6 +14,7 @@ import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.api.block.BlockQueries; import biomesoplenty.api.block.BlockQueries;
import biomesoplenty.api.enums.BOPTrees; import biomesoplenty.api.enums.BOPTrees;
import biomesoplenty.api.enums.BOPWoods; import biomesoplenty.api.enums.BOPWoods;
import biomesoplenty.common.block.BlockBOPMushroom.MushroomType;
import biomesoplenty.common.item.ItemBOPSapling; import biomesoplenty.common.item.ItemBOPSapling;
import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod; import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod;
import biomesoplenty.common.util.block.VariantPagingHelper; import biomesoplenty.common.util.block.VariantPagingHelper;
@ -124,11 +125,17 @@ public class BlockBOPSapling extends BlockBOPDecoration implements IGrowable, IP
return ((Integer)state.getValue(STAGE)).intValue() * 8 + paging.getIndex(tree); 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 @Override
public boolean canBlockStay(World world, BlockPos pos, IBlockState state) 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 @Override
@ -209,7 +216,7 @@ public class BlockBOPSapling extends BlockBOPDecoration implements IGrowable, IP
case MANGROVE: case MANGROVE:
return new GeneratorMangroveTree.Builder().log(BOPWoods.MANGROVE).leaves(BOPTrees.MANGROVE).create(); return new GeneratorMangroveTree.Builder().log(BOPWoods.MANGROVE).leaves(BOPTrees.MANGROVE).create();
case PALM: 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: case REDWOOD:
return new GeneratorRedwoodTree.Builder().create(); return new GeneratorRedwoodTree.Builder().create();
case WILLOW: case WILLOW:

View file

@ -17,6 +17,7 @@ import static biomesoplenty.api.block.BlockQueries.breakable;
import static biomesoplenty.api.block.BlockQueries.endish; import static biomesoplenty.api.block.BlockQueries.endish;
import static biomesoplenty.api.block.BlockQueries.fertile; import static biomesoplenty.api.block.BlockQueries.fertile;
import static biomesoplenty.api.block.BlockQueries.fertileOrNetherrack; 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.fertileSeaBed;
import static biomesoplenty.api.block.BlockQueries.groundBlocks; import static biomesoplenty.api.block.BlockQueries.groundBlocks;
import static biomesoplenty.api.block.BlockQueries.hasWater; import static biomesoplenty.api.block.BlockQueries.hasWater;
@ -145,6 +146,7 @@ public class ModBlockQueries
fertile = BlockQuery.buildAnd().sustainsPlant(EnumPlantType.Plains).create(); 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(); 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(); sustainsCave = BlockQuery.buildAnd().sustainsPlant(EnumPlantType.Cave).create();
sustainsNether = BlockQuery.buildAnd().sustainsPlant(EnumPlantType.Nether).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(); endish = BlockQuery.buildOr().blocks(Blocks.END_STONE).states(BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.SPECTRAL_MOSS)).create();

View file

@ -23,6 +23,7 @@ import com.google.common.collect.Sets;
import biomesoplenty.api.block.BOPBlocks; import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.api.block.BlockQueries; import biomesoplenty.api.block.BlockQueries;
import biomesoplenty.api.block.IBlockPosQuery; import biomesoplenty.api.block.IBlockPosQuery;
import biomesoplenty.common.block.BlockBOPGrass;
import biomesoplenty.common.block.ISustainsPlantType; import biomesoplenty.common.block.ISustainsPlantType;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid; import net.minecraft.block.BlockLiquid;
@ -290,14 +291,14 @@ public class BlockQuery
// Otherwise fall back to the vanilla code // Otherwise fall back to the vanilla code
switch (this.plantType) switch (this.plantType)
{ {
case Desert: return block == Blocks.SAND || block == Blocks.HARDENED_CLAY || block == Blocks.STAINED_HARDENED_CLAY || block == Blocks.DIRT; 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; 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 Crop: return block == Blocks.FARMLAND || block == BOPBlocks.farmland_0 || block == BOPBlocks.farmland_1;
case Cave: return block.isSideSolid(state, world, pos, EnumFacing.UP); 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 Water: return state.getMaterial() == Material.WATER && ((Integer)state.getValue(BlockLiquid.LEVEL)) == 0;
case Beach: 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 || boolean hasWater = (world.getBlockState(pos.east()).getMaterial() == Material.WATER ||
world.getBlockState(pos.west()).getMaterial() == Material.WATER || world.getBlockState(pos.west()).getMaterial() == Material.WATER ||
world.getBlockState(pos.north()).getMaterial() == Material.WATER || world.getBlockState(pos.north()).getMaterial() == Material.WATER ||

View file

@ -49,7 +49,7 @@ public class GeneratorMangroveTree extends GeneratorTreeBase
{ {
// defaults // defaults
this.amountPerChunk = 1.0F; this.amountPerChunk = 1.0F;
this.placeOn = BlockQueries.fertile; this.placeOn = BlockQueries.fertileOrSand;
this.replace = BlockQueries.airOrLeaves; this.replace = BlockQueries.airOrLeaves;
this.rootsReplace = BlockQueries.rootsCanDigThrough; this.rootsReplace = BlockQueries.rootsCanDigThrough;
this.log = Blocks.LOG.getDefaultState(); this.log = Blocks.LOG.getDefaultState();

View file

@ -31,7 +31,7 @@ public class GeneratorPalmTree extends GeneratorTreeBase
this.amountPerChunk = 1.0F; this.amountPerChunk = 1.0F;
this.minHeight = 10; this.minHeight = 10;
this.maxHeight = 14; this.maxHeight = 14;
this.placeOn = BlockQueries.fertile; this.placeOn = BlockQueries.fertileOrSand;
this.replace = BlockQueries.airOrLeaves; this.replace = BlockQueries.airOrLeaves;
this.log = Blocks.LOG.getDefaultState(); this.log = Blocks.LOG.getDefaultState();
this.leaves = Blocks.LEAVES.getDefaultState(); this.leaves = Blocks.LEAVES.getDefaultState();
@ -106,6 +106,7 @@ public class GeneratorPalmTree extends GeneratorTreeBase
if (step == heightMinusTop) if (step == heightMinusTop)
{ {
// Generate top of tree // Generate top of tree
this.setLog(world, offsetPos);
generateLeavesTop(world, offsetPos, leavesRadius); generateLeavesTop(world, offsetPos, leavesRadius);
break; break;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 B

After

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B