Skip to content

Commit

Permalink
Stop pick block from deleting tinker tools (#4939)
Browse files Browse the repository at this point in the history
Uses a "new" forge hook, hence why it was not possible on 1.18
  • Loading branch information
KnightMiner committed Apr 8, 2024
1 parent 27aa457 commit 8e4ca43
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,33 +88,41 @@ public int getMaxStackSize(ItemStack stack) {
}

@Override
public boolean isEnchantable(ItemStack stack) {
return false;
public boolean makesPiglinsNeutral(ItemStack stack, LivingEntity wearer) {
return ModifierUtil.checkVolatileFlag(stack, PIGLIN_NEUTRAL);
}

@Override
public boolean isBookEnchantable(ItemStack stack, ItemStack book) {
return false;
public boolean canWalkOnPowderedSnow(ItemStack stack, LivingEntity wearer) {
return slot == EquipmentSlot.FEET && ModifierUtil.checkVolatileFlag(stack, SNOW_BOOTS);
}

@Override
public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) {
return enchantment.isCurse() && super.canApplyAtEnchantingTable(stack, enchantment);
public boolean canPerformAction(ItemStack stack, ToolAction toolAction) {
return ModifierUtil.canPerformAction(ToolStack.from(stack), toolAction);
}

@Override
public boolean makesPiglinsNeutral(ItemStack stack, LivingEntity wearer) {
return ModifierUtil.checkVolatileFlag(stack, PIGLIN_NEUTRAL);
public boolean isNotReplaceableByPickAction(ItemStack stack, Player player, int inventorySlot) {
return true;
}


/* Enchantments */

@Override
public boolean canWalkOnPowderedSnow(ItemStack stack, LivingEntity wearer) {
return slot == EquipmentSlot.FEET && ModifierUtil.checkVolatileFlag(stack, SNOW_BOOTS);
public boolean isEnchantable(ItemStack stack) {
return false;
}

@Override
public boolean canPerformAction(ItemStack stack, ToolAction toolAction) {
return ModifierUtil.canPerformAction(ToolStack.from(stack), toolAction);
public boolean isBookEnchantable(ItemStack stack, ItemStack book) {
return false;
}

@Override
public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) {
return enchantment.isCurse() && super.canApplyAtEnchantingTable(stack, enchantment);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ public int getMaxStackSize(ItemStack stack) {
return 1;
}

@Override
public boolean isNotReplaceableByPickAction(ItemStack stack, Player player, int inventorySlot) {
return true;
}


/* Enchanting */

@Override
public boolean isEnchantable(ItemStack stack) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ public int getMaxStackSize(ItemStack stack) {
return 1;
}

@Override
public boolean isNotReplaceableByPickAction(ItemStack stack, Player player, int inventorySlot) {
return true;
}


/* Enchanting */

@Override
public boolean isEnchantable(ItemStack stack) {
return false;
Expand Down

0 comments on commit 8e4ca43

Please sign in to comment.