Make it work more
This commit is contained in:
		| @@ -1,6 +1,7 @@ | |||||||
| package refinedstorage.tile; | package refinedstorage.tile; | ||||||
|  |  | ||||||
| import io.netty.buffer.ByteBuf; | import io.netty.buffer.ByteBuf; | ||||||
|  | import net.minecraft.block.Block; | ||||||
| import net.minecraft.nbt.NBTTagCompound; | import net.minecraft.nbt.NBTTagCompound; | ||||||
| import net.minecraft.util.math.BlockPos; | import net.minecraft.util.math.BlockPos; | ||||||
| import refinedstorage.block.BlockMachine; | import refinedstorage.block.BlockMachine; | ||||||
| @@ -12,8 +13,10 @@ public abstract class TileMachine extends TileBase implements INetworkTile, IRed | |||||||
|     protected RedstoneMode redstoneMode = RedstoneMode.IGNORE; |     protected RedstoneMode redstoneMode = RedstoneMode.IGNORE; | ||||||
|     protected TileController controller; |     protected TileController controller; | ||||||
|  |  | ||||||
|  |     private Block machineBlock; | ||||||
|  |  | ||||||
|     public void onConnected(TileController controller) { |     public void onConnected(TileController controller) { | ||||||
|         if (worldObj != null && worldObj.getBlockState(pos).getBlock() == blockType) { |         if (worldObj != null && worldObj.getBlockState(pos).getBlock() == machineBlock) { | ||||||
|             markDirty(); |             markDirty(); | ||||||
|  |  | ||||||
|             this.connected = true; |             this.connected = true; | ||||||
| @@ -24,7 +27,7 @@ public abstract class TileMachine extends TileBase implements INetworkTile, IRed | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void onDisconnected() { |     public void onDisconnected() { | ||||||
|         if (worldObj != null && worldObj.getBlockState(pos).getBlock() == blockType) { |         if (worldObj != null && worldObj.getBlockState(pos).getBlock() == machineBlock) { | ||||||
|             markDirty(); |             markDirty(); | ||||||
|  |  | ||||||
|             this.connected = false; |             this.connected = false; | ||||||
| @@ -40,9 +43,18 @@ public abstract class TileMachine extends TileBase implements INetworkTile, IRed | |||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public void update() { |     public void update() { | ||||||
|  |         if (worldObj == null) { | ||||||
|  |             super.update(); | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if (ticks == 0) { | ||||||
|  |             machineBlock = worldObj.getBlockState(pos).getBlock(); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         super.update(); |         super.update(); | ||||||
|  |  | ||||||
|         if (worldObj != null && !worldObj.isRemote && isConnected()) { |         if (!worldObj.isRemote && isConnected()) { | ||||||
|             updateMachine(); |             updateMachine(); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -75,7 +87,7 @@ public abstract class TileMachine extends TileBase implements INetworkTile, IRed | |||||||
|         connected = buf.readBoolean(); |         connected = buf.readBoolean(); | ||||||
|  |  | ||||||
|         if (lastConnected != connected) { |         if (lastConnected != connected) { | ||||||
|             // @TODO: make this work and use correct flags? |             // @TODO: Am I using the correct flags? | ||||||
|             worldObj.notifyBlockUpdate(pos, worldObj.getBlockState(pos), worldObj.getBlockState(pos), 2 | 4); |             worldObj.notifyBlockUpdate(pos, worldObj.getBlockState(pos), worldObj.getBlockState(pos), 2 | 4); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -13,6 +13,7 @@ import refinedstorage.util.HandUtils; | |||||||
|  |  | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  |  | ||||||
|  | // @TODO: Fix this as well | ||||||
| public class WirelessGrid implements IGrid { | public class WirelessGrid implements IGrid { | ||||||
|     private ItemStack stack; |     private ItemStack stack; | ||||||
|     private EnumHand hand; |     private EnumHand hand; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Raoul Van den Berge
					Raoul Van den Berge