Contents
Class CarriedBlock
java.lang.Object
com.hypixel.hytale.server.core.modules.interaction.components.CarriedBlock
- All Implemented Interfaces:
Component<EntityStore>, Cloneable
A transient component placed on an entity that is carrying a block.
The component is not persisted, if the carrier dies or disconnects, the carried block is dropped.
-
Field Summary
FieldsFields inherited from interface Component
EMPTY_ARRAY -
Constructor Summary
ConstructorsConstructorDescriptionCarriedBlock(String blockTypeKey, Holder<ChunkStore> holder, String entityEffectId) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidclone()static voiddropAndClear(Ref<EntityStore> ref, ComponentAccessor<EntityStore> accessor) Resolves the item id of the carried block's item, used to render it in-hand on clients.static ComponentType<EntityStore, CarriedBlock> Builds the item stack representing this carried block, re-attaching the block entity data underItemStack.Metadata.BLOCK_HOLDER.Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Component
cloneSerializable
-
Field Details
-
CODEC
-
-
Constructor Details
-
CarriedBlock
public CarriedBlock() -
CarriedBlock
public CarriedBlock(@Nullable String blockTypeKey, @Nullable Holder<ChunkStore> holder, String entityEffectId)
-
-
Method Details
-
getComponentType
-
getBlockTypeKey
-
getHolder
-
getEntityEffectId
-
getCarriedItemId
Resolves the item id of the carried block's item, used to render it in-hand on clients.- Returns:
- the item id, or
nullif the block type is unknown or has no associated item.
-
getItemContainer
-
clearItemBlockKey
public void clearItemBlockKey() -
clearItemContainer
public void clearItemContainer() -
toItemStack
Builds the item stack representing this carried block, re-attaching the block entity data underItemStack.Metadata.BLOCK_HOLDER. -
dropAndClear
public static void dropAndClear(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> accessor) -
clone
- Specified by:
clonein interfaceComponent<EntityStore>- Returns:
- a clone instance of the original component instance.
-