mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-10-26 14:24:14 +00:00
Added option to invert redstone output
This commit is contained in:
1 parent
58a892f6f5
commit
b35fb21038
4 files changed
+26
-5
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<EntityLiving> 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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user