Added command subtraction
This commit is contained in:
parent
f9ed7dbf60
commit
2d3de9991c
3 changed files with 31 additions and 3 deletions
|
@ -100,16 +100,35 @@ public class GuiEncoder extends GuiContainer implements IInventoryWatcher
|
|||
tempCmds.add(commandField.getText());
|
||||
ItemDisk.setCommands(disk, tempCmds);
|
||||
this.tileEntity.setInventorySlotContents(0, disk);
|
||||
PacketDispatcher.sendPacketToServer(PacketManager.getPacket(AssemblyLine.CHANNEL, this.tileEntity, (String) this.commandField.getText()));
|
||||
PacketDispatcher.sendPacketToServer(PacketManager.getPacket(AssemblyLine.CHANNEL, this.tileEntity, (String) this.commandField.getText(), true));
|
||||
}
|
||||
}
|
||||
|
||||
this.commandField.setText("");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 1: // subtract
|
||||
{
|
||||
if (!this.commandField.getText().equals(""))
|
||||
{
|
||||
if (this.tileEntity != null)
|
||||
{
|
||||
ItemStack disk = this.tileEntity.getStackInSlot(0);
|
||||
|
||||
if (disk != null && Command.getCommand(this.commandField.getText()) != null)
|
||||
{
|
||||
ArrayList<String> tempCmds = ItemDisk.getCommands(disk);
|
||||
tempCmds.remove(commandField.getText());
|
||||
ItemDisk.setCommands(disk, tempCmds);
|
||||
this.tileEntity.setInventorySlotContents(0, disk);
|
||||
PacketDispatcher.sendPacketToServer(PacketManager.getPacket(AssemblyLine.CHANNEL, this.tileEntity, (String) this.commandField.getText(), false));
|
||||
}
|
||||
}
|
||||
|
||||
this.commandField.setText("");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class ContainerEncoder extends Container
|
|||
ItemStack slotStack = slotObj.getStack();
|
||||
copyStack = slotStack.copy();
|
||||
|
||||
if (slot > 1)
|
||||
if (slot >= 1)
|
||||
{
|
||||
if (this.getSlot(0).isItemValid(slotStack))
|
||||
{
|
||||
|
|
|
@ -168,7 +168,16 @@ public class TileEntityEncoder extends TileEntityAdvanced implements IPacketRece
|
|||
if (Command.getCommand(newCommand) != null && this.disk != null)
|
||||
{
|
||||
ArrayList<String> tempCmds = ItemDisk.getCommands(this.disk);
|
||||
tempCmds.add(newCommand);
|
||||
|
||||
if (dataStream.readBoolean())
|
||||
{
|
||||
tempCmds.add(newCommand);
|
||||
}
|
||||
else
|
||||
{
|
||||
tempCmds.remove(newCommand);
|
||||
}
|
||||
|
||||
ItemDisk.setCommands(this.disk, tempCmds);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue