From 22f988e3bcead3a3522fd0af8509411f4409f233 Mon Sep 17 00:00:00 2001 From: Lizbeth Rika Date: Mon, 20 Jul 2015 17:51:35 +0100 Subject: [PATCH] Luminizers no longer unbind automatically. This serves as a workaround for them getting unbound by chunkloading problems. --- .../common/block/tile/TileLightRelay.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/main/java/vazkii/botania/common/block/tile/TileLightRelay.java b/src/main/java/vazkii/botania/common/block/tile/TileLightRelay.java index 8965abab4..2865dea12 100644 --- a/src/main/java/vazkii/botania/common/block/tile/TileLightRelay.java +++ b/src/main/java/vazkii/botania/common/block/tile/TileLightRelay.java @@ -43,7 +43,7 @@ public class TileLightRelay extends TileMod implements IWandBindable { int ticksElapsed = 0; public void mountEntity(EntityLivingBase e) { - if(e.ridingEntity != null || worldObj.isRemote || bindY == -1) + if(e.ridingEntity != null || worldObj.isRemote || bindY == -1 || !isValidBinding()) return; EntityPlayerMover mover = new EntityPlayerMover(worldObj, xCoord, yCoord, zCoord, bindX, bindY, bindZ); @@ -54,15 +54,9 @@ public class TileLightRelay extends TileMod implements IWandBindable { @Override public void updateEntity() { - if(bindY > -1) { - Block block = worldObj.getBlock(bindX, bindY, bindZ); - if(block != ModBlocks.lightRelay) { - bindY = -1; - return; - } - - ticksElapsed++; + ticksElapsed++; + if(bindY > -1 && isValidBinding()) { Vector3 vec = getMovementVector(); double dist = 0.1; @@ -86,6 +80,11 @@ public class TileLightRelay extends TileMod implements IWandBindable { } } } + + public boolean isValidBinding() { + Block block = worldObj.getBlock(bindX, bindY, bindZ); + return block == ModBlocks.lightRelay; + } public Vector3 getMovementVector() { return new Vector3(bindX - xCoord, bindY - yCoord, bindZ - zCoord);