Make it work more

This commit is contained in:
Raoul Van den Berge
2016-04-04 15:32:37 +02:00
parent 5a12c2fe60
commit 9e954a1df2
2 changed files with 17 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
package refinedstorage.tile;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.math.BlockPos;
import refinedstorage.block.BlockMachine;
@@ -12,8 +13,10 @@ public abstract class TileMachine extends TileBase implements INetworkTile, IRed
protected RedstoneMode redstoneMode = RedstoneMode.IGNORE;
protected TileController controller;
private Block machineBlock;
public void onConnected(TileController controller) {
if (worldObj != null && worldObj.getBlockState(pos).getBlock() == blockType) {
if (worldObj != null && worldObj.getBlockState(pos).getBlock() == machineBlock) {
markDirty();
this.connected = true;
@@ -24,7 +27,7 @@ public abstract class TileMachine extends TileBase implements INetworkTile, IRed
}
public void onDisconnected() {
if (worldObj != null && worldObj.getBlockState(pos).getBlock() == blockType) {
if (worldObj != null && worldObj.getBlockState(pos).getBlock() == machineBlock) {
markDirty();
this.connected = false;
@@ -40,9 +43,18 @@ public abstract class TileMachine extends TileBase implements INetworkTile, IRed
@Override
public void update() {
if (worldObj == null) {
super.update();
return;
}
if (ticks == 0) {
machineBlock = worldObj.getBlockState(pos).getBlock();
}
super.update();
if (worldObj != null && !worldObj.isRemote && isConnected()) {
if (!worldObj.isRemote && isConnected()) {
updateMachine();
}
}
@@ -75,7 +87,7 @@ public abstract class TileMachine extends TileBase implements INetworkTile, IRed
connected = buf.readBoolean();
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);
}
}

View File

@@ -13,6 +13,7 @@ import refinedstorage.util.HandUtils;
import java.util.List;
// @TODO: Fix this as well
public class WirelessGrid implements IGrid {
private ItemStack stack;
private EnumHand hand;