Skip to content

Conditions

Esophose edited this page Oct 4, 2024 · 68 revisions

Introduction

There are several (100+) conditions for you to choose from to allow extreme fine tuning of loot tables. Not all conditions are treated equally, some will only apply to specific loot table types. Conditions that are not used by all loot table types will specify which types they will work with. All loot tables with a type of LOOT_TABLE may use any conditions, though it will be dependent on what loot table type is using the separate loot table. Any conditions that are not valid for a loot table type will always evaluate to false and will prevent the loot table from executing.

The Basics

Conditions determine the control flow of the loot table. All conditions for a section must pass in order to continue to the next section. If there are conditions listed at the top of the loot table file, they must all pass in order for the overwrite-existing setting to do anything. In order for the loot table to continue processing, all conditions listed must pass. Conditions follow the format of condition-name:value1,value2,etc... Some conditions may not require any values, in which case they would just appear as condition-name.

OR

If you want to require one condition OR another to pass, you can make a condition with the following format: biome:forest||dimension:nether. With this format, only a single condition within it has to pass for it to be evaluated to true. You may provide as many conditions as you want using this format.

AND

If you want to require one condition AND another to pass, you can make a condition with the following format: block-type:netherrack&&dimension:nether. With this format, all conditions within it has to pass for it to be evaluated to true. You may provide as many conditions as you want using this format.

Negation

Conditions can be inverted by adding a ! at the beginning like so: !condition-name:value1,value2,value3. For example, if you want any biome except for forest, use !biome:forest.

Advanced Formatting

The above properties can all be combined with the use of parenthesis (). Here is an advanced example that checks if the player is using any tool other than shears or one with silk touch: !(required-tool-type:shears || enchantment:silk_touch). Any whitespace used in conditions is purely decorative.

Values

Condition Description Types Values Example
advancement The advancement must have a specific key ADVANCEMENT Advancement, requires 1 or more advancement:story/upgrade_tools
baby The entity must be a baby, works for both animals and monsters ENTITY None baby
biome The biome the loot must be generated in. If you are using a custom biomes plugin, see the biome-key condition below instead. ALL Biome Type, requires 1 or more biome:flower_forest
biome-key The key of the biome the loot must be generated in. Requires Paper. ALL Biome NamespacedKey, requires 1 or more biome-key:plains

biome-key:terralith:sakura_grove

block-data Block must have a block data value BLOCK, CONTAINER Values can be found in the F3 menu when hovering over a block, requires 1 or more block-data:inverted=true
block-type The required type of block that was broken BLOCK, HARVEST, ARCHAEOLOGY Material or Tags, requires 1 or more block-type:coal_ore
burning Entity must be on fire ENTITY None burning
can-breed Animal must be able to breed when fed preferred food ENTITY None can-breed
can-join-raid Entity must be a raider and be able to join in a raid ENTITY None can-join-raid
chance Requires a random chance to pass ALL Requires a percentage between 0 and 100, allows decimals chance:35.5%
charged-explosion Requires the loot to be generated by a charged creeper explosion BLOCK, ENTITY None charged-explosion
chested Horse must have a chest, applies to all variants of horses ENTITY None chested
cooldown Allows obtaining loot only once per time interval. This should be the last condition in the list so it runs last. Cooldowns WILL persist across restarts. ALL The first value can be anything and is used to identify individual cooldowns. Second value must be either player (cooldown per player) or global (cooldown for the whole server). Third value is the cooldown duration and may be formatted like 250ms2s5m1h2d (ms = milliseconds, s = seconds, m = minutes, h = hours, d = days). cooldown:special_drop,player,5m
custom-model-data Requires the item used to have a specific custom model data value ANY Whole number, requires 1 or more custom-model-data:5
death-cause The required cause of death for an entity ENTITY Damage Cause, requires 1 or more death-cause:fire
dimension Loot must be generated within a specific dimension ALL Environment, requires 1 or more dimension:nether
enchantment-chance-table Requires a random chance to pass based on a chance chosen from a table indexed by the desired enchantment level ALL Enchantment, first value is the enchantment, all additional values are the percent chance of the index starting at 0 enchantment-chance-table:looting,5%,6.25%,8.33%,10%
enchantment-chance Requires a random chance to pass with additional chance based on the tool's enchantment level ALL Enchantment, first value is the base percentage, second value is the enchantment type, third value is the additional chance per enchantment level, fourth value is optional and is the max number of levels that will be counted enchantment-chance:10%,looting,20%,3
enchantment Requires the tool used to have an enchantment with an optional required level ALL Enchantment, first value is required and an enchantment name, second value is optional and is the minimum enchantment level required enchantment:fire_aspect,2
entity-type Requires the killed entity to be of a certain type ENTITY Entity Type or Tags prefixed with #, requires 1 or more entity-type:zombie,zombie_villager
explosion Requires the loot to be generated by an explosion BLOCK, ENTITY None explosion
feature Loot must be generated within a specific structure ALL Feature, requires 1 or more feature:fortress
freezing Entity must be shivering from being submerged in powdered snow ENTITY None freezing
grown-crop The crop must be fully grown BLOCK None grown-crop
has-existing-drops The server loot generated must have created at least one item ANY None has-existing-drops
has-saddle The looted entity must have a saddle ANY None has-saddle
humidity Humidity level of the location must be at least this value or higher. This value ranges from 0 to ~1 (rarely higher), values less than 0.1 will never rain. ALL Number, supports decimals !humidity:0.1
in-fluid Loot must be generated within a specific fluid ALL water or lava; requires 1 or more in-fluid:water
input-item Requires the input item to match ENTITY_DROP_ITEM, PIGLIN_BARTER, HARVEST Material or Tags, requires 1 or more input-item:pink_wool
killed-by Entity must be killed by a certain entity type, will detect a projectile's shooter ENTITY Entity Type or Tags prefixed with #, requires 1 or more killed-by:skeleton,stray,wither_skeleton or killed-by:#skeletons
light-level The light level the loot must be generated at must be this value or higher ALL Whole number between 0 to 15 light-level:7
looter-entity-type Loot event must be triggered by a specific entity type ALL Entity Type or Tags prefixed with #, requires 1 or more looter-entity-type:spectral_arrow
luck-chance Requires a random chance to pass with additional chance based on the player's luck level ALL First value is the base percentage, second value is the additional chance per level of luck. luck-chance:10%,5%
moon-phase The moon in the night sky must have a certain phase. Requires Paper. ALL MoonPhase, requires 1 or more moon-phase:full_moon
ominous The Vault or Trial Spawner must be in an ominous state BLOCK None ominous
on-ground The killed entity must be on the ground ENTITY None on-ground
open-water Fishing bobber must be in a large body of water FISHING None open-water
patrol-leader Raider must be a patrol leader, aka has a pillager banner ENTITY None patrol-leader
permission Looter must have a permission ALL A permission, requires 1 or more permission:roseloot.example.permission
placeholder Parsed placeholder must match given value with given operation ALL PlaceholderAPI is supported, Context Placeholders are also supported. Operation is required and one of the following: !=, <=, >=, =, <, >, ^ (contains) placeholder:%player_biome%^hills
potion-effect Requires the killer to have a certain potion effect level ALL Potion Effect, first value is required and is the potion effect type, second parameter is optional and is the level of potion effect required potion-effect:haste,2
relative-block-type The block at a relative position must be of a certain type ALL First value is a BlockFace, all other values are Material or Tags, requires 1 or more relative-block-type:north,stone
required-tool The tool type and quality required ALL First value is required and one of the following: shovel, pickaxe, axe, hoe, sword, or shears. Second value is optional and one of the following: wood, stone, gold, iron, diamond, or netherite required-tool:pickaxe,stone
required-tool-type The tool type must match ALL Material or Tags, requires 1 or more required-tool-type:bow,apple,golden_pickaxe
replaced-block-type Used for checking if a block broke another block, like water flowing over crops BLOCK Material or Tags, requires 1 or more replaced-block-type:water
sitting Animal must be sitting, applies to tamed animals ENTITY None sitting
sleeping Entity must be sleeping, mainly applies to players, villagers, and foxes ENTITY None sleeping
sneaking Player must be sneaking ALL None sneaking
spawner-type The required type of spawner broken BLOCK Entity Type, requires 1 or more spawner-type:skeleton
spawn-reason The required spawn reason of the entity ENTITY Spawn Reason, requires 1 or more spawn-reason:spawner
tamed The entity must be tamed by a player ENTITY None tamed
tamed-pet-owner The pet must be killed by its owner ENTITY None tamed-pet-owner
temperature Temperature level of the location must be at least this value or higher. You can find info on temperatures here. ALL Number, supports decimals temperature:0.15
trading Merchant must be in the middle of trading with a player ENTITY None trading
trial-spawner-state The required state of the Trial Spawner BLOCK Trial Spawner State, requires 1 or more trial-spawner-state:ejecting
vanilla-loot-table The key of the vanilla loot table involved in the loot generation CONTAINER, ARCHAEOLOGY Loot Table, requires 1 or more vanilla-loot-table:chests/simple_dungeon
vault-state The required state of the Vault BLOCK Vault State, requires 1 or more vault-state:ejecting
weather The type of weather the world must have ALL clear, rain, or storm; requires 1 or more weather:clear
world The name of the world the loot must be generated in ALL World name, requires 1 or more world:world_nether