diff --git a/src/main/java/draconicevolution/client/interfaces/GUIPlayerDetector.java b/src/main/java/draconicevolution/client/interfaces/GUIPlayerDetector.java index 3a881d2e..0e6cad82 100644 --- a/src/main/java/draconicevolution/client/interfaces/GUIPlayerDetector.java +++ b/src/main/java/draconicevolution/client/interfaces/GUIPlayerDetector.java @@ -20,6 +20,7 @@ import draconicevolution.common.core.network.PlayerDetectorButtonPacket; import draconicevolution.common.core.network.PlayerDetectorStringPacket; import draconicevolution.common.lib.References; import draconicevolution.common.tileentities.TilePlayerDetectorAdvanced; +import sun.misc.MessageUtils; @SideOnly(Side.CLIENT) public class GUIPlayerDetector extends GuiContainer @@ -39,6 +40,7 @@ public class GUIPlayerDetector extends GuiContainer private String[] names = new String[42]; private GuiTextField selectedNameText; private int selected = -1; + private boolean outputInverted = false; public GUIPlayerDetector(InventoryPlayer invPlayer, TilePlayerDetectorAdvanced detector) { super(detector.getGuiContainer(invPlayer)); @@ -93,8 +95,9 @@ public class GUIPlayerDetector extends GuiContainer int centre = width / 2; buttonList.add(new GuiButton(0, centre - 20 - 20, guiTop + 20, 20, 20, "+")); buttonList.add(new GuiButton(1, centre + 20, guiTop + 20, 20, 20, "-")); - buttonList.add(new GuiButton(3, centre - 40, guiTop + 60, 60, 20, wt)); - buttonList.add(new GuiButton(4, centre + 20, guiTop + 60, 20, 20, "!")); + buttonList.add(new GuiButton(3, centre - 40, guiTop + 45, 60, 20, wt)); + buttonList.add(new GuiButton(4, centre + 20, guiTop + 45, 20, 20, "!")); + buttonList.add(new GuiButton(6, centre - 40, guiTop + 70, 80, 20, "Invert Output")); } else { buttonList.add(new GuiButton(5, guiLeft - 40, guiTop + ySize - 20, 40, 20, "Back")); @@ -109,7 +112,8 @@ public class GUIPlayerDetector extends GuiContainer //ID //buttonList.add(new GuiButton(0, guiLeft + 85, guiTop , 85, 20, "sgASGgs")); - syncWithServer(); + + //syncWithServer(); } @Override @@ -142,6 +146,12 @@ public class GUIPlayerDetector extends GuiContainer ((ContainerPlayerDetector) this.inventorySlots).updateContainerSlots(); initScedualed = true; break; + case 6: //Back - + outputInverted = !outputInverted; + initScedualed = true; + byte val2 = (byte) (outputInverted ? 1 : 0); + DraconicEvolution.channelHandler.sendToServer(new PlayerDetectorButtonPacket((byte)2, val2)); + break; } //DraconicEvolution.channelHandler.sendToServer(new ButtonPacket((byte) 0, true)); @@ -209,7 +219,7 @@ public class GUIPlayerDetector extends GuiContainer @Override protected void mouseClicked(int x, int y, int par3) - { + { super.mouseClicked(x, y, par3); //Check if the camo slot was clicked @@ -232,6 +242,7 @@ public class GUIPlayerDetector extends GuiContainer drawCenteredString(fontRendererObj, "Advanced Player Detector", xSize/2, 5, 0x00FFFF); fontRendererObj.drawString("Range:", 73, 21, 0x000000, false); + fontRendererObj.drawString("Output Inverted: " + String.valueOf(outputInverted), 33, 97, 0x000000, false); if (range < 10) fontRendererObj.drawString("" + range, 85, 31, 0x000000, false); else @@ -307,5 +318,6 @@ public class GUIPlayerDetector extends GuiContainer names[i] = detector.names[i]; } range = detector.range; + outputInverted = detector.outputInverted; } } diff --git a/src/main/java/draconicevolution/common/blocks/PlayerDetectorAdvanced.java b/src/main/java/draconicevolution/common/blocks/PlayerDetectorAdvanced.java index a67434e7..955ec2c9 100644 --- a/src/main/java/draconicevolution/common/blocks/PlayerDetectorAdvanced.java +++ b/src/main/java/draconicevolution/common/blocks/PlayerDetectorAdvanced.java @@ -120,7 +120,10 @@ public class PlayerDetectorAdvanced extends BlockContainer TileEntity te = world.getTileEntity(x, y, z); TilePlayerDetectorAdvanced detector = (te != null && te instanceof TilePlayerDetectorAdvanced) ? (TilePlayerDetectorAdvanced) te : null; if(detector != null) - return detector.output ? 15 : 0; + if (!detector.outputInverted) + return detector.output ? 15 : 0; + else + return detector.output ? 0 : 15; else return 0; } diff --git a/src/main/java/draconicevolution/common/core/network/PlayerDetectorButtonPacket.java b/src/main/java/draconicevolution/common/core/network/PlayerDetectorButtonPacket.java index 06907924..a97afcd4 100644 --- a/src/main/java/draconicevolution/common/core/network/PlayerDetectorButtonPacket.java +++ b/src/main/java/draconicevolution/common/core/network/PlayerDetectorButtonPacket.java @@ -55,6 +55,9 @@ public class PlayerDetectorButtonPacket implements IPacket case 1: tile.whiteList = value == 1 ? true : false; break; + case 2: + tile.outputInverted = value == 1 ? true : false; + break; } player.playerEntity.worldObj.markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord); } diff --git a/src/main/java/draconicevolution/common/tileentities/TilePlayerDetectorAdvanced.java b/src/main/java/draconicevolution/common/tileentities/TilePlayerDetectorAdvanced.java index a1b25659..cdd22768 100644 --- a/src/main/java/draconicevolution/common/tileentities/TilePlayerDetectorAdvanced.java +++ b/src/main/java/draconicevolution/common/tileentities/TilePlayerDetectorAdvanced.java @@ -30,6 +30,7 @@ public class TilePlayerDetectorAdvanced extends TileEntity implements IInventory private int tick = 0; private int scanRate = 5; public boolean output = false; + public boolean outputInverted = false; List EntityList; AxisAlignedBB ScanBox; @@ -278,6 +279,7 @@ public class TilePlayerDetectorAdvanced extends TileEntity implements IInventory compound.setBoolean("WhiteList", whiteList); compound.setBoolean("Output", output); compound.setInteger("Range", range); + compound.setBoolean("OutputInverted", outputInverted); super.writeToNBT(compound); } @@ -299,6 +301,7 @@ public class TilePlayerDetectorAdvanced extends TileEntity implements IInventory whiteList = compound.getBoolean("WhiteList"); range = compound.getInteger("Range"); output = compound.getBoolean("Output"); + outputInverted = compound.getBoolean("OutputInverted"); super.readFromNBT(compound); }