Skip to content

Context Placeholders

Esophose edited this page Jun 27, 2022 · 11 revisions

Introduction

Context placeholders can be used within loot items to display information about a previous loot item, such as the number of items or amount of currency given. These special placeholders are currently available for use with the command and message loot item types. More information about that can be found here.

Available Placeholders

You can find a list of all context placeholders available below. Note that PlaceholderAPI placeholders are also supported for use within commands.

Always Available

These placeholders will always be available and do not require any special conditions.

Placeholder Description
%world% The world the loot was generated in
%world_time_ticks% The time of the world in ticks (0-24000)
%x% The X coordinate the loot was generated at
%y% The Y coordinate the loot was generated at
%z% The Z coordinate the loot was generated at
%luck_level% The luck level of the looter. Will be 0 if there is no looter.

Conditionally Available

Placeholder Description Requirement
%player% That player that caused the loot to be generated A player must have caused the loot to generate
%entity_type% The entity type that was looted An entity must have been looted
%entity_name% The name of the entity that was looted An entity must have been looted
%block_type% The block type that was looted A block must have been looted
%item_type% The item used to loot The looting entity must be holding an item
%vanilla_loot_table_name% The vanilla loot table name The loot type must be a container that is generating for a vanilla loot table
%advancement_name% The advancement name The loot type must be an advancement
%explosion_type% The type of explosion that caused the loot The loot generation must have been triggered by an explosion
%item_amount% The number of items that were generated The loot generated must contain items
%experience_amount% The amount of experience that was generated The loot generated must contain the type experience
%economy_amount% The amount of currency that was generated The loot generated must contain the type economy

Example

type: LOOT_TABLE
conditions: []
pools:
  0:
    conditions: []
    rolls: 1
    bonus-rolls: 0
    entries:
      0:
        items:
          0:
            type: item
            item: emerald
            amount:
              min: 3
              max: 5
          1:
            type: command
            value: 'tellraw %player% {"text": "You got %item_amount% emeralds!","color":"yellow"}'
          2:
            type: sound
            sound: 'entity.firework_rocket.twinkle'
            volume: 0.5