• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java C09PacketHeldItemChange类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.minecraft.network.play.client.C09PacketHeldItemChange的典型用法代码示例。如果您正苦于以下问题:Java C09PacketHeldItemChange类的具体用法?Java C09PacketHeldItemChange怎么用?Java C09PacketHeldItemChange使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



C09PacketHeldItemChange类属于net.minecraft.network.play.client包,在下文中一共展示了C09PacketHeldItemChange类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onPostUpdate

import net.minecraft.network.play.client.C09PacketHeldItemChange; //导入依赖的package包/类
@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();
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:23,代码来源:AutoSoup.java


示例2: AutoTool

import net.minecraft.network.play.client.C09PacketHeldItemChange; //导入依赖的package包/类
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");
}
 
开发者ID:SerenityEnterprises,项目名称:SerenityCE,代码行数:27,代码来源:AutoTool.java


示例3: onOutwardPacket

import net.minecraft.network.play.client.C09PacketHeldItemChange; //导入依赖的package包/类
@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));
       }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:19,代码来源:ModuleFastBow.java


示例4: onOutwardPacket

import net.minecraft.network.play.client.C09PacketHeldItemChange; //导入依赖的package包/类
@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));
       }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:19,代码来源:ModuleFastEat.java


示例5: processHeldItemChange

import net.minecraft.network.play.client.C09PacketHeldItemChange; //导入依赖的package包/类
/**
 * 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");
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:18,代码来源:NetHandlerPlayServer.java


示例6: syncCurrentPlayItem

import net.minecraft.network.play.client.C09PacketHeldItemChange; //导入依赖的package包/类
/**
 * 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));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:14,代码来源:PlayerControllerMP.java


示例7: onUpdate

import net.minecraft.network.play.client.C09PacketHeldItemChange; //导入依赖的package包/类
@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));
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:16,代码来源:AutoEat.java


示例8: onTick

import net.minecraft.network.play.client.C09PacketHeldItemChange; //导入依赖的package包/类
@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;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:14,代码来源:AutoTaunt.java


示例9: syncCurrentPlayItem

import net.minecraft.network.play.client.C09PacketHeldItemChange; //导入依赖的package包/类
/**
 * 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));
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:14,代码来源:PlayerControllerMP.java


示例10: syncCurrentPlayItem

import net.minecraft.network.play.client.C09PacketHeldItemChange; //导入依赖的package包/类
private void syncCurrentPlayItem()
{
	int i = this.mc.thePlayer.inventory.currentItem;
	if (i != this.currentPlayerItem)
	{
		this.currentPlayerItem = i;
		this.netClientHandler.addToSendQueue(new C09PacketHeldItemChange(this.currentPlayerItem));
	}
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:10,代码来源:PlayerControllerMP.java


示例11: processHeldItemChange

import net.minecraft.network.play.client.C09PacketHeldItemChange; //导入依赖的package包/类
/**
 * 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");
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:16,代码来源:NetHandlerPlayServer.java


示例12: syncCurrentPlayItem

import net.minecraft.network.play.client.C09PacketHeldItemChange; //导入依赖的package包/类
/**
 * 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));
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:14,代码来源:PlayerControllerMP.java


示例13: processHeldItemChange

import net.minecraft.network.play.client.C09PacketHeldItemChange; //导入依赖的package包/类
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
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:31,代码来源:NetHandlerPlayServer.java


示例14: syncCurrentPlayItem

import net.minecraft.network.play.client.C09PacketHeldItemChange; //导入依赖的package包/类
private void syncCurrentPlayItem()
{
    int i = this.mc.thePlayer.inventory.currentItem;

    if (i != this.currentPlayerItem)
    {
        this.currentPlayerItem = i;
        this.netClientHandler.addToSendQueue(new C09PacketHeldItemChange(this.currentPlayerItem));
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:11,代码来源:PlayerControllerMP.java


示例15: processHeldItemChange

import net.minecraft.network.play.client.C09PacketHeldItemChange; //导入依赖的package包/类
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");
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:13,代码来源:NetHandlerPlayServer.java


示例16: onDisable

import net.minecraft.network.play.client.C09PacketHeldItemChange; //导入依赖的package包/类
@Override
protected void onDisable() {
    mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));
}
 
开发者ID:SerenityEnterprises,项目名称:SerenityCE,代码行数:5,代码来源:Scaffold.java


示例17: processHeldItemChange

import net.minecraft.network.play.client.C09PacketHeldItemChange; //导入依赖的package包/类
@Override
public void processHeldItemChange(C09PacketHeldItemChange p_147355_1_) {
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:4,代码来源:FakeNetServerHandler.java


示例18: processHeldItemChange

import net.minecraft.network.play.client.C09PacketHeldItemChange; //导入依赖的package包/类
/**
 * Updates which quickbar slot is selected
 */
void processHeldItemChange(C09PacketHeldItemChange packetIn);
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:INetHandlerPlayServer.java


示例19: processHeldItemChange

import net.minecraft.network.play.client.C09PacketHeldItemChange; //导入依赖的package包/类
/**
 * Updates which quickbar slot is selected
 */
void processHeldItemChange(C09PacketHeldItemChange var1);
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:5,代码来源:INetHandlerPlayServer.java


示例20: processHeldItemChange

import net.minecraft.network.play.client.C09PacketHeldItemChange; //导入依赖的package包/类
void processHeldItemChange(C09PacketHeldItemChange p_147355_1_); 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:2,代码来源:INetHandlerPlayServer.java



注:本文中的net.minecraft.network.play.client.C09PacketHeldItemChange类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RotatingMap类代码示例发布时间:2022-05-23
下一篇:
Java GeoCodeOption类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap