mirror of
https://github.com/KAMKEEL/CustomNPC-Plus-API.git
synced 2026-11-17 11:05:13 +00:00
Entity API Documentation
This commit is contained in:
1 parent
3593a09d1d
commit
8c2c226d34
21 files changed
+2778
-1142
No files matched your search
@@ -1,27 +1,66 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
public interface IAnimal<T extends EntityAnimal> extends IEntityLiving<T> {
|
||||
/**
|
||||
* Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
|
||||
* the animal type)
|
||||
*/
|
||||
boolean isBreedingItem(IItemStack itemStack);
|
||||
|
||||
/**
|
||||
* Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig
|
||||
*/
|
||||
boolean interact(IPlayer player);
|
||||
|
||||
void setFollowPlayer(IPlayer player);
|
||||
|
||||
IPlayer followingPlayer();
|
||||
|
||||
boolean isInLove();
|
||||
|
||||
void resetInLove();
|
||||
|
||||
boolean canMateWith(IAnimal animal);
|
||||
}
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
/**
|
||||
* Represents an animal entity with additional behavior such as breeding,
|
||||
* following, and mating.
|
||||
*
|
||||
* @param <T> the underlying Minecraft EntityAnimal type.
|
||||
*/
|
||||
public interface IAnimal<T extends EntityAnimal> extends IEntityLiving<T> {
|
||||
|
||||
/**
|
||||
* Checks whether the specified item can be used to breed this animal.
|
||||
* (e.g. wheat, carrots or seeds depending on the animal type)
|
||||
*
|
||||
* @param itemStack the item to test.
|
||||
* @return true if the item is a breeding item; false otherwise.
|
||||
*/
|
||||
boolean isBreedingItem(IItemStack itemStack);
|
||||
|
||||
/**
|
||||
* Called when a player interacts with the animal.
|
||||
* For example, this might return true if the player milks a cow or saddles a pig.
|
||||
*
|
||||
* @param player the interacting player.
|
||||
* @return true if the interaction was handled; false otherwise.
|
||||
*/
|
||||
boolean interact(IPlayer player);
|
||||
|
||||
/**
|
||||
* Sets the specified player as the one to follow.
|
||||
*
|
||||
* @param player the player to follow.
|
||||
*/
|
||||
void setFollowPlayer(IPlayer player);
|
||||
|
||||
/**
|
||||
* Returns the player that this animal is currently following.
|
||||
*
|
||||
* @return the following player, or null if not following anyone.
|
||||
*/
|
||||
IPlayer followingPlayer();
|
||||
|
||||
/**
|
||||
* Checks if the animal is currently in a "love" state,
|
||||
* indicating readiness to mate.
|
||||
*
|
||||
* @return true if the animal is in love; false otherwise.
|
||||
*/
|
||||
boolean isInLove();
|
||||
|
||||
/**
|
||||
* Resets the animal's love state.
|
||||
*/
|
||||
void resetInLove();
|
||||
|
||||
/**
|
||||
* Checks if this animal can mate with another animal.
|
||||
*
|
||||
* @param animal the other animal.
|
||||
* @return true if mating is possible; false otherwise.
|
||||
*/
|
||||
boolean canMateWith(IAnimal animal);
|
||||
}
|
||||
Reference in new issue
Block a user