List of usage examples for io.netty.buffer ByteBuf readBoolean
public abstract boolean readBoolean();
From source file:com.builtbroken.icbm.content.crafting.station.small.auto.TileSMAutoCraft.java
@Override public boolean read(ByteBuf buf, int id, EntityPlayer player, PacketType type) { super.doUpdateGuiUsers(); if (!super.read(buf, id, player, type)) { if (isServer()) { if (id == 1) { doCrafting();//from ww w. ja v a 2s . com return true; } else if (id == 2) { openGui(player, buf.readInt(), ICBM.INSTANCE); return true; } //Gui updated some settings else if (id == 3) { isAutocrafting = buf.readBoolean(); requiresWarhead = buf.readBoolean(); requiresGuidance = buf.readBoolean(); requiresEngine = buf.readBoolean(); _doUpdateGuiUsers(); return true; } } return false; } return true; }
From source file:com.builtbroken.icbm.content.crafting.station.small.auto.TileSMAutoCraftClient.java
@Override public boolean read(ByteBuf buf, int id, EntityPlayer player, PacketType type) { super.doUpdateGuiUsers(); if (!super.read(buf, id, player, type)) { if (id == 5) { isAutocrafting = buf.readBoolean(); requiresWarhead = buf.readBoolean(); requiresGuidance = buf.readBoolean(); requiresEngine = buf.readBoolean(); //Reload GUI final GuiScreen screen = Minecraft.getMinecraft().currentScreen; if (screen instanceof GuiSMAutoCraft) { screen.initGui();/*from w ww. ja va 2 s. c om*/ } return true; } return false; } return true; }
From source file:com.builtbroken.icbm.content.crafting.station.warhead.TileWarheadStation.java
@Override public boolean read(ByteBuf buf, int id, EntityPlayer player, PacketType type) { super.doUpdateGuiUsers(); if (!super.read(buf, id, player, type)) { if (isServer()) { if (id == 1) { doCrafting();/*from ww w .j a va 2s . c o m*/ return true; } else if (id == 2) { openGui(player, buf.readInt(), ICBM.INSTANCE); return true; } //Gui updated some settings else if (id == 3) { isAutocrafting = buf.readBoolean(); explosiveStackSizeRequired = Math.min(Math.max(1, buf.readInt()), 64); requireExplosive = buf.readBoolean(); requireTrigger = buf.readBoolean(); _doUpdateGuiUsers(); return true; } } return false; } return true; }
From source file:com.builtbroken.icbm.content.crafting.station.warhead.TileWarheadStationClient.java
@Override public boolean read(ByteBuf buf, int id, EntityPlayer player, PacketType type) { super.doUpdateGuiUsers(); if (!super.read(buf, id, player, type)) { if (id == 5) { isAutocrafting = buf.readBoolean(); explosiveStackSizeRequired = buf.readInt(); requireExplosive = buf.readBoolean(); requireTrigger = buf.readBoolean(); //Reload GUI final GuiScreen screen = Minecraft.getMinecraft().currentScreen; if (screen instanceof GuiWarheadStation) { screen.initGui();//ww w . j a va 2 s. c om } return true; } return false; } return true; }
From source file:com.builtbroken.icbm.content.fof.TileFoF.java
@Override public boolean read(ByteBuf buf, int id, EntityPlayer player, PacketType type) { if (!super.read(buf, id, player, type)) { if (isServer()) { //Set FoF ID, Main Gui if (id == 2) { if (hasNode(player, Permissions.machineConfigure.toString())) { String change = ByteBufUtils.readUTF8String(buf); if (buf.readBoolean() && !archivedFoFIDs.contains(userFoFID)) { archivedFoFIDs.add(userFoFID); }/*from www.j av a2 s . co m*/ this.userFoFID = change; sendPacketToGuiUsers(new PacketTile(this, 1, "confirm")); } else { sendPacketToGuiUsers(new PacketTile(this, 1, "missing.perm")); } return true; } //Enable permission system, GuiSettings else if (id == 3) { if (hasNode(player, Permissions.machineConfigure.toString())) { if (buf.readBoolean()) { initProfile(); getAccessProfile().getOwnerGroup().addMember(new AccessUser(player)); } else { profile = null; globalProfileID = null; sendDescPacket(); } sendPacketToGuiUsers(new PacketTile(this, 1, "[1]confirm")); } else { sendPacketToGuiUsers(new PacketTile(this, 1, "[2]missing.perm")); } } //Clear FoF id archive, GuiSettings else if (id == 4) { if (hasNode(player, Permissions.machineConfigure.toString())) { int s = archivedFoFIDs.size(); archivedFoFIDs.clear(); sendPacketToGuiUsers(new PacketTile(this, 1, "[2]removed.ids{" + s + "}")); } else { sendPacketToGuiUsers(new PacketTile(this, 1, "[2]missing.perm")); } return true; } } return false; } return true; }
From source file:com.builtbroken.icbm.content.fof.TileFoFClient.java
@Override public void readDescPacket(ByteBuf buf) { super.readDescPacket(buf); this.hasProfile = buf.readBoolean(); }
From source file:com.builtbroken.icbm.content.fragments.EntityFragment.java
@Override public void readSpawnData(ByteBuf additionalData) { try {//ww w . j a va 2s.c o m byte i = additionalData.readByte(); if (i >= 0 && i < FragmentType.values().length) { fragmentType = FragmentType.values()[i]; } int blockID = additionalData.readInt(); if (i > -1) { fragmentMaterial = Block.getBlockById(blockID); } if (additionalData.readBoolean()) { renderShape = new Cube(additionalData); } } catch (Exception e) { ICBM.INSTANCE.logger().error("Failed to read spawn data for " + this); } }
From source file:com.builtbroken.icbm.content.launcher.controller.remote.display.TileSiloInterfaceClient.java
protected void readConnectorSet(ByteBuf buf) { //Do we have data if (buf.readBoolean()) { //Number of controllers we are about to read int controllers = buf.readInt(); if (controllers > 0) { this.controllers = new String[controllers]; this.controllerData = new Pos[controllers][]; for (int c = 0; c < controllers; c++) { String name = ByteBufUtils.readUTF8String(buf); name = (name.isEmpty() || name.equals("--")) ? "c" + c : name; this.controllers[c] = name; readCommandSiloConnector(c, buf); }/* www.j a v a2 s.co m*/ } else { //TODO show error saying no connection is provided } } }
From source file:com.builtbroken.icbm.content.missile.tile.TileCrashedMissile.java
@Override public void readDescPacket(ByteBuf buf) { ItemStack stack = ByteBufUtils.readItemStack(buf); missile = stack.getItem() instanceof IMissileItem ? ((IMissileItem) stack.getItem()).toMissile(stack) : null;//from www . j ava 2 s .c o m yaw = buf.readFloat(); pitch = buf.readFloat(); posOffset = new Pos(buf); if (buf.readBoolean()) { block = Block.getBlockFromName(ByteBufUtils.readUTF8String(buf)); meta = buf.readShort(); } }
From source file:com.builtbroken.icbm.content.rail.EntityMissileCart.java
@Override public void readSpawnData(ByteBuf additionalData) { super.readSpawnData(additionalData); setType(MissileCartTypes.values()[additionalData.readInt()]); if (additionalData.readBoolean()) { setCargo(ByteBufUtils.readItemStack(additionalData)); } else {/* www. j ava 2 s . co m*/ setCargo(null); } markBoundsInvalid(); }