use of blusunrize.immersiveengineering.common.util.network.MessageTileSync in project ImmersiveEngineering by BluSunrize.
the class GuiMixer method actionPerformed.
@Override
protected void actionPerformed(GuiButton button) {
if (button.id == 0) {
NBTTagCompound tag = new NBTTagCompound();
tile.outputAll = ((GuiButtonState) button).state;
tag.setBoolean("outputAll", tile.outputAll);
ImmersiveEngineering.packetHandler.sendToServer(new MessageTileSync(tile, tag));
this.initGui();
}
}
use of blusunrize.immersiveengineering.common.util.network.MessageTileSync in project ImmersiveEngineering by BluSunrize.
the class GuiTurret method actionPerformed.
@Override
protected void actionPerformed(GuiButton button) {
NBTTagCompound tag = new NBTTagCompound();
int listOffset = -1;
if (button.id == 0) {
int rem = ((GuiReactiveList) button).selectedOption;
tile.targetList.remove(rem);
tag.setInteger("remove", rem);
listOffset = ((GuiReactiveList) button).getOffset() - 1;
} else if (button.id == 1 && !this.nameField.getText().isEmpty()) {
String name = this.nameField.getText();
if (!tile.targetList.contains(name)) {
listOffset = ((GuiReactiveList) buttonList.get(0)).getMaxOffset();
tag.setString("add", name);
tile.targetList.add(name);
}
this.nameField.setText("");
} else if (button.id == 2) {
tile.whitelist = !((GuiButtonState) button).state;
tag.setBoolean("whitelist", tile.whitelist);
} else if (button.id == 3) {
tile.attackAnimals = ((GuiButtonState) button).state;
tag.setBoolean("attackAnimals", tile.attackAnimals);
} else if (button.id == 4) {
tile.attackPlayers = ((GuiButtonState) button).state;
tag.setBoolean("attackPlayers", tile.attackPlayers);
} else if (button.id == 5) {
tile.attackNeutrals = ((GuiButtonState) button).state;
tag.setBoolean("attackNeutrals", tile.attackNeutrals);
} else if (button.id == 6 && tile instanceof TileEntityTurretChem) {
((TileEntityTurretChem) tile).ignite = ((GuiButtonState) button).state;
tag.setBoolean("ignite", ((TileEntityTurretChem) tile).ignite);
} else if (button.id == 6 && tile instanceof TileEntityTurretGun) {
((TileEntityTurretGun) tile).expelCasings = ((GuiButtonState) button).state;
tag.setBoolean("expelCasings", ((TileEntityTurretGun) tile).expelCasings);
}
if (!tag.hasNoTags()) {
ImmersiveEngineering.packetHandler.sendToServer(new MessageTileSync(tile, tag));
this.initGui();
if (listOffset >= 0)
((GuiReactiveList) this.buttonList.get(0)).setOffset(listOffset);
}
}
use of blusunrize.immersiveengineering.common.util.network.MessageTileSync in project ImmersiveEngineering by BluSunrize.
the class GuiAutoWorkbench method actionPerformed.
@Override
protected void actionPerformed(GuiButton button) throws IOException {
if (button instanceof GuiButtonItem) {
if (//disable
button.id == tile.selectedRecipe)
tile.selectedRecipe = -1;
else
tile.selectedRecipe = button.id;
NBTTagCompound message = new NBTTagCompound();
message.setInteger("recipe", tile.selectedRecipe);
ImmersiveEngineering.packetHandler.sendToServer(new MessageTileSync(this.tile, message));
initGui();
}
}
use of blusunrize.immersiveengineering.common.util.network.MessageTileSync in project ImmersiveEngineering by BluSunrize.
the class GuiModWorkbench method mouseReleased.
@Override
protected void mouseReleased(int mouseX, int mouseY, int state) {
super.mouseReleased(mouseX, mouseY, state);
Slot s = inventorySlots.getSlot(0);
if (s != null && s.getHasStack() && s.getStack().getItem() instanceof IConfigurableTool) {
ItemStack stack = s.getStack();
IConfigurableTool tool = ((IConfigurableTool) stack.getItem());
NBTTagCompound message = new NBTTagCompound();
ToolConfigBoolean[] boolArray = tool.getBooleanOptions(stack);
int iBool = 0;
ToolConfigFloat[] floatArray = tool.getFloatOptions(stack);
int iFloat = 0;
for (GuiButton button : this.buttonList) {
if (button instanceof GuiButtonCheckbox && boolArray != null)
message.setBoolean("b_" + boolArray[iBool++].name, ((GuiButtonCheckbox) button).state);
if (button instanceof GuiSliderIE && floatArray != null)
message.setFloat("f_" + floatArray[iFloat++].name, (float) ((GuiSliderIE) button).sliderValue);
}
if (//Only send packets when values have changed
lastMessage == null || !lastMessage.equals(message))
ImmersiveEngineering.packetHandler.sendToServer(new MessageTileSync(this.workbench, message));
lastMessage = message;
}
}
use of blusunrize.immersiveengineering.common.util.network.MessageTileSync in project ImmersiveEngineering by BluSunrize.
the class TileEntityTeslaCoil method sendRenderPacket.
protected void sendRenderPacket(Entity target) {
NBTTagCompound tag = new NBTTagCompound();
tag.setInteger("targetEntity", target.getEntityId());
ImmersiveEngineering.packetHandler.sendToAll(new MessageTileSync(this, tag));
}
Aggregations