SPIGOT-4705: Revamp Ageable interface and add Breedable interface

By: Shane Bee <shanebolenback@me.com>
This commit is contained in:
Bukkit/Spigot 2020-08-13 11:18:50 +10:00
parent 319278404d
commit 43a2f06e98
7 changed files with 70 additions and 12 deletions

View File

@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull;
/**
* Represents a villager NPC
*/
public interface AbstractVillager extends Ageable, NPC, InventoryHolder, Merchant {
public interface AbstractVillager extends Breedable, NPC, InventoryHolder, Merchant {
/**
* Gets this villager's inventory.

View File

@ -1,18 +1,18 @@
package org.bukkit.entity;
/**
* Represents an entity that can age and breed.
* Represents an entity that can age.
*/
public interface Ageable extends Creature {
/**
* Gets the age of this animal.
* Gets the age of this mob.
*
* @return Age
*/
public int getAge();
/**
* Sets the age of this animal.
* Sets the age of this mob.
*
* @param age New age
*/
@ -23,30 +23,34 @@ public interface Ageable extends Creature {
* maturing or getting ready for mating.
*
* @param lock new lock
* @deprecated see {@link Breedable#setAgeLock(boolean)}
*/
@Deprecated
public void setAgeLock(boolean lock);
/**
* Gets the current agelock.
*
* @return the current agelock
* @deprecated see {@link Breedable#getAgeLock()}
*/
@Deprecated
public boolean getAgeLock();
/**
* Sets the age of the animal to a baby
* Sets the age of the mob to a baby
*/
public void setBaby();
/**
* Sets the age of the animal to an adult
* Sets the age of the mob to an adult
*/
public void setAdult();
/**
* Returns true if the animal is an adult.
* Returns true if the mob is an adult.
*
* @return return true if the animal is an adult
* @return return true if the mob is an adult
*/
public boolean isAdult();
@ -54,7 +58,9 @@ public interface Ageable extends Creature {
* Return the ability to breed of the animal.
*
* @return the ability to breed of the animal
* @deprecated see {@link Breedable#canBreed()}
*/
@Deprecated
public boolean canBreed();
/**
@ -62,6 +68,8 @@ public interface Ageable extends Creature {
* breed it will instantly grow up.
*
* @param breed breedability of the animal
* @deprecated see {@link Breedable#setBreed(boolean)}
*/
@Deprecated
public void setBreed(boolean breed);
}

View File

@ -6,7 +6,7 @@ import org.jetbrains.annotations.Nullable;
/**
* Represents an Animal.
*/
public interface Animals extends Ageable {
public interface Animals extends Breedable {
/**
* Get the UUID of the entity that caused this entity to enter the

View File

@ -0,0 +1,38 @@
package org.bukkit.entity;
/**
* Represents an entity that can age and breed.
*/
public interface Breedable extends Ageable {
/**
* Lock the age of the animal, setting this will prevent the animal from
* maturing or getting ready for mating.
*
* @param lock new lock
*/
public void setAgeLock(boolean lock);
/**
* Gets the current agelock.
*
* @return the current agelock
*/
public boolean getAgeLock();
/**
* Return the ability to breed of the animal.
*
* @return the ability to breed of the animal
*/
public boolean canBreed();
/**
* Set breedability of the animal, if the animal is a baby and set to
* breed it will instantly grow up.
*
* @param breed breedability of the animal
*/
public void setBreed(boolean breed);
}

View File

@ -3,7 +3,7 @@ package org.bukkit.entity;
/**
* Piglin / Piglin Brute.
*/
public interface PiglinAbstract extends Monster {
public interface PiglinAbstract extends Monster, Ageable {
/**
* Gets whether the piglin is immune to zombification.
@ -53,13 +53,17 @@ public interface PiglinAbstract extends Monster {
* Gets whether the piglin is a baby
*
* @return Whether the piglin is a baby
* @deprecated see {@link Ageable#isAdult()}
*/
@Deprecated
public boolean isBaby();
/**
* Sets whether the piglin is a baby
*
* @param flag Whether the piglin is a baby
* @deprecated see {@link Ageable#setBaby()} and {@link Ageable#setAdult()}
*/
@Deprecated
public void setBaby(boolean flag);
}

View File

@ -3,19 +3,23 @@ package org.bukkit.entity;
/**
* Represents a Zoglin.
*/
public interface Zoglin extends Monster {
public interface Zoglin extends Monster, Ageable {
/**
* Gets whether the zoglin is a baby
*
* @return Whether the zoglin is a baby
* @deprecated see {@link Ageable#isAdult()}
*/
@Deprecated
public boolean isBaby();
/**
* Sets whether the zoglin is a baby
*
* @param flag Whether the zoglin is a baby
* @deprecated see {@link Ageable#setBaby()} and {@link Ageable#setAdult()}
*/
@Deprecated
public void setBaby(boolean flag);
}

View File

@ -6,20 +6,24 @@ import org.jetbrains.annotations.Nullable;
/**
* Represents a Zombie.
*/
public interface Zombie extends Monster {
public interface Zombie extends Monster, Ageable {
/**
* Gets whether the zombie is a baby
*
* @return Whether the zombie is a baby
* @deprecated see {@link Ageable#isAdult()}
*/
@Deprecated
public boolean isBaby();
/**
* Sets whether the zombie is a baby
*
* @param flag Whether the zombie is a baby
* @deprecated see {@link Ageable#setBaby()} and {@link Ageable#setAdult()}
*/
@Deprecated
public void setBaby(boolean flag);
/**