abstracted out side buttons (thanks to this they also work on ctrls now)

This commit is contained in:
Raoul Van den Berge
2015-12-20 16:43:56 +01:00
parent d57618f990
commit 23a9b358bf
18 changed files with 322 additions and 158 deletions

View File

@@ -6,7 +6,7 @@ import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.tileentity.TileEntity;
import storagecraft.tile.TileMachine;
import storagecraft.tile.IRedstoneControllable;
public class MessageRedstoneModeUpdate implements IMessage, IMessageHandler<MessageRedstoneModeUpdate, IMessage> {
private int x;
@@ -16,10 +16,10 @@ public class MessageRedstoneModeUpdate implements IMessage, IMessageHandler<Mess
public MessageRedstoneModeUpdate() {
}
public MessageRedstoneModeUpdate(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
public MessageRedstoneModeUpdate(IRedstoneControllable control) {
this.x = control.getX();
this.y = control.getY();
this.z = control.getZ();
}
@Override
@@ -42,10 +42,10 @@ public class MessageRedstoneModeUpdate implements IMessage, IMessageHandler<Mess
TileEntity tile = player.worldObj.getTileEntity(message.x, message.y, message.z);
if (tile instanceof TileMachine) {
TileMachine machine = (TileMachine) tile;
if (tile instanceof IRedstoneControllable) {
IRedstoneControllable control = (IRedstoneControllable) tile;
machine.setRedstoneMode(machine.getRedstoneMode().next());
control.setRedstoneMode(control.getRedstoneMode().next());
}
return null;