#856: Add methods to check if item is the breed item for an entity

This commit is contained in:
Nathat23 2021-06-13 08:37:53 +10:00 committed by md_5
parent dd4bec5f13
commit 4ece3ff36d
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -3,8 +3,11 @@ package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import java.util.UUID; import java.util.UUID;
import net.minecraft.world.entity.animal.EntityAnimal; import net.minecraft.world.entity.animal.EntityAnimal;
import org.bukkit.Material;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.entity.Animals; import org.bukkit.entity.Animals;
import org.bukkit.inventory.ItemStack;
public class CraftAnimals extends CraftAgeable implements Animals { public class CraftAnimals extends CraftAgeable implements Animals {
@ -47,4 +50,14 @@ public class CraftAnimals extends CraftAgeable implements Animals {
public int getLoveModeTicks() { public int getLoveModeTicks() {
return getHandle().inLove; return getHandle().inLove;
} }
@Override
public boolean isBreedItem(ItemStack itemStack) {
return getHandle().n(CraftItemStack.asNMSCopy(itemStack));
}
@Override
public boolean isBreedItem(Material material) {
return isBreedItem(new ItemStack(material));
}
} }