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());
|
tempCmds.add(commandField.getText());
|
||||||
ItemDisk.setCommands(disk, tempCmds);
|
ItemDisk.setCommands(disk, tempCmds);
|
||||||
this.tileEntity.setInventorySlotContents(0, disk);
|
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("");
|
this.commandField.setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: // subtract
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class ContainerEncoder extends Container
|
||||||
ItemStack slotStack = slotObj.getStack();
|
ItemStack slotStack = slotObj.getStack();
|
||||||
copyStack = slotStack.copy();
|
copyStack = slotStack.copy();
|
||||||
|
|
||||||
if (slot > 1)
|
if (slot >= 1)
|
||||||
{
|
{
|
||||||
if (this.getSlot(0).isItemValid(slotStack))
|
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)
|
if (Command.getCommand(newCommand) != null && this.disk != null)
|
||||||
{
|
{
|
||||||
ArrayList<String> tempCmds = ItemDisk.getCommands(this.disk);
|
ArrayList<String> tempCmds = ItemDisk.getCommands(this.disk);
|
||||||
|
|
||||||
|
if (dataStream.readBoolean())
|
||||||
|
{
|
||||||
tempCmds.add(newCommand);
|
tempCmds.add(newCommand);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tempCmds.remove(newCommand);
|
||||||
|
}
|
||||||
|
|
||||||
ItemDisk.setCommands(this.disk, tempCmds);
|
ItemDisk.setCommands(this.disk, tempCmds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue