Fix block breaker on old versions not picking up the entity held item

This commit is contained in:
fullwall 2022-06-17 20:36:05 +08:00
parent 849561337b
commit a64ad43d11
8 changed files with 15 additions and 8 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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