Fix some generator bugs
This commit is contained in:
parent
ec0123e9ea
commit
74bb9b41d2
3 changed files with 20 additions and 17 deletions
|
@ -68,11 +68,11 @@ public class ModBlockQueries
|
|||
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();
|
||||
hellish = BlockQuery.buildOr().blocks(Blocks.netherrack, BOPBlocks.flesh).states(BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.OVERGROWN_NETHERRACK)).create();
|
||||
litBeach = BlockQuery.buildAnd().sustainsPlant(EnumPlantType.Beach).withLightAtLeast(8).create();
|
||||
litBeach = BlockQuery.buildAnd().sustainsPlant(EnumPlantType.Beach).withLightAboveAtLeast(8).create();
|
||||
litFertileWaterside = BlockQuery.buildAnd().sustainsPlant(EnumPlantType.Plains).byWater().create();
|
||||
litFertile = BlockQuery.buildAnd().sustainsPlant(EnumPlantType.Plains).withLightAtLeast(8).create();
|
||||
litSand = BlockQuery.buildAnd().materials(Material.sand).withLightAtLeast(8).create();
|
||||
litDry = BlockQuery.buildAnd().sustainsPlant(EnumPlantType.Desert).withLightAtLeast(8).create();
|
||||
litFertile = BlockQuery.buildAnd().sustainsPlant(EnumPlantType.Plains).withLightAboveAtLeast(8).create();
|
||||
litSand = BlockQuery.buildAnd().materials(Material.sand).withLightAboveAtLeast(8).create();
|
||||
litDry = BlockQuery.buildAnd().sustainsPlant(EnumPlantType.Desert).withLightAboveAtLeast(8).create();
|
||||
litFertileOrDry = BlockQuery.buildOr().add(litFertile).add(litDry).create();
|
||||
spectralMoss = new BlockQueryState(BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT, BlockBOPGrass.BOPGrassType.SPECTRAL_MOSS));
|
||||
underwater = new BlockQueryMaterial(Material.water);
|
||||
|
@ -82,7 +82,7 @@ public class ModBlockQueries
|
|||
@Override public boolean matches(World world, BlockPos pos) {
|
||||
return world.getBlockState(pos).getBlock() == Blocks.water && world.getBlockState(pos.down()).getBlock() != Blocks.water;
|
||||
}
|
||||
}).withLightAtLeast(8).create();
|
||||
}).withLightAboveAtLeast(8).create();
|
||||
rootsCanDigThrough = new BlockQueryMaterial(Material.air, Material.water, Material.ground, Material.grass, Material.sand, Material.clay, Material.plants, Material.leaves);
|
||||
|
||||
}
|
||||
|
|
|
@ -93,8 +93,8 @@ public class BlockQuery
|
|||
public CompoundQueryBuilder withAltitudeBetween(int a, int b) {return this.add(new BlockPosQueryAltitude(a,b));}
|
||||
public CompoundQueryBuilder byWater() {return this.add(BlockQueries.hasWater);}
|
||||
public CompoundQueryBuilder withAirAbove() {return this.add(BlockQueries.airAbove);}
|
||||
public CompoundQueryBuilder withLightAtLeast(int a) {return this.add(new BlockPosQueryLightAtLeast(a));}
|
||||
public CompoundQueryBuilder withLightNoMoreThan(int a) {return this.add(new BlockPosQueryLightNoMoreThan(a));}
|
||||
public CompoundQueryBuilder withLightAboveAtLeast(int a) {return this.add(new BlockPosQueryLightAboveAtLeast(a));}
|
||||
public CompoundQueryBuilder withLightAboveNoMoreThan(int a) {return this.add(new BlockPosQueryLightAboveNoMoreThan(a));}
|
||||
public CompoundQueryBuilder sustainsPlant(EnumPlantType plantType) {return this.add(new BlockPosQuerySustainsPlantType(plantType));}
|
||||
|
||||
|
||||
|
@ -241,12 +241,12 @@ public class BlockQuery
|
|||
}
|
||||
}
|
||||
|
||||
// Match block positions based on light level
|
||||
public static class BlockPosQueryLightAtLeast implements IBlockPosQuery
|
||||
// Match block positions based on light level (of block above)
|
||||
public static class BlockPosQueryLightAboveAtLeast implements IBlockPosQuery
|
||||
{
|
||||
public int level;
|
||||
|
||||
public BlockPosQueryLightAtLeast(int level)
|
||||
public BlockPosQueryLightAboveAtLeast(int level)
|
||||
{
|
||||
this.level = level;
|
||||
}
|
||||
|
@ -254,14 +254,14 @@ public class BlockQuery
|
|||
@Override
|
||||
public boolean matches(World world, BlockPos pos)
|
||||
{
|
||||
return world.getLight(pos) >= this.level || world.canSeeSky(pos);
|
||||
return world.getLight(pos.up()) >= this.level || world.canSeeSky(pos.up());
|
||||
}
|
||||
}
|
||||
public static class BlockPosQueryLightNoMoreThan implements IBlockPosQuery
|
||||
public static class BlockPosQueryLightAboveNoMoreThan implements IBlockPosQuery
|
||||
{
|
||||
public int level;
|
||||
|
||||
public BlockPosQueryLightNoMoreThan(int level)
|
||||
public BlockPosQueryLightAboveNoMoreThan(int level)
|
||||
{
|
||||
this.level = level;
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ public class BlockQuery
|
|||
@Override
|
||||
public boolean matches(World world, BlockPos pos)
|
||||
{
|
||||
return world.getLight(pos) <= this.level;
|
||||
return world.getLight(pos.up()) <= this.level;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public class GeneratorBayouTree extends GeneratorTreeBase
|
|||
this.rootsReplace = BlockQueries.rootsCanDigThrough;
|
||||
this.log = Blocks.log.getDefaultState();
|
||||
this.leaves = Blocks.leaves.getDefaultState();
|
||||
this.vine = null;
|
||||
this.vine = Blocks.vine.getDefaultState();
|
||||
this.minHeight = 8;
|
||||
this.maxHeight = 18;
|
||||
this.minLeavesRadius = 2;
|
||||
|
@ -233,8 +233,11 @@ public class GeneratorBayouTree extends GeneratorTreeBase
|
|||
this.generateTop(world, random, pos, topHeight);
|
||||
|
||||
// Add vines
|
||||
int maxLeavesRadius = this.minLeavesRadius + topHeight / this.leavesGradient;
|
||||
this.addVines(world, random, startPos, height, maxLeavesRadius, this.vineAttempts);
|
||||
if (this.vine != null)
|
||||
{
|
||||
int maxLeavesRadius = this.minLeavesRadius + topHeight / this.leavesGradient;
|
||||
this.addVines(world, random, startPos, height, maxLeavesRadius, this.vineAttempts);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue