net.minecraft.network.play.INetHandlerPlayClient Java Examples

The following examples show how to use net.minecraft.network.play.INetHandlerPlayClient. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EnderStorageCPH.java    From EnderStorage with MIT License 6 votes vote down vote up
@Override
public void handlePacket(PacketCustom packet, Minecraft mc, INetHandlerPlayClient handler) {
    switch (packet.getType()) {
        case 1:
            handleTilePacket(mc.theWorld, packet, packet.readCoord());
            break;
        case 2:
            int windowID = packet.readUByte();

            ((EnderItemStorage) EnderStorageManager.instance(true).getStorage(packet.readString(), packet.readUShort(), "item"))
                    .openClientGui(windowID, mc.thePlayer.inventory, packet.readString(), packet.readUByte());
            break;
        case 3:
            ((EnderItemStorage) EnderStorageManager.instance(true).getStorage(packet.readString(), packet.readUShort(), "item"))
                    .setClientOpen(packet.readBoolean() ? 1 : 0);
            break;
        case 4:
            TankSynchroniser.syncClient(packet.readUShort(), packet.readString(), packet.readFluidStack());
            break;
        case 5:
        case 6:
            handleTankTilePacket(mc.theWorld, packet.readCoord(), packet);
            break;
    }
}
 
Example #2
Source File: TranslocatorCPH.java    From Translocators with MIT License 6 votes vote down vote up
@Override
public void handlePacket(PacketCustom packet, Minecraft mc, INetHandlerPlayClient handler) {
    switch (packet.getType()) {
        case 1:
        case 2:
        case 3:
            TileEntity tile = mc.theWorld.getTileEntity(packet.readInt(), packet.readInt(), packet.readInt());
            if (tile instanceof ICustomPacketTile)
                ((ICustomPacketTile) tile).handleDescriptionPacket(packet);
            break;
        case 4:
            int windowId = packet.readUByte();
            GuiTranslocator gui = new GuiTranslocator(new ContainerItemTranslocator(
                    new InventorySimple(9, packet.readUShort(), packet.readString()), mc.thePlayer.inventory));
            ClientUtils.openSMPGui(windowId, gui);
            break;
        case 5:
            mc.thePlayer.openContainer.putStackInSlot(packet.readUByte(), packet.readItemStack(true));
            break;
    }
}
 
Example #3
Source File: NEIClientPacketHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public void handlePacket(PacketCustom packet, Minecraft mc, INetHandlerPlayClient netHandler) {
    switch (packet.getType()) {
        case 1:
            handleServerSideCheck(packet.readUByte(), packet.readString(), mc.world);
            break;
        case 10:
            handleLoginState(packet);
            break;
        case 11:
            handleActionDisableStateChange(packet);
            break;
        case 12:
            handleActionEnabled(packet);
            break;
        case 13:
            MagnetModeHandler.INSTANCE.trackMagnetItem(packet.readInt(), mc.world);
            break;
        case 14:
            handleGameMode(mc, packet.readUByte());
            break;
        case 21:
            ClientUtils.openSMPGui(packet.readUByte(), new GuiEnchantmentModifier(mc.player.inventory, mc.world));
            break;
        case 23:
            if (packet.readBoolean()) {
                ClientUtils.openSMPGui(packet.readUByte(), new GuiExtendedCreativeInv(new ContainerCreativeInv(mc.player, new ExtendedCreativeInv(null, Side.CLIENT))));
            } else {
                mc.displayGuiScreen(new GuiInventory(mc.player));
            }
            break;
        case 24:
            ClientUtils.openSMPGui(packet.readUByte(), new GuiPotionCreator(mc.player.inventory));
            break;
    }
}
 
Example #4
Source File: FWTile.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public void processPacket(INetHandlerPlayClient handler) {
	super.processPacket(handler);
	try {
		this.packet.processPacket((T) handler);
	} catch (ClassCastException | NoSuchMethodError e) {
		// Why did Mojang incompatibly replace getDescriptionPacket() with getUpdatePacket().
	}
}
 
Example #5
Source File: NEICPH.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public void handlePacket(PacketCustom packet, Minecraft mc, INetHandlerPlayClient netHandler) {
    switch (packet.getType()) {
        case 1:
            handleSMPCheck(packet.readUByte(), packet.readString(), mc.theWorld);
            break;
        case 10:
            handleLoginState(packet);
            break;
        case 11:
            handleActionDisabled(packet);
            break;
        case 12:
            handleActionEnabled(packet);
            break;
        case 13:
            ClientHandler.instance().addSMPMagneticItem(packet.readInt(), mc.theWorld);
            break;
        case 14:
            handleGamemode(mc, packet.readUByte());
            break;
        case 21:
            ClientUtils.openSMPGui(packet.readUByte(), new GuiEnchantmentModifier(mc.thePlayer.inventory, mc.theWorld));
            break;
        case 23:
            if (packet.readBoolean())
                ClientUtils.openSMPGui(packet.readUByte(), new GuiExtendedCreativeInv(new ContainerCreativeInv(mc.thePlayer, new ExtendedCreativeInv(null, Side.CLIENT))));
            else
                mc.displayGuiScreen(new GuiInventory(mc.thePlayer));
            break;
        case 24:
            ClientUtils.openSMPGui(packet.readUByte(), new GuiPotionCreator(mc.thePlayer.inventory));
            break;
    }
}
 
Example #6
Source File: PacketCustom.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void handle(final INetHandler netHandler, final String channel, final PacketCustom packet) {
    if (netHandler instanceof INetHandlerPlayClient) {
        Minecraft mc = Minecraft.getMinecraft();
        if (!mc.isCallingFromMinecraftThread())
            mc.addScheduledTask(new Runnable() {
                public void run() {
                    handle(netHandler, channel, packet);
                }
            });
        else
            handler.handlePacket(packet, mc, (INetHandlerPlayClient) netHandler);
    } else
        System.err.println("Invalid INetHandler for PacketCustom on channel: " + channel);
}
 
Example #7
Source File: MixinS2EPacketCloseWindow.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Inject(method = "processPacket", at = @At("HEAD"), cancellable = true)
private void processPacket(INetHandlerPlayClient handler, CallbackInfo ci) {
    if (Minecraft.getMinecraft().currentScreen instanceof GuiChat) ci.cancel();
}
 
Example #8
Source File: ChunkLoaderCPH.java    From ChickenChunks with MIT License 4 votes vote down vote up
@Override
public void handlePacket(PacketCustom packet, Minecraft mc, INetHandlerPlayClient handler) {
    switch (packet.getType()) {
        case 1:
            PlayerChunkViewer.openViewer((int) mc.thePlayer.posX, (int) mc.thePlayer.posZ, CommonUtils.getDimension(mc.theWorld));
            break;
        case 2:
            PlayerChunkViewer.instance().loadDimension(packet, mc.theWorld);
            break;
        case 3:
            PlayerChunkViewer.instance().unloadDimension(packet.readInt());
            break;
        case 4:
            PlayerChunkViewer.instance().handleChunkChange(
                    packet.readInt(),
                    new ChunkCoordIntPair(packet.readInt(), packet.readInt()),
                    packet.readBoolean());
            break;
        case 5:
            PlayerChunkViewer.instance().handleTicketChange(
                    packet.readInt(),
                    packet.readInt(),
                    new ChunkCoordIntPair(packet.readInt(), packet.readInt()),
                    packet.readBoolean());
            break;
        case 6:
            PlayerChunkViewer.instance().handlePlayerUpdate(
                    packet.readString(), packet.readInt(),
                    new Vector3(packet.readFloat(), packet.readFloat(), packet.readFloat()));
            break;
        case 7:
            PlayerChunkViewer.instance().removePlayer(packet.readString());
            break;
        case 8:
            PlayerChunkViewer.instance().handleNewTicket(packet, mc.theWorld);
            break;
        case 10:
            TileChunkLoader.handleDescriptionPacket(packet, mc.theWorld);
            break;
        case 11:
            TileSpotLoader.handleDescriptionPacket(packet, mc.theWorld);
            break;
        case 12:
            BlockCoord pos = packet.readCoord();
            TileEntity tile = mc.theWorld.getTileEntity(pos.x, pos.y, pos.z);
            if (tile instanceof TileChunkLoader)
                mc.displayGuiScreen(new GuiChunkLoader((TileChunkLoader) tile));
            break;

    }
}
 
Example #9
Source File: WRAddonCPH.java    From WirelessRedstone with MIT License 4 votes vote down vote up
@Override
public void handlePacket(PacketCustom packet, Minecraft mc, INetHandlerPlayClient handler) {
    handlePacket(mc.theWorld, mc.thePlayer, packet);
}
 
Example #10
Source File: WRCoreCPH.java    From WirelessRedstone with MIT License 4 votes vote down vote up
@Override
public void handlePacket(PacketCustom packet, Minecraft mc, INetHandlerPlayClient handler) {
    handlePacket(mc.theWorld, mc.thePlayer, packet);
    for (IClientPacketHandler delegate : delegates)
        delegate.handlePacket(packet, mc, handler);
}
 
Example #11
Source File: PacketCustom.java    From CodeChickenLib with GNU Lesser General Public License v2.1 votes vote down vote up
public void handlePacket(PacketCustom packetCustom, Minecraft mc, INetHandlerPlayClient handler);