diff --git a/src/main/java/com/cgessinger/creaturesandbeasts/common/entites/LizardEntity.java b/src/main/java/com/cgessinger/creaturesandbeasts/common/entites/LizardEntity.java index b70f3c0..0f24f2f 100644 --- a/src/main/java/com/cgessinger/creaturesandbeasts/common/entites/LizardEntity.java +++ b/src/main/java/com/cgessinger/creaturesandbeasts/common/entites/LizardEntity.java @@ -52,6 +52,9 @@ import software.bernie.geckolib3.core.event.predicate.AnimationEvent; import software.bernie.geckolib3.core.manager.AnimationData; import software.bernie.geckolib3.core.manager.AnimationFactory; +import com.cgessinger.creaturesandbeasts.CreaturesAndBeasts; +import net.minecraft.tags.ITag; +import net.minecraft.tags.ItemTags; import javax.annotation.Nullable; import java.util.Arrays; @@ -62,6 +65,8 @@ public class LizardEntity extends AnimalEntity implements IAnimatable, IModNetable, IAnimationHolder { + private final ResourceLocation APPLE_SLICE = new ResourceLocation(CreaturesAndBeasts.MOD_ID, "apple_slice"); + private final AnimationFactory factory = new AnimationFactory( this ); private static final DataParameter PARTYING = @@ -218,7 +223,9 @@ public ActionResultType func_230254_b_( PlayerEntity player, Hand hand ) // on r { ActionResultType result = super.func_230254_b_( player, hand ); ItemStack item = player.getHeldItem( hand ); - if ( item.getItem() instanceof AppleSliceItem && this.isSad() ) + ITag apple_slice = ItemTags.getCollection().get(APPLE_SLICE); + boolean has_slices = apple_slice == null ? item.getItem() instanceof AppleSliceItem : apple_slice.contains(item.getItem()); + if( has_slices && this.isSad() ) { this.setSad( false ); item.shrink( player.abilities.isCreativeMode ? 0 : 1 ); @@ -346,7 +353,8 @@ public boolean shouldLookAround() @Override public boolean isBreedingItem( ItemStack stack ) { - return stack.getItem() instanceof AppleSliceItem; + ITag apple_slice = ItemTags.getCollection().get(APPLE_SLICE); + return apple_slice == null ? stack.getItem() instanceof AppleSliceItem : apple_slice.contains(stack.getItem()); } public void spawnParticles( IParticleData data ) diff --git a/src/main/resources/data/cnb/tags/items/apple_slice.json b/src/main/resources/data/cnb/tags/items/apple_slice.json new file mode 100644 index 0000000..8bff87f --- /dev/null +++ b/src/main/resources/data/cnb/tags/items/apple_slice.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "cnb:apple_slice" + ] +} \ No newline at end of file