Prevented Nether generation above the bedrock and fixed tpbiome command in Nether (Closes #1140, #1141)
This commit is contained in:
parent
5d08edd06a
commit
6717a9708c
|
@ -129,10 +129,15 @@ public class BOPCommand extends CommandBase
|
|||
|
||||
if (closestBiomePos != null)
|
||||
{
|
||||
double x = (double)closestBiomePos.getX();
|
||||
double y = (double)world.getTopSolidOrLiquidBlock(closestBiomePos).getY();
|
||||
double z = (double)closestBiomePos.getZ();
|
||||
|
||||
double x = (double)closestBiomePos.getX();
|
||||
double y = (double)world.getTopSolidOrLiquidBlock(closestBiomePos).getY();
|
||||
double z = (double)closestBiomePos.getZ();
|
||||
|
||||
if (!world.provider.isSurfaceWorld())
|
||||
{
|
||||
y = (double)getTopBlockNonOverworld(world, closestBiomePos).getY();
|
||||
}
|
||||
|
||||
player.connection.setPlayerLocation(x, y, z, player.rotationYaw, player.rotationPitch);
|
||||
sender.sendMessage(new TextComponentTranslation("commands.biomesoplenty.tpbiome.success", player.getName(), biomeName, x, y, z));
|
||||
}
|
||||
|
@ -142,6 +147,27 @@ public class BOPCommand extends CommandBase
|
|||
}
|
||||
}
|
||||
|
||||
public BlockPos getTopBlockNonOverworld(World world, BlockPos pos)
|
||||
{
|
||||
Chunk chunk = world.getChunkFromBlockCoords(pos);
|
||||
BlockPos blockpos;
|
||||
BlockPos blockpos1;
|
||||
BlockPos blockpos2 = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ());
|
||||
|
||||
for (blockpos = blockpos2; blockpos.getY() >= 0; blockpos = blockpos1)
|
||||
{
|
||||
blockpos1 = blockpos.down();
|
||||
IBlockState state = chunk.getBlockState(blockpos1);
|
||||
|
||||
if (!state.getMaterial().blocksMovement() && !world.isAirBlock(blockpos1.down()) && !state.getBlock().isLeaves(state, world, blockpos1) && !state.getBlock().isFoliage(world, blockpos1))
|
||||
{
|
||||
return blockpos1;
|
||||
}
|
||||
}
|
||||
|
||||
return blockpos2;
|
||||
}
|
||||
|
||||
private void printStats(ICommandSender sender, String[] args) {
|
||||
TextComponentTranslation text = new TextComponentTranslation("commands.biomesoplenty.stats.blocks", blockCount);
|
||||
|
||||
|
|
|
@ -117,12 +117,12 @@ public class GeneratorUtils
|
|||
case NETHER_SURFACE:
|
||||
// random point above the nether surface
|
||||
tempY = world.getHeight(new BlockPos(x, 0, z)).getY();
|
||||
pos = getFirstBlockMatching(world, new BlockPos(x, nextIntBetween(random, 1, 127), z), BlockQuery.buildAnd().add(BlockQueries.solid).withAirAbove().create());
|
||||
pos = getFirstBlockMatching(world, new BlockPos(x, nextIntBetween(random, 1, 122), z), BlockQuery.buildAnd().add(BlockQueries.solid).withAirAbove().create());
|
||||
return (pos == null ? new BlockPos(x, 1, z) : pos.up());
|
||||
case NETHER_ROOF:
|
||||
// random point above the nether surface
|
||||
tempY = world.getHeight(new BlockPos(x, 0, z)).getY();
|
||||
pos = getFirstBlockMatching(world, new BlockPos(x, nextIntBetween(random, 1, 127), z), BlockQuery.buildAnd().add(BlockQueries.solid).withAirBelow().create());
|
||||
pos = getFirstBlockMatching(world, new BlockPos(x, nextIntBetween(random, 1, 122), z), BlockQuery.buildAnd().add(BlockQueries.solid).withAirBelow().create());
|
||||
return (pos == null ? new BlockPos(x, 1, z) : pos.down());
|
||||
case ANYWHERE: default:
|
||||
// random y coord
|
||||
|
|
Loading…
Reference in New Issue