Add love mode API to Animals

This commit is contained in:
Parker Hawke 2019-02-27 21:56:25 +00:00 committed by md_5
parent 40cbae42b1
commit 0f708cbf51
2 changed files with 22 additions and 2 deletions

View File

@ -1,8 +1,11 @@
--- a/net/minecraft/server/EntityAnimal.java
+++ b/net/minecraft/server/EntityAnimal.java
@@ -8,6 +8,7 @@
@@ -6,8 +6,9 @@
public abstract class EntityAnimal extends EntityAgeable implements IAnimal {
protected Block bF;
private int bC;
- private int bC;
+ public int bC; // CraftBukkit - private -> public
public UUID breedCause;
+ public ItemStack breedItem; // CraftBukkit - Add breedItem variable

View File

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.entity;
import java.util.UUID;
import com.google.common.base.Preconditions;
import net.minecraft.server.EntityAnimal;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Animals;
@ -30,4 +31,20 @@ public class CraftAnimals extends CraftAgeable implements Animals {
public void setBreedCause(UUID uuid) {
getHandle().breedCause = uuid;
}
@Override
public boolean isLoveMode() {
return getHandle().isInLove();
}
@Override
public void setLoveModeTicks(int ticks) {
Preconditions.checkArgument(ticks >= 0, "Love mode ticks must be positive or 0");
getHandle().d(ticks); // PAIL rename setLoveModeTicks
}
@Override
public int getLoveModeTicks() {
return getHandle().bC; // PAIL rename loveTicks
}
}