Contents
Class UnknownComponents<ECS_TYPE>
java.lang.Object
com.hypixel.hytale.component.data.unknown.UnknownComponents<ECS_TYPE>
- Type Parameters:
ECS_TYPE- The type of ECS the component is for.
A component that holds unknown components for an entity.
If an entity is loaded that has components that are not recognized by the current ECS, those components are stored in an instance of this class. This allows for the data of those components to be preserved, even if they cannot be processed.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BuilderCodec<UnknownComponents> The codec used to parseUnknownComponentsinstances.static final StringThe ID of the component.static final HytaleLoggerThe logger for this class.Fields inherited from interface Component
EMPTY_ARRAY -
Constructor Summary
ConstructorsConstructorDescriptionEmpty Constructor for aUnknownComponentsinstance.UnknownComponents(Map<String, org.bson.BsonDocument> unknownComponents) Default Constructor for aUnknownComponentsinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled to add an unknown component to this instance.voidaddComponent(String componentId, TempUnknownComponent<ECS_TYPE> component) Called to add an unknown component to this instance.clone()booleanDetermines whether this instance contains a component with the given ID.removeComponent(String componentId, Codec<T> codec) Called to remove an unknown component from this instance.Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Component
cloneSerializable
-
Field Details
-
LOGGER
The logger for this class. -
ID
-
CODEC
The codec used to parseUnknownComponentsinstances.
-
-
Constructor Details
-
UnknownComponents
public UnknownComponents()Empty Constructor for aUnknownComponentsinstance. -
UnknownComponents
Default Constructor for aUnknownComponentsinstance.- Parameters:
unknownComponents- The map of unknown components.
-
-
Method Details
-
addComponent
public void addComponent(@Nonnull String componentId, @Nonnull Component<ECS_TYPE> component, @Nonnull Codec<Component<ECS_TYPE>> codec) Called to add an unknown component to this instance.- Parameters:
componentId- The ID of the component.component- The component to add.codec- The codec to use to encode the component.
-
addComponent
public void addComponent(@Nonnull String componentId, @Nonnull TempUnknownComponent<ECS_TYPE> component) Called to add an unknown component to this instance.- Parameters:
componentId- The ID of the component.component- The temporary unknown component to add.
-
contains
Determines whether this instance contains a component with the given ID.- Parameters:
componentId- The ID of the component.- Returns:
trueif this instance contains a component with the given ID,falseotherwise.
-
removeComponent
@Nullable public <T extends Component<ECS_TYPE>> T removeComponent(@Nonnull String componentId, @Nonnull Codec<T> codec) Called to remove an unknown component from this instance.- Type Parameters:
T- The type of the component.- Parameters:
componentId- The ID of the component.codec- The codec to use to decode the component.- Returns:
- the removed component, or
nullif no component with the given ID was found.
-
getUnknownComponents
-
clone
-