Fix light level detection for petrified creatures breaking out

This commit is contained in:
Electroblob
2018-06-05 14:12:33 +01:00
parent 669cd2892d
commit 05b905b988
2 changed files with 22 additions and 2 deletions
@@ -1,5 +1,6 @@
package electroblob.wizardry.tileentity;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
@@ -107,8 +108,7 @@ public class TileEntityStatue extends TileEntity implements ITickable {
// Breaks the block at light levels of 7 or below, with a higher chance the lower the light level.
// The chance is (8 - light level)/12, so at light 0 the chance is 3/4 and at light 7 the chance is 1/12.
if(!this.world.isRemote && this.timer % 200 == 0 && this.timer > lifetime && !this.isIce && this.position == 1){
// TESTME: There are about 10 different light-related methods in world now... is this the right one?
if(this.world.getLight(pos) < this.world.rand.nextInt(12) - 3){
if(WizardryUtilities.getLightLevel(world, pos) < this.world.rand.nextInt(12) - 3){
// This is all that is needed because destroyBlock invokes the breakBlock function in
// BlockPetrifiedStone
// and that function handles all the spawning and stuff.