Java 类net.minecraft.network.play.client.CPacketClickWindow 实例源码

项目:Zombe-Modpack    文件:PlayerControllerMP.java   
/**
 * Handles slot clicks, sends a packet to the server.
 */
public ItemStack windowClick(int windowId, int slotId, int mouseButton, ClickType type, EntityPlayer player)
{
    short short1 = player.openContainer.getNextTransactionID(player.inventory);
    ItemStack itemstack = player.openContainer.slotClick(slotId, mouseButton, type, player);
    this.connection.sendPacket(new CPacketClickWindow(windowId, slotId, mouseButton, type, itemstack, short1));
    return itemstack;
}
项目:Backmemed    文件:PlayerControllerMP.java   
/**
 * Handles slot clicks, sends a packet to the server.
 */
public ItemStack windowClick(int windowId, int slotId, int mouseButton, ClickType type, EntityPlayer player)
{
    short short1 = player.openContainer.getNextTransactionID(player.inventory);
    ItemStack itemstack = player.openContainer.slotClick(slotId, mouseButton, type, player);
    this.connection.sendPacket(new CPacketClickWindow(windowId, slotId, mouseButton, type, itemstack, short1));
    return itemstack;
}
项目:CustomWorldGen    文件:PlayerControllerMP.java   
/**
 * Handles slot clicks, sends a packet to the server.
 */
public ItemStack windowClick(int windowId, int slotId, int mouseButton, ClickType type, EntityPlayer player)
{
    short short1 = player.openContainer.getNextTransactionID(player.inventory);
    ItemStack itemstack = player.openContainer.slotClick(slotId, mouseButton, type, player);
    this.connection.sendPacket(new CPacketClickWindow(windowId, slotId, mouseButton, type, itemstack, short1));
    return itemstack;
}
项目:ExpandedRailsMod    文件:PlayerControllerMP.java   
/**
 * Handles slot clicks, sends a packet to the server.
 */
public ItemStack windowClick(int windowId, int slotId, int mouseButton, ClickType type, EntityPlayer player)
{
    short short1 = player.openContainer.getNextTransactionID(player.inventory);
    ItemStack itemstack = player.openContainer.slotClick(slotId, mouseButton, type, player);
    this.connection.sendPacket(new CPacketClickWindow(windowId, slotId, mouseButton, type, itemstack, short1));
    return itemstack;
}
项目:ControlPack    文件:MixinGuiFurnace.java   
private void addToSendQueue(int slotNumber, int mouseButton, ItemStack stack) {
    //if (mc.isMultiplayerWorld()) {
        short actionnum = mc.player.openContainer.getNextTransactionID(mc.player.inventory);
        // i = windowid, slot num, mouse, shift, itemstack, action
        mc.getConnection().sendPacket(new CPacketClickWindow(inventorySlots.windowId, slotNumber, mouseButton, ClickType.PICKUP, stack, actionnum));
    //}
}
项目:ControlPack    文件:MixinGuiFurnace.java   
private void addToSendQueue(int slotNumber, int mouseButton, ItemStack stack) {
    //if (mc.isMultiplayerWorld()) {
        short actionnum = mc.player.openContainer.getNextTransactionID(mc.player.inventory);
        // i = windowid, slot num, mouse, shift, itemstack, action
        mc.getConnection().sendPacket(new CPacketClickWindow(inventorySlots.windowId, slotNumber, mouseButton, ClickType.PICKUP, stack, actionnum));
    //}
}
项目:ControlPack    文件:MixinGuiFurnace.java   
private void addToSendQueue(int slotNumber, int mouseButton, ItemStack stack) {
    //if (mc.isMultiplayerWorld()) {
        short actionnum = mc.player.openContainer.getNextTransactionID(mc.player.inventory);
        // i = windowid, slot num, mouse, shift, itemstack, action
        mc.getConnection().sendPacket(new CPacketClickWindow(inventorySlots.windowId, slotNumber, mouseButton, ClickType.PICKUP, stack, actionnum));
    //}
}
项目:Zombe-Modpack    文件:NetHandlerPlayServer.java   
/**
 * Executes a container/inventory slot manipulation as indicated by the packet. Sends the serverside result if they
 * didn't match the indicated result and prevents further manipulation by the player until he confirms that it has
 * the same open container/inventory
 */
public void processClickWindow(CPacketClickWindow packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
    this.playerEntity.markPlayerActive();

    if (this.playerEntity.openContainer.windowId == packetIn.getWindowId() && this.playerEntity.openContainer.getCanCraft(this.playerEntity))
    {
        if (this.playerEntity.isSpectator())
        {
            NonNullList<ItemStack> nonnulllist = NonNullList.<ItemStack>func_191196_a();

            for (int i = 0; i < this.playerEntity.openContainer.inventorySlots.size(); ++i)
            {
                nonnulllist.add(((Slot)this.playerEntity.openContainer.inventorySlots.get(i)).getStack());
            }

            this.playerEntity.updateCraftingInventory(this.playerEntity.openContainer, nonnulllist);
        }
        else
        {
            ItemStack itemstack2 = this.playerEntity.openContainer.slotClick(packetIn.getSlotId(), packetIn.getUsedButton(), packetIn.getClickType(), this.playerEntity);

            if (ItemStack.areItemStacksEqual(packetIn.getClickedItem(), itemstack2))
            {
                this.playerEntity.connection.sendPacket(new SPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), true));
                this.playerEntity.isChangingQuantityOnly = true;
                this.playerEntity.openContainer.detectAndSendChanges();
                this.playerEntity.updateHeldItem();
                this.playerEntity.isChangingQuantityOnly = false;
            }
            else
            {
                this.pendingTransactions.addKey(this.playerEntity.openContainer.windowId, Short.valueOf(packetIn.getActionNumber()));
                this.playerEntity.connection.sendPacket(new SPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), false));
                this.playerEntity.openContainer.setCanCraft(this.playerEntity, false);
                NonNullList<ItemStack> nonnulllist1 = NonNullList.<ItemStack>func_191196_a();

                for (int j = 0; j < this.playerEntity.openContainer.inventorySlots.size(); ++j)
                {
                    ItemStack itemstack = ((Slot)this.playerEntity.openContainer.inventorySlots.get(j)).getStack();
                    ItemStack itemstack1 = itemstack.func_190926_b() ? ItemStack.field_190927_a : itemstack;
                    nonnulllist1.add(itemstack1);
                }

                this.playerEntity.updateCraftingInventory(this.playerEntity.openContainer, nonnulllist1);
            }
        }
    }
}
项目:PacketControl    文件:PacketRegistryModule.java   
@DelayedRegistration(RegistrationPhase.PRE_INIT)
@Override
public void registerDefaults() {
    // Handshake
    register("handshake", "Handshake", PacketSide.SERVERBOUND, PacketPhase.HANDSHAKE, C00Handshake.class);

    // Entity
    clientbound("destroy_entities", "Destroy Entities", SPacketDestroyEntities.class, PacketControlFactory::createDestroyEntities);
    clientbound("entity_metadata", "Entity Metadata", SPacketEntityMetadata.class, PacketControlFactory::createEntityMetadata);
    clientbound("entity_velocity", "Entity Velocity", SPacketEntityVelocity.class);
    clientbound("spawn_experience_orb", "Spawn Experience Orb", SPacketSpawnExperienceOrb.class);
    clientbound("spawn_global_entity", "Spawn Global Entity", SPacketSpawnGlobalEntity.class);
    clientbound("spawn_mob", "Spawn Mob", SPacketSpawnMob.class);
    clientbound("spawn_object", "Spawn Object", SPacketSpawnObject.class, PacketControlFactory::createSpawnObject);
    clientbound("spawn_painting", "Spawn Painting", SPacketSpawnPainting.class);

    // Inventory
    clientbound("close_window", "Close Window", SPacketCloseWindow.class, PacketControlFactory::createCloseWindow);
    clientbound("confirm_transaction", "Confirm Transaction", SPacketConfirmTransaction.class, PacketControlFactory::createConfirmTransaction);
    clientbound("open_window", "Open Window", SPacketOpenWindow.class, PacketControlFactory::createOpenWindow);
    clientbound("set_slot", "Set Slot", SPacketSetSlot.class, PacketControlFactory::createSetSlot);
    clientbound("window_items", "Window Items", SPacketWindowItems.class, PacketControlFactory::createWindowItems);

    // Player
    clientbound("player_abilities", "Player Abilities", SPacketPlayerAbilities.class, PacketControlFactory::createPlayerAbilities);
    clientbound("spawn_player", "Spawn Player", SPacketSpawnPlayer.class);
    clientbound("use_bed", "Use Bed", SPacketUseBed.class, PacketControlFactory::createUseBed);
    clientbound("vehicle_position", "Vehicle Position", SPacketMoveVehicle.class);

    // World
    clientbound("custom_sound", "Custom Sound", SPacketCustomSound.class, PacketControlFactory::createCustomSound);
    clientbound("game_sound", "Game Sound", SPacketSoundEffect.class, PacketControlFactory::createGameSound);
    clientbound("open_sign_editor", "Open Sign Editor", SPacketSignEditorOpen.class, PacketControlFactory::createOpenSignEditor);
    clientbound("world_time", "World Time", SPacketTimeUpdate.class, PacketControlFactory::createWorldTime);

    // Client
    serverbound("click_window", "Click Window", CPacketClickWindow.class);
    serverbound("move_vehicle", "Move Vehicle", CPacketVehicleMove.class);
    serverbound("update_sign", "Update Sign", CPacketUpdateSign.class);
    serverbound("window_close", "Window Close", CPacketCloseWindow.class);
}
项目:Backmemed    文件:NetHandlerPlayServer.java   
/**
 * Executes a container/inventory slot manipulation as indicated by the packet. Sends the serverside result if they
 * didn't match the indicated result and prevents further manipulation by the player until he confirms that it has
 * the same open container/inventory
 */
public void processClickWindow(CPacketClickWindow packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
    this.playerEntity.markPlayerActive();

    if (this.playerEntity.openContainer.windowId == packetIn.getWindowId() && this.playerEntity.openContainer.getCanCraft(this.playerEntity))
    {
        if (this.playerEntity.isSpectator())
        {
            NonNullList<ItemStack> nonnulllist = NonNullList.<ItemStack>func_191196_a();

            for (int i = 0; i < this.playerEntity.openContainer.inventorySlots.size(); ++i)
            {
                nonnulllist.add(((Slot)this.playerEntity.openContainer.inventorySlots.get(i)).getStack());
            }

            this.playerEntity.updateCraftingInventory(this.playerEntity.openContainer, nonnulllist);
        }
        else
        {
            ItemStack itemstack2 = this.playerEntity.openContainer.slotClick(packetIn.getSlotId(), packetIn.getUsedButton(), packetIn.getClickType(), this.playerEntity);

            if (ItemStack.areItemStacksEqual(packetIn.getClickedItem(), itemstack2))
            {
                this.playerEntity.connection.sendPacket(new SPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), true));
                this.playerEntity.isChangingQuantityOnly = true;
                this.playerEntity.openContainer.detectAndSendChanges();
                this.playerEntity.updateHeldItem();
                this.playerEntity.isChangingQuantityOnly = false;
            }
            else
            {
                this.pendingTransactions.addKey(this.playerEntity.openContainer.windowId, Short.valueOf(packetIn.getActionNumber()));
                this.playerEntity.connection.sendPacket(new SPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), false));
                this.playerEntity.openContainer.setCanCraft(this.playerEntity, false);
                NonNullList<ItemStack> nonnulllist1 = NonNullList.<ItemStack>func_191196_a();

                for (int j = 0; j < this.playerEntity.openContainer.inventorySlots.size(); ++j)
                {
                    ItemStack itemstack = ((Slot)this.playerEntity.openContainer.inventorySlots.get(j)).getStack();
                    ItemStack itemstack1 = itemstack.func_190926_b() ? ItemStack.field_190927_a : itemstack;
                    nonnulllist1.add(itemstack1);
                }

                this.playerEntity.updateCraftingInventory(this.playerEntity.openContainer, nonnulllist1);
            }
        }
    }
}
项目:CustomWorldGen    文件:NetHandlerPlayServer.java   
/**
 * Executes a container/inventory slot manipulation as indicated by the packet. Sends the serverside result if they
 * didn't match the indicated result and prevents further manipulation by the player until he confirms that it has
 * the same open container/inventory
 */
public void processClickWindow(CPacketClickWindow packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
    this.playerEntity.markPlayerActive();

    if (this.playerEntity.openContainer.windowId == packetIn.getWindowId() && this.playerEntity.openContainer.getCanCraft(this.playerEntity))
    {
        if (this.playerEntity.isSpectator())
        {
            List<ItemStack> list = Lists.<ItemStack>newArrayList();

            for (int i = 0; i < this.playerEntity.openContainer.inventorySlots.size(); ++i)
            {
                list.add(((Slot)this.playerEntity.openContainer.inventorySlots.get(i)).getStack());
            }

            this.playerEntity.updateCraftingInventory(this.playerEntity.openContainer, list);
        }
        else
        {
            ItemStack itemstack2 = this.playerEntity.openContainer.slotClick(packetIn.getSlotId(), packetIn.getUsedButton(), packetIn.getClickType(), this.playerEntity);

            if (ItemStack.areItemStacksEqual(packetIn.getClickedItem(), itemstack2))
            {
                this.playerEntity.connection.sendPacket(new SPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), true));
                this.playerEntity.isChangingQuantityOnly = true;
                this.playerEntity.openContainer.detectAndSendChanges();
                this.playerEntity.updateHeldItem();
                this.playerEntity.isChangingQuantityOnly = false;
            }
            else
            {
                this.pendingTransactions.addKey(this.playerEntity.openContainer.windowId, Short.valueOf(packetIn.getActionNumber()));
                this.playerEntity.connection.sendPacket(new SPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), false));
                this.playerEntity.openContainer.setCanCraft(this.playerEntity, false);
                List<ItemStack> list1 = Lists.<ItemStack>newArrayList();

                for (int j = 0; j < this.playerEntity.openContainer.inventorySlots.size(); ++j)
                {
                    ItemStack itemstack = ((Slot)this.playerEntity.openContainer.inventorySlots.get(j)).getStack();
                    ItemStack itemstack1 = itemstack != null && itemstack.stackSize > 0 ? itemstack : null;
                    list1.add(itemstack1);
                }

                this.playerEntity.updateCraftingInventory(this.playerEntity.openContainer, list1);
            }
        }
    }
}
项目:CrystalMod    文件:FakeNetHandlerPlayServer.java   
@Override
public void processClickWindow(CPacketClickWindow p_147351_1_) {
}
项目:ExpandedRailsMod    文件:NetHandlerPlayServer.java   
/**
 * Executes a container/inventory slot manipulation as indicated by the packet. Sends the serverside result if they
 * didn't match the indicated result and prevents further manipulation by the player until he confirms that it has
 * the same open container/inventory
 */
public void processClickWindow(CPacketClickWindow packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
    this.playerEntity.markPlayerActive();

    if (this.playerEntity.openContainer.windowId == packetIn.getWindowId() && this.playerEntity.openContainer.getCanCraft(this.playerEntity))
    {
        if (this.playerEntity.isSpectator())
        {
            List<ItemStack> list = Lists.<ItemStack>newArrayList();

            for (int i = 0; i < this.playerEntity.openContainer.inventorySlots.size(); ++i)
            {
                list.add(((Slot)this.playerEntity.openContainer.inventorySlots.get(i)).getStack());
            }

            this.playerEntity.updateCraftingInventory(this.playerEntity.openContainer, list);
        }
        else
        {
            ItemStack itemstack2 = this.playerEntity.openContainer.slotClick(packetIn.getSlotId(), packetIn.getUsedButton(), packetIn.getClickType(), this.playerEntity);

            if (ItemStack.areItemStacksEqual(packetIn.getClickedItem(), itemstack2))
            {
                this.playerEntity.connection.sendPacket(new SPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), true));
                this.playerEntity.isChangingQuantityOnly = true;
                this.playerEntity.openContainer.detectAndSendChanges();
                this.playerEntity.updateHeldItem();
                this.playerEntity.isChangingQuantityOnly = false;
            }
            else
            {
                this.pendingTransactions.addKey(this.playerEntity.openContainer.windowId, Short.valueOf(packetIn.getActionNumber()));
                this.playerEntity.connection.sendPacket(new SPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), false));
                this.playerEntity.openContainer.setCanCraft(this.playerEntity, false);
                List<ItemStack> list1 = Lists.<ItemStack>newArrayList();

                for (int j = 0; j < this.playerEntity.openContainer.inventorySlots.size(); ++j)
                {
                    ItemStack itemstack = ((Slot)this.playerEntity.openContainer.inventorySlots.get(j)).getStack();
                    ItemStack itemstack1 = itemstack != null && itemstack.stackSize > 0 ? itemstack : null;
                    list1.add(itemstack1);
                }

                this.playerEntity.updateCraftingInventory(this.playerEntity.openContainer, list1);
            }
        }
    }
}
项目:EnderIO    文件:FakeNetHandlerPlayServer.java   
@Override
public void processClickWindow(@Nonnull CPacketClickWindow p_147351_1_) {
}
项目:DankNull    文件:NetServerHandlerFake.java   
@Override
public void processClickWindow(CPacketClickWindow packetIn) {

}
项目:Backmemed    文件:INetHandlerPlayServer.java   
/**
 * Executes a container/inventory slot manipulation as indicated by the packet. Sends the serverside result if they
 * didn't match the indicated result and prevents further manipulation by the player until he confirms that it has
 * the same open container/inventory
 */
void processClickWindow(CPacketClickWindow packetIn);
项目:CustomWorldGen    文件:INetHandlerPlayServer.java   
/**
 * Executes a container/inventory slot manipulation as indicated by the packet. Sends the serverside result if they
 * didn't match the indicated result and prevents further manipulation by the player until he confirms that it has
 * the same open container/inventory
 */
void processClickWindow(CPacketClickWindow packetIn);