Package com.sk89q.worldedit.entity
Class BaseEntity
java.lang.Object
com.sk89q.worldedit.entity.BaseEntity
- All Implemented Interfaces:
NbtValued
- Direct Known Subclasses:
LazyBaseEntity
Represents a mutable "snapshot" of an entity.
An instance of this class contains all the information needed to accurately reproduce the entity, provided that the instance was made correctly. In some implementations, it may not be possible to get a snapshot of entities correctly, so, for example, the NBT data for an entity may be missing.
This class identifies entities using its entity type string, although this is not very efficient as the types are currently not interned. This may be changed in the future.
-
Constructor Summary
ConstructorDescriptionBaseEntity
(CompoundTag tag) BaseEntity
(BaseEntity other) Make a clone of aBaseEntity
.BaseEntity
(EntityType type) Create a new base entity with no NBT data.BaseEntity
(EntityType type, CompoundTag nbtData) Deprecated.BaseEntity
(EntityType type, LazyReference<org.enginehub.linbus.tree.LinCompoundTag> nbtData) Create a new base entity. -
Method Summary
Modifier and TypeMethodDescriptionLazyReference
<org.enginehub.linbus.tree.LinCompoundTag> Get the object's NBT data (tile entity data).getType()
Get the type of entity.void
setNbtReference
(LazyReference<org.enginehub.linbus.tree.LinCompoundTag> nbtData) Set the object's NBT data (tile entity data).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.sk89q.worldedit.world.NbtValued
getNbt, getNbtData, hasNbtData, setNbt, setNbtData
-
Constructor Details
-
BaseEntity
Deprecated.Create a new base entity.- Parameters:
type
- the entity typenbtData
- NBT data
-
BaseEntity
Create a new base entity.- Parameters:
type
- the entity typenbtData
- NBT data
-
BaseEntity
Create a new base entity with no NBT data.- Parameters:
type
- the entity type
-
BaseEntity
Make a clone of aBaseEntity
.- Parameters:
other
- the object to clone
-
BaseEntity
-
-
Method Details
-
getNbtReference
Description copied from interface:NbtValued
Get the object's NBT data (tile entity data).This only needs to be used if you don't want to immediately resolve the data. Otherwise, you probably want
NbtValued.getNbt()
.- Specified by:
getNbtReference
in interfaceNbtValued
- Returns:
- compound tag, or null
-
setNbtReference
public void setNbtReference(@Nullable LazyReference<org.enginehub.linbus.tree.LinCompoundTag> nbtData) Description copied from interface:NbtValued
Set the object's NBT data (tile entity data).- Specified by:
setNbtReference
in interfaceNbtValued
- Parameters:
nbtData
- NBT data, or null if no data
-
getType
Get the type of entity.- Returns:
- the entity type
-
BaseEntity(EntityType, LazyReference)