@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); } } }
/** * 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()}); } }
/** * 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)); } }
/** * 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)); } }
/** * 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)); } }
public void switchToRealItem() { int realItem = this.mc.player.inventory.currentItem; if (realItem != this.currentPlayerItem) { this.connection.sendPacket(new CPacketHeldItemChange(realItem)); } }
public void switchToIdleItem() { int realItem = this.mc.player.inventory.currentItem; if (realItem != this.currentPlayerItem) { this.connection.sendPacket(new CPacketHeldItemChange(this.currentPlayerItem)); } }
@Override public void processHeldItemChange(CPacketHeldItemChange p_147355_1_) { }
@Override public void processHeldItemChange(@Nonnull CPacketHeldItemChange p_147355_1_) { }
@Override public void processHeldItemChange(CPacketHeldItemChange packetIn) { }
/** * Updates which quickbar slot is selected */ void processHeldItemChange(CPacketHeldItemChange packetIn);