Luminizers no longer unbind automatically. This serves as a workaround for them getting unbound by chunkloading problems.

This commit is contained in:
Lizbeth Rika committed 2015-07-20 17:51:35 +01:00
1 parent 32f762c01b
commit 22f988e3bc
1 file changed
+8 -9
@@ -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);