use of me.earth.earthhack.impl.core.mixins.network.server.ISPacketSetSlot in project 3arthh4ck by 3arthqu4ke.
the class ListenerSetSlot method invoke.
@Override
public void invoke(PacketEvent.Receive<SPacketSetSlot> event) {
if (module.getParent().isEnabled() && mc.player != null) {
SPacketSetSlot packet = event.getPacket();
if (packet.getSlot() == -1337) {
((IContainer) mc.player.openContainer).setTransactionID((short) packet.getWindowId());
// make NetHandlerPlayClient set mouse slot.
((ISPacketSetSlot) packet).setWindowId(-1);
} else if (packet.getWindowId() == -128) {
event.setCancelled(true);
mc.addScheduledTask(() -> {
OffhandMode recovery = OFFHAND.returnIfPresent(Offhand::getMode, null);
OFFHAND.computeIfPresent(offhand -> {
offhand.setMode(OffhandMode.TOTEM);
offhand.postWindowClick();
});
OFFHAND.computeIfPresent(offhand -> offhand.setRecovery(recovery));
Slot slot = mc.player.inventoryContainer.inventorySlots.get(packet.getSlot());
slot.putStack(packet.getStack());
});
}
}
}
Aggregations