Class DropItemsComponent

java.lang.Object
com.hypixel.hytale.server.core.modules.entity.item.DropItemsComponent
All Implemented Interfaces:
Component<EntityStore>, Cloneable

public class DropItemsComponent extends Object implements Component<EntityStore>
A component holding item stacks that DropItemsSystem drops at the entity's position on its next tick. Queue items on it to defer dropping, e.g. from contexts where the entity is not yet in a world or where spawning entities is not possible.
  • Constructor Details

    • DropItemsComponent

      public DropItemsComponent()
      Default Constructor for a DropItemsComponent instance.
    • DropItemsComponent

      public DropItemsComponent(@Nonnull List<ItemStack> items)
      Constructor for a DropItemsComponent instance holding the given item stacks.
      Parameters:
      items - The item stacks to drop.
  • Method Details

    • getComponentType

      @Nonnull public static ComponentType<EntityStore, DropItemsComponent> getComponentType()
      Returns:
      the DropItemsComponent type.
    • getItems

      @Nonnull public List<ItemStack> getItems()
      Returns:
      the item stacks waiting to be dropped.
    • queue

      public static void queue(@Nonnull Holder<EntityStore> holder, @Nonnull List<ItemStack> itemStacks)
      Queues item stacks to be dropped by the entity, creating the component if absent.
      Parameters:
      holder - The holder of the entity dropping the items.
      itemStacks - The item stacks to drop.
    • queue

      public static void queue(@Nonnull Ref<EntityStore> ref, @Nonnull CommandBuffer<EntityStore> commandBuffer, @Nonnull List<ItemStack> itemStacks)
      Queues item stacks to be dropped by the entity, creating the component if absent.
      Parameters:
      ref - The entity reference of the entity dropping the items.
      commandBuffer - The command buffer to submit the component through.
      itemStacks - The item stacks to drop.
    • clone

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