Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
guimc233 committed Aug 14, 2024
1 parent fb12b1d commit 2db9014
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ public BlockUseEntityListener() {
@Subscribe
public void onPacketSend(SendPacketEvent event) {
if (!ZombiesHelperConfig.blockUseEntity) return;
if (mc.thePlayer.inventory.getCurrentItem().getItem().getItemUseAction(mc.thePlayer.inventory.getCurrentItem()) != EnumAction.NONE) return;
Packet packet = event.packet;
if ((packet instanceof C08PacketPlayerBlockPlacement &&
mc.theWorld.getBlockState(((C08PacketPlayerBlockPlacement) packet).getPosition()).getBlock() instanceof BlockChest) ||
packet instanceof C02PacketUseEntity && !Utils.isTarget(((C02PacketUseEntity) packet).getEntityFromWorld(mc.theWorld))) {
event.isCancelled = true;
mc.getNetHandler().addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.inventory.getCurrentItem()));
if (packet instanceof C08PacketPlayerBlockPlacement) {
cancelNextSwing = true;
if (mc.thePlayer.inventory.getCurrentItem().getItem().getItemUseAction(mc.thePlayer.inventory.getCurrentItem()) != EnumAction.NONE) {
mc.getNetHandler().addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.inventory.getCurrentItem()));
if (packet instanceof C08PacketPlayerBlockPlacement) {
cancelNextSwing = true;
}
}
} else if (packet instanceof C0APacketAnimation && cancelNextSwing) {
cancelNextSwing = false;
Expand Down

0 comments on commit 2db9014

Please sign in to comment.