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

项目:BaseClient    文件:AutoSoup.java   
@EventTarget
private void onPostUpdate(UpdateEvent event) {
    if (event.state == Event.State.POST) {
        int soupSlot = this.getSoupFromInventory();
        if ((double)this.mc.thePlayer.getHealth() < this.health * 2.0 && this.time.delay((float)this.delay) && soupSlot != -1) {
            int prevSlot = this.mc.thePlayer.inventory.currentItem;
            if (soupSlot < 9) {
                this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C09PacketHeldItemChange(soupSlot));
                this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C08PacketPlayerBlockPlacement(this.mc.thePlayer.inventory.getCurrentItem()));
                this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C09PacketHeldItemChange(prevSlot));
                this.mc.playerController.syncCurrentPlayItem();
                this.mc.thePlayer.inventory.currentItem = prevSlot;
            } else {
                this.swap(soupSlot, this.mc.thePlayer.inventory.currentItem + (this.mc.thePlayer.inventory.currentItem < 8 ? 1 : -1));
                this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C09PacketHeldItemChange(this.mc.thePlayer.inventory.currentItem + (this.mc.thePlayer.inventory.currentItem < 8 ? 1 : -1)));
                this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C08PacketPlayerBlockPlacement(this.mc.thePlayer.inventory.getCurrentItem()));
                this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C09PacketHeldItemChange(prevSlot));
            }
            this.time.reset();
        }
    }
}
项目:SerenityCE    文件:AutoTool.java   
public AutoTool() {
    super("Auto Tool", 0x71FF88, ModuleCategory.PLAYER);

    getModuleModes().add(new ModuleMode("Simple") {
        @Override
        public void addListeners(List<Listener<?>> listeners) {
            listeners.add(new Listener<BlockDigging>() {
                @Override
                public void call(BlockDigging event) {
                    int bestSlot = getBestSlotMining(mc.theWorld.getBlockState(event.getPos()).getBlock());
                    if (bestSlot != -1) {
                        mc.thePlayer.inventory.currentItem = bestSlot - 36;
                        mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(bestSlot - 36));
                    }
                }
            });
        }

        @Override
        public Value<?>[] getValues() {
            return new Value[0];
        }
    });

    setActiveMode("Simple");
}
项目:Resilience-Client-Source    文件:ModuleFastBow.java   
@Override
public void onOutwardPacket(EventOnOutwardPacket event){
    if(!invoker.isOnGround()) return;
       Packet packet = event.getPacket();
       if (packet instanceof C08PacketPlayerBlockPlacement) {
        if(Item.getIdFromItem(invoker.getCurrentItem().getItem()) != 261) return;
           C08PacketPlayerBlockPlacement packetBlockPlacement = (C08PacketPlayerBlockPlacement) packet;
           if (packetBlockPlacement.func_149576_c() != -1 || packetBlockPlacement.func_149571_d() != -1 || packetBlockPlacement.func_149570_e() != -1 || packetBlockPlacement.func_149568_f() != 255) {
               return;
           }
           event.addPacketToList(new C09PacketHeldItemChange(Minecraft.getMinecraft().thePlayer.inventory.currentItem));
           for (int i = 0; i < 40; i++) {
            event.addPacketToList(new C03PacketPlayer(false));
           }

           event.addPacketToList(new C07PacketPlayerDigging(5, 0, 0, 0, 255));
       }
}
项目:Resilience-Client-Source    文件:ModuleFastEat.java   
@Override
public void onOutwardPacket(EventOnOutwardPacket event){
    if(!invoker.isOnGround()) return;
       Packet packet = event.getPacket();
       if (packet instanceof C08PacketPlayerBlockPlacement) {
        if(!(invoker.getCurrentItem().getItem() instanceof ItemFood)) return;
           C08PacketPlayerBlockPlacement packetBlockPlacement = (C08PacketPlayerBlockPlacement) packet;
           if (packetBlockPlacement.func_149576_c() != -1 || packetBlockPlacement.func_149571_d() != -1 || packetBlockPlacement.func_149570_e() != -1 || packetBlockPlacement.func_149568_f() != 255) {
               return;
           }
           event.addPacketToList(new C09PacketHeldItemChange(Minecraft.getMinecraft().thePlayer.inventory.currentItem));
           for (int i = 0; i < 40; i++) {
            event.addPacketToList(new C03PacketPlayer(false));
           }

           event.addPacketToList(new C07PacketPlayerDigging(5, 0, 0, 0, 255));
       }
}
项目:DecompiledMinecraft    文件:NetHandlerPlayServer.java   
/**
 * Updates which quickbar slot is selected
 */
public void processHeldItemChange(C09PacketHeldItemChange packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer());

    if (packetIn.getSlotId() >= 0 && packetIn.getSlotId() < InventoryPlayer.getHotbarSize())
    {
        this.playerEntity.inventory.currentItem = packetIn.getSlotId();
        this.playerEntity.markPlayerActive();
    }
    else
    {
        logger.warn(this.playerEntity.getName() + " tried to set an invalid carried item");
    }
}
项目:DecompiledMinecraft    文件:NetHandlerPlayServer.java   
/**
 * Updates which quickbar slot is selected
 */
public void processHeldItemChange(C09PacketHeldItemChange packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer());

    if (packetIn.getSlotId() >= 0 && packetIn.getSlotId() < InventoryPlayer.getHotbarSize())
    {
        this.playerEntity.inventory.currentItem = packetIn.getSlotId();
        this.playerEntity.markPlayerActive();
    }
    else
    {
        logger.warn(this.playerEntity.getName() + " tried to set an invalid carried item");
    }
}
项目:DecompiledMinecraft    文件:PlayerControllerMP.java   
/**
 * Syncs the current player item with the server
 */
private void syncCurrentPlayItem()
{
    int i = this.mc.thePlayer.inventory.currentItem;

    if (i != this.currentPlayerItem)
    {
        this.currentPlayerItem = i;
        this.netClientHandler.addToSendQueue(new C09PacketHeldItemChange(this.currentPlayerItem));
    }
}
项目:BaseClient    文件:AutoEat.java   
@EventTarget
private void onUpdate(UpdateEvent event) {
    int foodSlot;
    if (event.state == Event.State.PRE && (foodSlot = this.getFoodSlotInHotbar()) != -1 && (double)this.mc.thePlayer.getFoodStats().getFoodLevel() < this.hunger * 2.0 && this.mc.thePlayer.isCollidedVertically) {
        this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C09PacketHeldItemChange(foodSlot));
        this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C08PacketPlayerBlockPlacement(this.mc.thePlayer.inventory.mainInventory[foodSlot]));
        int i = 0;
        while (i < 32) {
            this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C03PacketPlayer(false));
            ++i;
        }
        this.mc.thePlayer.stopUsingItem();
        this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C09PacketHeldItemChange(this.mc.thePlayer.inventory.currentItem));
    }
}
项目:BaseClient    文件:AutoTaunt.java   
@EventTarget
private void onTick(TickEvent event) {
    int i = 0;
    while (i < 8) {
        Item item;
        if (this.mc.thePlayer.inventory.mainInventory[i] != null && ((item = this.mc.thePlayer.inventory.mainInventory[i].getItem()) instanceof ItemRedstone || Item.getIdFromItem((Item)item) == 353 || item instanceof ItemFirework)) {
            this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C09PacketHeldItemChange(i));
            this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C08PacketPlayerBlockPlacement(this.mc.thePlayer.inventory.mainInventory[i]));
            this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C09PacketHeldItemChange(this.mc.thePlayer.inventory.currentItem));
        }
        ++i;
    }
}
项目:BaseClient    文件:NetHandlerPlayServer.java   
/**
 * Updates which quickbar slot is selected
 */
public void processHeldItemChange(C09PacketHeldItemChange packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer());

    if (packetIn.getSlotId() >= 0 && packetIn.getSlotId() < InventoryPlayer.getHotbarSize())
    {
        this.playerEntity.inventory.currentItem = packetIn.getSlotId();
        this.playerEntity.markPlayerActive();
    }
    else
    {
        logger.warn(this.playerEntity.getName() + " tried to set an invalid carried item");
    }
}
项目:BaseClient    文件:PlayerControllerMP.java   
/**
 * Syncs the current player item with the server
 */
public void syncCurrentPlayItem()
{
    int i = this.mc.thePlayer.inventory.currentItem;

    if (i != this.currentPlayerItem)
    {
        this.currentPlayerItem = i;
        this.netClientHandler.addToSendQueue(new C09PacketHeldItemChange(this.currentPlayerItem));
    }
}
项目:BaseClient    文件:NetHandlerPlayServer.java   
/**
 * Updates which quickbar slot is selected
 */
public void processHeldItemChange(C09PacketHeldItemChange packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer());

    if (packetIn.getSlotId() >= 0 && packetIn.getSlotId() < InventoryPlayer.getHotbarSize())
    {
        this.playerEntity.inventory.currentItem = packetIn.getSlotId();
        this.playerEntity.markPlayerActive();
    }
    else
    {
        logger.warn(this.playerEntity.getName() + " tried to set an invalid carried item");
    }
}
项目:BaseClient    文件:PlayerControllerMP.java   
/**
 * Syncs the current player item with the server
 */
private void syncCurrentPlayItem()
{
    int i = this.mc.thePlayer.inventory.currentItem;

    if (i != this.currentPlayerItem)
    {
        this.currentPlayerItem = i;
        this.netClientHandler.addToSendQueue(new C09PacketHeldItemChange(this.currentPlayerItem));
    }
}
项目:4Space-5    文件:PlayerControllerMP.java   
private void syncCurrentPlayItem()
{
    int i = this.mc.thePlayer.inventory.currentItem;
    if (i != this.currentPlayerItem)
    {
        this.currentPlayerItem = i;
        this.netClientHandler.addToSendQueue(new C09PacketHeldItemChange(this.currentPlayerItem));
    }
}
项目:Resilience-Client-Source    文件:NetHandlerPlayServer.java   
/**
 * Updates which quickbar slot is selected
 */
public void processHeldItemChange(C09PacketHeldItemChange p_147355_1_)
{
    if (p_147355_1_.func_149614_c() >= 0 && p_147355_1_.func_149614_c() < InventoryPlayer.getHotbarSize())
    {
        this.playerEntity.inventory.currentItem = p_147355_1_.func_149614_c();
        this.playerEntity.func_143004_u();
    }
    else
    {
        logger.warn(this.playerEntity.getCommandSenderName() + " tried to set an invalid carried item");
    }
}
项目:Resilience-Client-Source    文件:PlayerControllerMP.java   
/**
 * Syncs the current player item with the server
 */
protected void syncCurrentPlayItem()
{
    int var1 = this.mc.thePlayer.inventory.currentItem;

    if (var1 != this.currentPlayerItem)
    {
        this.currentPlayerItem = var1;
        this.netClientHandler.addToSendQueue(new C09PacketHeldItemChange(this.currentPlayerItem));
    }
}
项目:4Space-1.7    文件:PlayerControllerMP.java   
private void syncCurrentPlayItem()
{
    int i = this.mc.thePlayer.inventory.currentItem;
    if (i != this.currentPlayerItem)
    {
        this.currentPlayerItem = i;
        this.netClientHandler.addToSendQueue(new C09PacketHeldItemChange(this.currentPlayerItem));
    }
}
项目:Cauldron    文件:NetHandlerPlayServer.java   
public void processHeldItemChange(C09PacketHeldItemChange p_147355_1_)
{
    // CraftBukkit start
    if (this.playerEntity.isDead)
    {
        return;
    }

    if (p_147355_1_.func_149614_c() >= 0 && p_147355_1_.func_149614_c() < InventoryPlayer.getHotbarSize())
    {
        PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayerB(), this.playerEntity.inventory.currentItem, p_147355_1_.func_149614_c());
        this.server.getPluginManager().callEvent(event);

        if (event.isCancelled())
        {
            this.sendPacket(new S09PacketHeldItemChange(this.playerEntity.inventory.currentItem));
            this.playerEntity.func_143004_u();
            return;
        }

        // CraftBukkit end
        this.playerEntity.inventory.currentItem = p_147355_1_.func_149614_c();
        this.playerEntity.func_143004_u();
    }
    else
    {
        logger.warn(this.playerEntity.getCommandSenderName() + " tried to set an invalid carried item");
        this.kickPlayerFromServer("Nope!"); // CraftBukkit
    }
}
项目:Cauldron    文件:PlayerControllerMP.java   
private void syncCurrentPlayItem()
{
    int i = this.mc.thePlayer.inventory.currentItem;

    if (i != this.currentPlayerItem)
    {
        this.currentPlayerItem = i;
        this.netClientHandler.addToSendQueue(new C09PacketHeldItemChange(this.currentPlayerItem));
    }
}
项目:Cauldron    文件:NetHandlerPlayServer.java   
public void processHeldItemChange(C09PacketHeldItemChange p_147355_1_)
{
    if (p_147355_1_.func_149614_c() >= 0 && p_147355_1_.func_149614_c() < InventoryPlayer.getHotbarSize())
    {
        this.playerEntity.inventory.currentItem = p_147355_1_.func_149614_c();
        this.playerEntity.func_143004_u();
    }
    else
    {
        logger.warn(this.playerEntity.getCommandSenderName() + " tried to set an invalid carried item");
    }
}
项目:Cauldron    文件:PlayerControllerMP.java   
private void syncCurrentPlayItem()
{
    int i = this.mc.thePlayer.inventory.currentItem;

    if (i != this.currentPlayerItem)
    {
        this.currentPlayerItem = i;
        this.netClientHandler.addToSendQueue(new C09PacketHeldItemChange(this.currentPlayerItem));
    }
}
项目:SerenityCE    文件:Scaffold.java   
@Override
protected void onDisable() {
    mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));
}
项目:Gadomancy    文件:FakeNetServerHandler.java   
@Override
public void processHeldItemChange(C09PacketHeldItemChange p_147355_1_) {
}
项目:DecompiledMinecraft    文件:INetHandlerPlayServer.java   
/**
 * Updates which quickbar slot is selected
 */
void processHeldItemChange(C09PacketHeldItemChange packetIn);
项目:DecompiledMinecraft    文件:INetHandlerPlayServer.java   
/**
 * Updates which quickbar slot is selected
 */
void processHeldItemChange(C09PacketHeldItemChange packetIn);
项目:BaseClient    文件:INetHandlerPlayServer.java   
/**
 * Updates which quickbar slot is selected
 */
void processHeldItemChange(C09PacketHeldItemChange packetIn);
项目:BaseClient    文件:INetHandlerPlayServer.java   
/**
 * Updates which quickbar slot is selected
 */
void processHeldItemChange(C09PacketHeldItemChange packetIn);
项目:Resilience-Client-Source    文件:INetHandlerPlayServer.java   
/**
 * Updates which quickbar slot is selected
 */
void processHeldItemChange(C09PacketHeldItemChange var1);
项目:Cauldron    文件:INetHandlerPlayServer.java   
void processHeldItemChange(C09PacketHeldItemChange p_147355_1_);
项目:Cauldron    文件:INetHandlerPlayServer.java   
void processHeldItemChange(C09PacketHeldItemChange p_147355_1_);