Added an item tag so other mods' shears and knives can be used to cut the pumpkin pie

This commit is contained in:
Sollace 2023-08-16 00:06:52 +01:00
parent c56170b560
commit b91eb9c3f8
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
3 changed files with 11 additions and 2 deletions

View file

@ -17,6 +17,7 @@ public interface UTags {
TagKey<Item> FRESH_APPLES = item("fresh_apples");
TagKey<Item> FALLS_SLOWLY = item("falls_slowly");
TagKey<Item> CAN_CUT_PIE = item("can_cut_pie");
TagKey<Item> MAGIC_FEATHERS = item("magic_feathers");

View file

@ -66,7 +66,7 @@ public class PieBlock extends Block implements Waterloggable {
if (world.isClient) {
if (itemStack.getItem() == Items.SHEARS) {
if (itemStack.isIn(UTags.CAN_CUT_PIE)) {
return ActionResult.SUCCESS;
}
@ -79,9 +79,10 @@ public class PieBlock extends Block implements Waterloggable {
}
}
if (itemStack.getItem() == Items.SHEARS) {
if (itemStack.isIn(UTags.CAN_CUT_PIE)) {
SoundEmitter.playSoundAt(player, USounds.BLOCK_PIE_SLICE, SoundCategory.NEUTRAL, 1, 1);
removeSlice(world, pos, state, player);
itemStack.damage(1, player, p -> p.sendToolBreakStatus(hand));
SoundEmitter.playSoundAt(player, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.NEUTRAL, 0.5F, world.getRandom().nextFloat() * 0.1F + 0.9F);
Block.dropStack(world, pos, sliceItem.asItem().getDefaultStack());
return ActionResult.SUCCESS;

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"c:shears",
{ "id": "#c:tools/knives", "required": false}
]
}