From a64ad43d11db849c6ff71afee47d778c13d38e51 Mon Sep 17 00:00:00 2001 From: fullwall Date: Fri, 17 Jun 2022 20:36:05 +0800 Subject: [PATCH] Fix block breaker on old versions not picking up the entity held item --- .../citizensnpcs/nms/v1_10_R1/util/CitizensBlockBreaker.java | 3 ++- .../citizensnpcs/nms/v1_11_R1/util/CitizensBlockBreaker.java | 3 ++- .../citizensnpcs/nms/v1_12_R1/util/CitizensBlockBreaker.java | 3 ++- .../citizensnpcs/nms/v1_13_R2/util/CitizensBlockBreaker.java | 3 ++- .../citizensnpcs/nms/v1_14_R1/util/CitizensBlockBreaker.java | 3 ++- .../citizensnpcs/nms/v1_15_R1/util/CitizensBlockBreaker.java | 3 ++- .../citizensnpcs/nms/v1_16_R3/util/CitizensBlockBreaker.java | 3 ++- .../citizensnpcs/nms/v1_8_R3/util/CitizensBlockBreaker.java | 2 +- 8 files changed, 15 insertions(+), 8 deletions(-) diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/util/CitizensBlockBreaker.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/util/CitizensBlockBreaker.java index f9d37750b..209a3433c 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/util/CitizensBlockBreaker.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/util/CitizensBlockBreaker.java @@ -21,7 +21,8 @@ public class CitizensBlockBreaker extends AbstractBlockBreaker { private ItemStack getCurrentItem() { return configuration.item() != null ? CraftItemStack.asNMSCopy(configuration.item()) - : entity instanceof EntityLiving ? ((EntityLiving) entity).getEquipment(EnumItemSlot.MAINHAND) : null; + : getHandle() instanceof EntityLiving ? ((EntityLiving) getHandle()).getEquipment(EnumItemSlot.MAINHAND) + : null; } @Override diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/util/CitizensBlockBreaker.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/util/CitizensBlockBreaker.java index 368efaeaf..587f1e363 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/util/CitizensBlockBreaker.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/util/CitizensBlockBreaker.java @@ -21,7 +21,8 @@ public class CitizensBlockBreaker extends AbstractBlockBreaker { private ItemStack getCurrentItem() { return configuration.item() != null ? CraftItemStack.asNMSCopy(configuration.item()) - : entity instanceof EntityLiving ? ((EntityLiving) entity).getEquipment(EnumItemSlot.MAINHAND) : null; + : getHandle() instanceof EntityLiving ? ((EntityLiving) getHandle()).getEquipment(EnumItemSlot.MAINHAND) + : null; } @Override diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/util/CitizensBlockBreaker.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/util/CitizensBlockBreaker.java index 6bf7d1291..466c57347 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/util/CitizensBlockBreaker.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/util/CitizensBlockBreaker.java @@ -21,7 +21,8 @@ public class CitizensBlockBreaker extends AbstractBlockBreaker { private ItemStack getCurrentItem() { return configuration.item() != null ? CraftItemStack.asNMSCopy(configuration.item()) - : entity instanceof EntityLiving ? ((EntityLiving) entity).getEquipment(EnumItemSlot.MAINHAND) : null; + : getHandle() instanceof EntityLiving ? ((EntityLiving) getHandle()).getEquipment(EnumItemSlot.MAINHAND) + : null; } @Override diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/CitizensBlockBreaker.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/CitizensBlockBreaker.java index 06720e5ed..8444e616a 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/CitizensBlockBreaker.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/CitizensBlockBreaker.java @@ -21,7 +21,8 @@ public class CitizensBlockBreaker extends AbstractBlockBreaker { private ItemStack getCurrentItem() { return configuration.item() != null ? CraftItemStack.asNMSCopy(configuration.item()) - : entity instanceof EntityLiving ? ((EntityLiving) entity).getEquipment(EnumItemSlot.MAINHAND) : null; + : getHandle() instanceof EntityLiving ? ((EntityLiving) getHandle()).getEquipment(EnumItemSlot.MAINHAND) + : null; } @Override diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/CitizensBlockBreaker.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/CitizensBlockBreaker.java index 0420df181..2fb6362d7 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/CitizensBlockBreaker.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/CitizensBlockBreaker.java @@ -22,7 +22,8 @@ public class CitizensBlockBreaker extends AbstractBlockBreaker { private ItemStack getCurrentItem() { return configuration.item() != null ? CraftItemStack.asNMSCopy(configuration.item()) - : entity instanceof EntityLiving ? ((EntityLiving) entity).getEquipment(EnumItemSlot.MAINHAND) : null; + : getHandle() instanceof EntityLiving ? ((EntityLiving) getHandle()).getEquipment(EnumItemSlot.MAINHAND) + : null; } @Override diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/CitizensBlockBreaker.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/CitizensBlockBreaker.java index ce8837a12..0da87d8a1 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/CitizensBlockBreaker.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/CitizensBlockBreaker.java @@ -22,7 +22,8 @@ public class CitizensBlockBreaker extends AbstractBlockBreaker { private ItemStack getCurrentItem() { return configuration.item() != null ? CraftItemStack.asNMSCopy(configuration.item()) - : entity instanceof EntityLiving ? ((EntityLiving) entity).getEquipment(EnumItemSlot.MAINHAND) : null; + : getHandle() instanceof EntityLiving ? ((EntityLiving) getHandle()).getEquipment(EnumItemSlot.MAINHAND) + : null; } @Override diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/CitizensBlockBreaker.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/CitizensBlockBreaker.java index 1ee69bdd9..8665717a8 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/CitizensBlockBreaker.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/CitizensBlockBreaker.java @@ -22,7 +22,8 @@ public class CitizensBlockBreaker extends AbstractBlockBreaker { private net.minecraft.server.v1_16_R3.ItemStack getCurrentItem() { return configuration.item() != null ? CraftItemStack.asNMSCopy(configuration.item()) - : entity instanceof EntityLiving ? ((EntityLiving) entity).getEquipment(EnumItemSlot.MAINHAND) : null; + : getHandle() instanceof EntityLiving ? ((EntityLiving) getHandle()).getEquipment(EnumItemSlot.MAINHAND) + : null; } @Override diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/util/CitizensBlockBreaker.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/util/CitizensBlockBreaker.java index 3a7118000..954bf8db4 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/util/CitizensBlockBreaker.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/util/CitizensBlockBreaker.java @@ -20,7 +20,7 @@ public class CitizensBlockBreaker extends AbstractBlockBreaker { private ItemStack getCurrentItem() { return configuration.item() != null ? CraftItemStack.asNMSCopy(configuration.item()) - : entity instanceof EntityLiving ? ((EntityLiving) entity).getEquipment(0) : null; + : getHandle() instanceof EntityLiving ? ((EntityLiving) getHandle()).getEquipment(0) : null; } @Override