From 5ac38b686adf13e8663834ffc112ddda0ee1999b Mon Sep 17 00:00:00 2001 From: Henry Loenwind Date: Sun, 22 Jan 2017 11:08:40 +0100 Subject: [PATCH] Fix #924 Don't bypass the blockstate and don't bypass it with wrong parameters --- src/main/java/biomesoplenty/common/block/BlockBOPDirt.java | 2 +- src/main/java/biomesoplenty/common/block/BlockBOPGrass.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPDirt.java b/src/main/java/biomesoplenty/common/block/BlockBOPDirt.java index cc5c3eb3f..d40333813 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPDirt.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPDirt.java @@ -163,7 +163,7 @@ public class BlockBOPDirt extends Block implements IBOPBlock, ISustainsPlantType { IBlockState upState = world.getBlockState(pos.up()); // if there's not enough light then there's no chance of this block becoming grassy - if (world.getLightFromNeighbors(pos.up()) < 4 || upState.getBlock().getLightOpacity(upState) > 2) {return;} + if (world.getLightFromNeighbors(pos.up()) < 4 || upState.getLightOpacity(world, pos.up()) > 2) {return;} int numNearbyGrassSpreadingBlocks = 0; BlockPos pos1; diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPGrass.java b/src/main/java/biomesoplenty/common/block/BlockBOPGrass.java index 856c5ce0c..ec92d8ae3 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPGrass.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPGrass.java @@ -194,7 +194,7 @@ public class BlockBOPGrass extends BlockGrass implements IBOPBlock, ISustainsPla { // if this block is covered, then turn it back to dirt (IE kill the grass) - if (world.getLightFromNeighbors(pos.up()) < 4 && world.getBlockState(pos.up()).getBlock().getLightOpacity(world.getBlockState(pos.up())) > 2) + if (world.getLightFromNeighbors(pos.up()) < 4 && world.getBlockState(pos.up()).getLightOpacity(world, pos.up()) > 2) { world.setBlockState(pos, getDirtBlockState(state)); } @@ -208,14 +208,14 @@ public class BlockBOPGrass extends BlockGrass implements IBOPBlock, ISustainsPla // pick a random nearby position, and get the block, block state, and block above BlockPos pos1 = pos.add(rand.nextInt(xzSpread * 2 + 1) - xzSpread, rand.nextInt(downSpread + upSpread + 1) - downSpread, rand.nextInt(xzSpread * 2 + 1) - xzSpread); IBlockState target = world.getBlockState(pos1); - Block blockAboveTarget = world.getBlockState(pos1.up()).getBlock(); + IBlockState blockAboveTarget = world.getBlockState(pos1.up()); // see if this type of grass can spread to the target block IBlockState targetGrass = spreadsToGrass(state, target); if (targetGrass == null) {break;} // if there's enough light, turn the block to the relevant grass block - if (world.getLightFromNeighbors(pos1.up()) >= 4 && blockAboveTarget.getLightOpacity(target) <= 2) + if (world.getLightFromNeighbors(pos1.up()) >= 4 && blockAboveTarget.getLightOpacity(world, pos1.up()) <= 2) { world.setBlockState(pos1, targetGrass); }