Skip to content

ItemEntityHelper ​

com.jsmacrosce.jsmacros.client.api.helper.world.entity.ItemEntityHelper

A dropped stack of items in the world.

js
// Log dropped stacks within ten blocks.  
const items = World.getEntities(10, "item");  
if (items !== null) {
 for (const entity of items) {
   if (!(entity instanceof EntityHelpers.Item)) continue;  
   const stack = entity.getContainedItemStack();  
   Chat.log(`${stack.getCount()} ${stack.getItemId()} at ${entity.getPos()}`);  
 }
}

Available in scripts as EntityHelpers.Item.

Constructors ​

new ItemEntityHelper ​

new ItemEntityHelper(ItemEntity e)#
Wraps the supplied item entity.

Parameters:

  • e: raw item entity to wrap

Methods ​

getContainedItemStack ​

getContainedItemStack(): ItemStackHelper#
Returns the stack currently represented by this entity. The result may be empty; reading it does not pick up the items.
Returns: the entity's current stack, possibly empty

toString ​

toString(): String#
Returns a diagnostic representation of this item entity and its contained stack.
Returns: diagnostic representation of the item entity and its contained stack