mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Don't crash if we hit the void
This commit is contained in:
parent
0a76d0a070
commit
df374a42de
1 changed files with 2 additions and 2 deletions
|
@ -79,8 +79,7 @@ public class BlockGreenhouseGlass extends BlockBase {
|
||||||
if (world.canBlockSeeSky(pos) && world.isDaytime()) {
|
if (world.canBlockSeeSky(pos) && world.isDaytime()) {
|
||||||
Triple<BlockPos, IBlockState, IGrowable> trip = firstBlock(world, pos);
|
Triple<BlockPos, IBlockState, IGrowable> trip = firstBlock(world, pos);
|
||||||
boolean once = false;
|
boolean once = false;
|
||||||
if(trip != null)
|
if (trip != null) for (int i = 0; i < 3; i++) {
|
||||||
for (int i = 0; i < 3; i++) {
|
|
||||||
IBlockState growState = i == 0 ? trip.getMiddle() : world.getBlockState(trip.getLeft());
|
IBlockState growState = i == 0 ? trip.getMiddle() : world.getBlockState(trip.getLeft());
|
||||||
if (trip.getRight().canGrow(world, trip.getLeft(), growState, false)) {
|
if (trip.getRight().canGrow(world, trip.getLeft(), growState, false)) {
|
||||||
trip.getRight().grow(world, rand, trip.getLeft(), growState);
|
trip.getRight().grow(world, rand, trip.getLeft(), growState);
|
||||||
|
@ -95,6 +94,7 @@ public class BlockGreenhouseGlass extends BlockBase {
|
||||||
BlockPos.MutableBlockPos mut = new BlockPos.MutableBlockPos(glassPos);
|
BlockPos.MutableBlockPos mut = new BlockPos.MutableBlockPos(glassPos);
|
||||||
while (true) {
|
while (true) {
|
||||||
mut.setPos(mut.getX(), mut.getY() - 1, mut.getZ());
|
mut.setPos(mut.getX(), mut.getY() - 1, mut.getZ());
|
||||||
|
if (mut.getY() < 0) return null;
|
||||||
IBlockState state = world.getBlockState(mut);
|
IBlockState state = world.getBlockState(mut);
|
||||||
if (!state.isOpaqueCube() || state.getBlock() instanceof IGrowable) {
|
if (!state.isOpaqueCube() || state.getBlock() instanceof IGrowable) {
|
||||||
if (state.getBlock() instanceof IGrowable) return Triple.of(mut.toImmutable(), state, (IGrowable) state.getBlock());
|
if (state.getBlock() instanceof IGrowable) return Triple.of(mut.toImmutable(), state, (IGrowable) state.getBlock());
|
||||||
|
|
Loading…
Reference in a new issue