Entity API Documentation

This commit is contained in:
Kam committed 2025-03-06 01:48:39 -05:00
1 parent 3593a09d1d
commit 8c2c226d34
21 files changed
+2778 -1142

No files matched your search

+91 -56
View File
@@ -1,56 +1,91 @@
package noppes.npcs.api.entity;
import net.minecraft.entity.item.EntityItem;
import noppes.npcs.api.item.IItemStack;
public interface IEntityItem<T extends EntityItem> extends IEntity<T> {
/**
* @return The owner of the item, only the owner can pick the item up
*/
public String getOwner();
/**
* @param name The owner of the item, only the owner can pick up the item
* (note that the item can also be picked up if the lifetime - age is equal or smaller than 200)
*/
public void setOwner(String name);
public String getThrower();
public void setThrower(String name);
/**
* @return Ticks remaining before it can be picked up (32767 is infinite)
*/
public int getPickupDelay();
/**
* @param delay Delay before the item can be picked up (32767 is infinite delay)
*/
public void setPickupDelay(int delay);
/**
* @return Returns the age of the item
*/
public long getAge();
/**
* @param age Age of the item (-32767 is infinite age)
*/
public void setAge(long age);
/**
* @return When the age reaches this the item despawns
*/
public int getLifeSpawn();
/**
* @param age Age at which the item despawns
*/
public void setLifeSpawn(int age);
public IItemStack getItem();
public void setItem(IItemStack item);
}
package noppes.npcs.api.entity;
import net.minecraft.entity.item.EntityItem;
import noppes.npcs.api.item.IItemStack;
/**
* Represents an item entity in the world.
* Provides methods to manage pickup delay, age, ownership, and the contained item.
*
* @param <T> The underlying Minecraft EntityItem type.
*/
public interface IEntityItem<T extends EntityItem> extends IEntity<T> {
/**
* Returns the owner name of the item.
* Only the owner can pick the item up (unless the age is very low).
*
* @return the owner's name.
*/
String getOwner();
/**
* Sets the owner name of the item.
*
* @param name the owner's name.
*/
void setOwner(String name);
/**
* Returns the thrower (entity that threw the item).
*
* @return the thrower's name.
*/
String getThrower();
/**
* Sets the thrower (entity that threw the item).
*
* @param name the thrower's name.
*/
void setThrower(String name);
/**
* @return Ticks remaining before the item can be picked up.
* (32767 indicates an infinite delay.)
*/
int getPickupDelay();
/**
* Sets the delay before the item can be picked up.
*
* @param delay the pickup delay in ticks (32767 for infinite delay).
*/
void setPickupDelay(int delay);
/**
* @return The age of the item in ticks.
*/
long getAge();
/**
* Sets the age of the item.
*
* @param age the new age (−32767 indicates infinite age).
*/
void setAge(long age);
/**
* @return The lifespan threshold; when the age reaches this, the item despawns.
*/
int getLifeSpawn();
/**
* Sets the age threshold at which the item will despawn.
*
* @param age the lifespan in ticks.
*/
void setLifeSpawn(int age);
/**
* @return The item contained in this entity.
*/
IItemStack getItem();
/**
* Sets the item contained in this entity.
*
* @param item the item to set.
*/
void setItem(IItemStack item);
}