Search in sources :

Example 1 with GuiCommandBlock

use of net.minecraft.client.gui.GuiCommandBlock in project CumServerPro by MCUmbrella.

the class NetHandlerPlayClient method handleUpdateTileEntity.

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 || i == 11 && tileentity instanceof TileEntityBed) {
            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();
        }
    }
}
Also used : TileEntityBeacon(net.minecraft.tileentity.TileEntityBeacon) GuiCommandBlock(net.minecraft.client.gui.GuiCommandBlock) TileEntityStructure(net.minecraft.tileentity.TileEntityStructure) TileEntityCommandBlock(net.minecraft.tileentity.TileEntityCommandBlock) TileEntityShulkerBox(net.minecraft.tileentity.TileEntityShulkerBox) TileEntityBed(net.minecraft.tileentity.TileEntityBed) TileEntityEndGateway(net.minecraft.tileentity.TileEntityEndGateway) SPacketUpdateTileEntity(net.minecraft.network.play.server.SPacketUpdateTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) TileEntitySign(net.minecraft.tileentity.TileEntitySign) TileEntitySkull(net.minecraft.tileentity.TileEntitySkull) TileEntityMobSpawner(net.minecraft.tileentity.TileEntityMobSpawner) TileEntityFlowerPot(net.minecraft.tileentity.TileEntityFlowerPot) TileEntityBanner(net.minecraft.tileentity.TileEntityBanner)

Example 2 with GuiCommandBlock

use of net.minecraft.client.gui.GuiCommandBlock in project Minecraft-SlientClient-Hack by YouNeverKnow00.

the class NetHandlerPlayClient method handleUpdateTileEntity.

/**
 * 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 || i == 11 && tileentity instanceof TileEntityBed) {
            tileentity.readFromNBT(packetIn.getNbtCompound());
        }
        if (flag && this.gameController.currentScreen instanceof GuiCommandBlock) {
            ((GuiCommandBlock) this.gameController.currentScreen).updateGui();
        }
    }
}
Also used : TileEntityBeacon(net.minecraft.tileentity.TileEntityBeacon) GuiCommandBlock(net.minecraft.client.gui.GuiCommandBlock) TileEntityStructure(net.minecraft.tileentity.TileEntityStructure) TileEntityCommandBlock(net.minecraft.tileentity.TileEntityCommandBlock) TileEntityShulkerBox(net.minecraft.tileentity.TileEntityShulkerBox) TileEntityBed(net.minecraft.tileentity.TileEntityBed) TileEntityEndGateway(net.minecraft.tileentity.TileEntityEndGateway) SPacketUpdateTileEntity(net.minecraft.network.play.server.SPacketUpdateTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) TileEntitySign(net.minecraft.tileentity.TileEntitySign) TileEntitySkull(net.minecraft.tileentity.TileEntitySkull) TileEntityMobSpawner(net.minecraft.tileentity.TileEntityMobSpawner) TileEntityFlowerPot(net.minecraft.tileentity.TileEntityFlowerPot) TileEntityBanner(net.minecraft.tileentity.TileEntityBanner)

Aggregations

GuiCommandBlock (net.minecraft.client.gui.GuiCommandBlock)2 SPacketUpdateTileEntity (net.minecraft.network.play.server.SPacketUpdateTileEntity)2 TileEntity (net.minecraft.tileentity.TileEntity)2 TileEntityBanner (net.minecraft.tileentity.TileEntityBanner)2 TileEntityBeacon (net.minecraft.tileentity.TileEntityBeacon)2 TileEntityBed (net.minecraft.tileentity.TileEntityBed)2 TileEntityCommandBlock (net.minecraft.tileentity.TileEntityCommandBlock)2 TileEntityEndGateway (net.minecraft.tileentity.TileEntityEndGateway)2 TileEntityFlowerPot (net.minecraft.tileentity.TileEntityFlowerPot)2 TileEntityMobSpawner (net.minecraft.tileentity.TileEntityMobSpawner)2 TileEntityShulkerBox (net.minecraft.tileentity.TileEntityShulkerBox)2 TileEntitySign (net.minecraft.tileentity.TileEntitySign)2 TileEntitySkull (net.minecraft.tileentity.TileEntitySkull)2 TileEntityStructure (net.minecraft.tileentity.TileEntityStructure)2