Class CarriedBlock

java.lang.Object
com.hypixel.hytale.server.core.modules.interaction.components.CarriedBlock
All Implemented Interfaces:
Component<EntityStore>, Cloneable

public class CarriedBlock extends Object implements Component<EntityStore>
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 Details

  • Constructor Details

    • CarriedBlock

      public CarriedBlock()
    • CarriedBlock

      public CarriedBlock(@Nullable String blockTypeKey, @Nullable Holder<ChunkStore> holder, String entityEffectId)
  • Method Details

    • getComponentType

      @Nonnull public static ComponentType<EntityStore, CarriedBlock> getComponentType()
    • getBlockTypeKey

      @Nullable public String getBlockTypeKey()
    • getHolder

      @Nullable public Holder<ChunkStore> getHolder()
    • getEntityEffectId

      public String getEntityEffectId()
    • getCarriedItemId

      @Nullable public String getCarriedItemId()
      Resolves the item id of the carried block's item, used to render it in-hand on clients.
      Returns:
      the item id, or null if the block type is unknown or has no associated item.
    • getItemContainer

      public SimpleItemContainer getItemContainer()
    • clearItemBlockKey

      public void clearItemBlockKey()
    • clearItemContainer

      public void clearItemContainer()
    • toItemStack

      @Nullable public ItemStack toItemStack()
      Builds the item stack representing this carried block, re-attaching the block entity data under ItemStack.Metadata.BLOCK_HOLDER.
    • dropAndClear

      public static void dropAndClear(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> accessor)
    • clone

      @Nonnull public Component<EntityStore> clone()
      Specified by:
      clone in interface Component<EntityStore>
      Returns:
      a clone instance of the original component instance.