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

项目:ForgeHax    文件:AntiHeldItemChangeMod.java   
@SubscribeEvent
public void onPacketReceived(PacketEvent.Incoming.Pre event) {
    if (event.getPacket() instanceof SPacketSetSlot && getLocalPlayer() != null) {
        int currentSlot = getLocalPlayer().inventory.currentItem;

        if (((SPacketSetSlot) event.getPacket()).getSlot() != currentSlot) {
            getNetworkManager().sendPacket(new CPacketHeldItemChange(currentSlot)); // set server's slot back to our slot
            FastReflection.Methods.KeyBinding_unPress.invoke(MC.gameSettings.keyBindUseItem); // likely will eating so stop right clicking

            event.setCanceled(true);
        }
    }
}
项目:Zombe-Modpack    文件:NetHandlerPlayServer.java   
/**
 * Updates which quickbar slot is selected
 */
public void processHeldItemChange(CPacketHeldItemChange packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());

    if (packetIn.getSlotId() >= 0 && packetIn.getSlotId() < InventoryPlayer.getHotbarSize())
    {
        this.playerEntity.inventory.currentItem = packetIn.getSlotId();
        this.playerEntity.markPlayerActive();
    }
    else
    {
        LOGGER.warn("{} tried to set an invalid carried item", new Object[] {this.playerEntity.getName()});
    }
}
项目:Zombe-Modpack    文件:PlayerControllerMP.java   
/**
 * Syncs the current player item with the server
 */
private void syncCurrentPlayItem()
{
    //-ZMod-Cheat---------------------------------------------------------
    if (!ZHandle.handle("allowItemSync", true)) return;
    //--------------------------------------------------------------------

    int i = this.mc.player.inventory.currentItem;

    if (i != this.currentPlayerItem)
    {
        this.currentPlayerItem = i;
        this.connection.sendPacket(new CPacketHeldItemChange(this.currentPlayerItem));
    }
}
项目:Backmemed    文件:NetHandlerPlayServer.java   
/**
 * Updates which quickbar slot is selected
 */
public void processHeldItemChange(CPacketHeldItemChange packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());

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

    if (i != this.currentPlayerItem)
    {
        this.currentPlayerItem = i;
        this.connection.sendPacket(new CPacketHeldItemChange(this.currentPlayerItem));
    }
}
项目:CustomWorldGen    文件:NetHandlerPlayServer.java   
/**
 * Updates which quickbar slot is selected
 */
public void processHeldItemChange(CPacketHeldItemChange packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());

    if (packetIn.getSlotId() >= 0 && packetIn.getSlotId() < InventoryPlayer.getHotbarSize())
    {
        this.playerEntity.inventory.currentItem = packetIn.getSlotId();
        this.playerEntity.markPlayerActive();
    }
    else
    {
        LOGGER.warn("{} tried to set an invalid carried item", new Object[] {this.playerEntity.getName()});
    }
}
项目:CustomWorldGen    文件: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.connection.sendPacket(new CPacketHeldItemChange(this.currentPlayerItem));
    }
}
项目:ExpandedRailsMod    文件:NetHandlerPlayServer.java   
/**
 * Updates which quickbar slot is selected
 */
public void processHeldItemChange(CPacketHeldItemChange packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());

    if (packetIn.getSlotId() >= 0 && packetIn.getSlotId() < InventoryPlayer.getHotbarSize())
    {
        this.playerEntity.inventory.currentItem = packetIn.getSlotId();
        this.playerEntity.markPlayerActive();
    }
    else
    {
        LOGGER.warn("{} tried to set an invalid carried item", new Object[] {this.playerEntity.getName()});
    }
}
项目:ExpandedRailsMod    文件: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.connection.sendPacket(new CPacketHeldItemChange(this.currentPlayerItem));
    }
}
项目:Zombe-Modpack    文件:PlayerControllerMP.java   
public void switchToRealItem() {
    int realItem = this.mc.player.inventory.currentItem;
    if (realItem != this.currentPlayerItem) {
        this.connection.sendPacket(new CPacketHeldItemChange(realItem));
    }
}
项目:Zombe-Modpack    文件:PlayerControllerMP.java   
public void switchToIdleItem() {
    int realItem = this.mc.player.inventory.currentItem;
    if (realItem != this.currentPlayerItem) {
        this.connection.sendPacket(new CPacketHeldItemChange(this.currentPlayerItem));
    }
}
项目:CrystalMod    文件:FakeNetHandlerPlayServer.java   
@Override
public void processHeldItemChange(CPacketHeldItemChange p_147355_1_) {
}
项目:EnderIO    文件:FakeNetHandlerPlayServer.java   
@Override
public void processHeldItemChange(@Nonnull CPacketHeldItemChange p_147355_1_) {
}
项目:DankNull    文件:NetServerHandlerFake.java   
@Override
public void processHeldItemChange(CPacketHeldItemChange packetIn) {

}
项目:Backmemed    文件:INetHandlerPlayServer.java   
/**
 * Updates which quickbar slot is selected
 */
void processHeldItemChange(CPacketHeldItemChange packetIn);
项目:CustomWorldGen    文件:INetHandlerPlayServer.java   
/**
 * Updates which quickbar slot is selected
 */
void processHeldItemChange(CPacketHeldItemChange packetIn);