/** * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks, * beacons, skulls, flowerpot */ public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); if (this.gameController.world.isBlockLoaded(packetIn.getPos())) { TileEntity tileentity = this.gameController.world.getTileEntity(packetIn.getPos()); int i = packetIn.getTileEntityType(); boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock; if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign || i == 10 && tileentity instanceof TileEntityShulkerBox) { tileentity.readFromNBT(packetIn.getNbtCompound()); } if (flag && this.gameController.currentScreen instanceof GuiCommandBlock) { ((GuiCommandBlock)this.gameController.currentScreen).updateGui(); } } }
@Override public void onReceiveClient(Minecraft client, WorldClient world, EntityPlayerSP player, MessageContext context) { BlockSystem blockSystem = BlockSystems.PROXY.getBlockSystemHandler(world).getBlockSystem(this.blockSystem); if (blockSystem != null) { if (blockSystem.isBlockLoaded(this.pos)) { TileEntity blockEntity = blockSystem.getTileEntity(this.pos); boolean commandBlock = this.type == 2 && blockEntity instanceof TileEntityCommandBlock; if (this.type == 1 && blockEntity instanceof TileEntityMobSpawner || commandBlock || this.type == 3 && blockEntity instanceof TileEntityBeacon || this.type == 4 && blockEntity instanceof TileEntitySkull || this.type == 5 && blockEntity instanceof TileEntityFlowerPot || this.type == 6 && blockEntity instanceof TileEntityBanner || this.type == 7 && blockEntity instanceof TileEntityStructure || this.type == 8 && blockEntity instanceof TileEntityEndGateway || this.type == 9 && blockEntity instanceof TileEntitySign) { blockEntity.readFromNBT(this.data); } else { blockEntity.onDataPacket(client.getConnection().getNetworkManager(), new SPacketUpdateTileEntity(this.pos, this.type, this.data)); } if (commandBlock && client.currentScreen instanceof GuiCommandBlock) { ((GuiCommandBlock) client.currentScreen).updateGui(); } } } }
@Override public void initGui() { super.initGui(); buttonList.add(new GuiButton(ColorData.FORMAT_BUTTON_ID, width / 2 - 100, height / 4 + 132 + 20, ColorData.FORMAT_BUTTON_STR)); try { text = new UnfilteredTextField(2, this.fontRendererObj, this.width / 2 - 150, 60, 300, 20); text.setMaxStringLength(32767); text.setFocused(true); text.setText( cmd.getCustomName() ); // getCommand Class c = GuiCommandBlock.class; Field f = c.getDeclaredFields()[ 1 ]; f.setAccessible( true ); f.set( this, text ); } catch ( Exception exception ) { exception.printStackTrace(); } }
/** * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks, * beacons, skulls, flowerpot */ public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) { TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos()); int i = packetIn.getTileEntityType(); boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock; if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign) { tileentity.readFromNBT(packetIn.getNbtCompound()); } else { tileentity.onDataPacket(netManager, packetIn); } if (flag && this.gameController.currentScreen instanceof GuiCommandBlock) { ((GuiCommandBlock)this.gameController.currentScreen).updateGui(); } } }
/** * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks, * beacons, skulls, flowerpot */ public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) { TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos()); int i = packetIn.getTileEntityType(); boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock; if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign) { tileentity.readFromNBT(packetIn.getNbtCompound()); } else { if(tileentity == null) { LOGGER.error("Received invalid update packet for null tile entity at {} with data: {}", packetIn.getPos(), packetIn.getNbtCompound()); return; } tileentity.onDataPacket(netManager, packetIn); } if (flag && this.gameController.currentScreen instanceof GuiCommandBlock) { ((GuiCommandBlock)this.gameController.currentScreen).updateGui(); } } }
public void func_146100_a(TileEntity p_146100_1_) { if (p_146100_1_ instanceof TileEntitySign) { this.mc.displayGuiScreen(new GuiEditSign((TileEntitySign)p_146100_1_)); } else if (p_146100_1_ instanceof TileEntityCommandBlock) { this.mc.displayGuiScreen(new GuiCommandBlock(((TileEntityCommandBlock)p_146100_1_).func_145993_a())); } }
@EventHandler public void init(FMLInitializationEvent e) { MinecraftForge.EVENT_BUS.register(this); GuiReplacementRegistry.getInstance().registerReplacement(GuiCommandBlock.class, GuiNewCommandBlock.class); readFromConfig(); }
public void func_71014_a(TileEntity p_71014_1_) { if(p_71014_1_ instanceof TileEntitySign) { this.field_71159_c.func_71373_a(new GuiEditSign((TileEntitySign)p_71014_1_)); } else if(p_71014_1_ instanceof TileEntityCommandBlock) { this.field_71159_c.func_71373_a(new GuiCommandBlock((TileEntityCommandBlock)p_71014_1_)); } }
/** * Displays the GUI for editing a sign. Args: tileEntitySign */ public void displayGUIEditSign(TileEntity par1TileEntity) { if (par1TileEntity instanceof TileEntitySign) { this.mc.displayGuiScreen(new GuiEditSign((TileEntitySign)par1TileEntity)); } else if (par1TileEntity instanceof TileEntityCommandBlock) { this.mc.displayGuiScreen(new GuiCommandBlock((TileEntityCommandBlock)par1TileEntity)); } }
public void openEditCommandBlock(CommandBlockLogic cmdBlockLogic) { this.mc.displayGuiScreen(new GuiCommandBlock(cmdBlockLogic)); }
public void displayGuiCommandBlock(TileEntityCommandBlock commandBlock) { this.mc.displayGuiScreen(new GuiCommandBlock(commandBlock)); }
public void func_146095_a(CommandBlockLogic p_146095_1_) { this.mc.displayGuiScreen(new GuiCommandBlock(p_146095_1_)); }
public GuiNewCommandBlock(GuiCommandBlock old) throws Exception { super((TileEntityCommandBlock) commandBlockField.get(old)); commandBlock = (TileEntityCommandBlock) commandBlockField.get(old); }
public void displayGuiCommandBlock(TileEntityCommandBlock p_184824_1_) { this.mc.displayGuiScreen(new GuiCommandBlock(p_184824_1_)); }