Class MatchToolCondition
java.lang.Object
com.github.darksoulq.abyssallib.world.data.loot.LootCondition
com.github.darksoulq.abyssallib.world.data.loot.condition.MatchToolCondition
A loot condition that evaluates to true if the tool used in the generation context
matches a specific material.
This is primarily used for block-break loot tables where specific items should only drop when harvested with a specific tool (e.g., Shears for leaves).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec<MatchToolCondition> The codec used for serializing and deserializing the match tool condition.static final LootConditionType<MatchToolCondition> The registered type definition for the match tool loot condition. -
Constructor Summary
ConstructorsConstructorDescriptionMatchToolCondition(org.bukkit.Material item) Constructs a new MatchToolCondition for the specified material. -
Method Summary
Modifier and TypeMethodDescriptiongetType()Retrieves the specific type definition for this loot condition.booleantest(LootContext context) Tests whether the tool in the providedLootContextmatches the required material.
-
Field Details
-
CODEC
The codec used for serializing and deserializing the match tool condition.It maps the "item" field to a string representation of a
Material. -
TYPE
The registered type definition for the match tool loot condition.
-
-
Constructor Details
-
MatchToolCondition
public MatchToolCondition(org.bukkit.Material item) Constructs a new MatchToolCondition for the specified material.- Parameters:
item- TheMaterialto match against the context tool.
-
-
Method Details
-
test
Tests whether the tool in the providedLootContextmatches the required material.- Specified by:
testin classLootCondition- Parameters:
context- TheLootContextproviding the toolItemStack.- Returns:
trueif the tool is present and matches the material;falseotherwise.
-
getType
Retrieves the specific type definition for this loot condition.- Specified by:
getTypein classLootCondition- Returns:
- The
LootConditionTypeassociated withMatchToolCondition.
-