Contents
- Description
- Method Summary
- Method Details
- emptyArray()
- ensureComponentsSize(int)
- init(Archetype, Component[])
- _internal_init(Archetype, Component[], ComponentType)
- getArchetype()
- ensureComponent(ComponentType)
- ensureAndGetComponent(ComponentType)
- addComponent(ComponentType, T)
- replaceComponent(ComponentType, T)
- putComponent(ComponentType, T)
- getComponent(ComponentType)
- removeComponent(ComponentType)
- tryRemoveComponent(ComponentType)
- hasSerializableComponents(ComponentRegistry.Data)
- updateData(ComponentRegistry.Data, ComponentRegistry.Data)
- clone()
- cloneSerializable(ComponentRegistry.Data)
- cloneSerializable(ComponentRegistry.Data, Predicate)
- equals(Object)
- hashCode()
- toString()
Class Holder<ECS_TYPE>
java.lang.Object
com.hypixel.hytale.component.Holder<ECS_TYPE>
Used to hold AoS style data for when moving an entity around or serializing it.
Components are packed into SoA style in data chunks.
-
Method Summary
Modifier and TypeMethodDescriptionvoid_internal_init(Archetype<ECS_TYPE> archetype, Component<ECS_TYPE>[] components, ComponentType<ECS_TYPE, UnknownComponents<ECS_TYPE>> unknownComponentType) addComponent(ComponentType<ECS_TYPE, T> componentType, T component) Called to add the given component of the given component type to this holder.clone()cloneSerializable(ComponentRegistry.Data<ECS_TYPE> data, Predicate<ComponentType<ECS_TYPE, ?>> filter) static <T> Holder<T>[]ensureAndGetComponent(ComponentType<ECS_TYPE, T> componentType) Called to ensure and get the component instance of a specific type from this holder.ensureComponent(ComponentType<ECS_TYPE, T> componentType) Called to ensure that this holder has the given component type, adding the component instance if it doesn't.ensureComponentsSize(int size) Called to ensure that the array of components within this holder abides to the given size.booleangetComponent(ComponentType<ECS_TYPE, T> componentType) Called to get the component instance of the given component type from this holder.inthashCode()booleanDetermines whether this holder contains serializable components.voidCalled to initialize this holder.putComponent(ComponentType<ECS_TYPE, T> componentType, T component) Called to put the given component instance of the given component type into this holder.removeComponent(ComponentType<ECS_TYPE, T> componentType) Called to remove the component instance of the given component type from this holder.replaceComponent(ComponentType<ECS_TYPE, T> componentType, T component) Called to replace a component instance with the given instance of the given component type for this holder.toString()tryRemoveComponent(ComponentType<ECS_TYPE, T> componentType) Called to try and remove the component instance of the given component type from this holder.voidupdateData(ComponentRegistry.Data<ECS_TYPE> oldData, ComponentRegistry.Data<ECS_TYPE> newData)
-
Method Details
-
emptyArray
-
ensureComponentsSize
Called to ensure that the array of components within this holder abides to the given size.- Parameters:
size- The given size that the components array should abide to.- Returns:
- the array of component instances associated with this holder.
-
init
-
_internal_init
public void _internal_init(@Nonnull Archetype<ECS_TYPE> archetype, @Nonnull Component<ECS_TYPE>[] components, @Nonnull ComponentType<ECS_TYPE, UnknownComponents<ECS_TYPE>> unknownComponentType) -
getArchetype
-
ensureComponent
public <T extends Component<ECS_TYPE>> void ensureComponent(@Nonnull ComponentType<ECS_TYPE, T> componentType) Called to ensure that this holder has the given component type, adding the component instance if it doesn't.- Type Parameters:
T- The component type class of the component.- Parameters:
componentType- The component type that we are ensuring this holder has.
-
ensureAndGetComponent
@Nonnull public <T extends Component<ECS_TYPE>> T ensureAndGetComponent(@Nonnull ComponentType<ECS_TYPE, T> componentType) Called to ensure and get the component instance of a specific type from this holder.- Type Parameters:
T- The component type class of the component.- Parameters:
componentType- The component type that we are ensuring and getting from this holder.- Returns:
- the component instance that we are ensuring and getting.
-
addComponent
public <T extends Component<ECS_TYPE>> void addComponent(@Nonnull ComponentType<ECS_TYPE, T> componentType, @Nonnull T component) Called to add the given component of the given component type to this holder.- Type Parameters:
T- The component type class of the component.- Parameters:
componentType- The component type of the component that we are adding.component- The instance of the component that we are adding.
-
replaceComponent
public <T extends Component<ECS_TYPE>> void replaceComponent(@Nonnull ComponentType<ECS_TYPE, T> componentType, @Nonnull T component) Called to replace a component instance with the given instance of the given component type for this holder.- Type Parameters:
T- The component type class of the component.- Parameters:
componentType- The component type of the component that we are replacing.component- The instance of the component that we are replacing the existing instance with.
-
putComponent
public <T extends Component<ECS_TYPE>> void putComponent(@Nonnull ComponentType<ECS_TYPE, T> componentType, @Nonnull T component) Called to put the given component instance of the given component type into this holder.- Type Parameters:
T- The component type class of the component.- Parameters:
componentType- The component type of the component that we are putting.component- The instance of the component that we are putting
-
getComponent
@Nullable public <T extends Component<ECS_TYPE>> T getComponent(@Nonnull ComponentType<ECS_TYPE, T> componentType) Called to get the component instance of the given component type from this holder.- Type Parameters:
T- The component type class of the component.- Parameters:
componentType- The component type of the component that we are getting.- Returns:
- the component instance of the given component type, or
nullif the component doesn't exist.
-
removeComponent
public <T extends Component<ECS_TYPE>> void removeComponent(@Nonnull ComponentType<ECS_TYPE, T> componentType) Called to remove the component instance of the given component type from this holder.- Type Parameters:
T- The component type class of the component.- Parameters:
componentType- The component type of the component that we are removing.
-
tryRemoveComponent
public <T extends Component<ECS_TYPE>> boolean tryRemoveComponent(@Nonnull ComponentType<ECS_TYPE, T> componentType) Called to try and remove the component instance of the given component type from this holder.- Type Parameters:
T- The component type class of the component.- Parameters:
componentType- The component type of the component to remove.- Returns:
trueif the component exists,falseotherwise.
-
hasSerializableComponents
Determines whether this holder contains serializable components.- Parameters:
data- The registry data of the component registry.- Returns:
trueif serializable components exist,falseotherwise.
-
updateData
public void updateData(@Nonnull ComponentRegistry.Data<ECS_TYPE> oldData, @Nonnull ComponentRegistry.Data<ECS_TYPE> newData) -
clone
-
cloneSerializable
-
cloneSerializable
public Holder<ECS_TYPE> cloneSerializable(@Nonnull ComponentRegistry.Data<ECS_TYPE> data, @Nullable Predicate<ComponentType<ECS_TYPE, ?>> filter) -
equals
-
hashCode
-
toString
-