Merge pull request #1134 from ludovic111/fix/loot-set-potion

🤖 Agent: merged. Verify passes. B5's local integration of all its PRs on main: parity --changed 102/102, plus lan_e2e (flakes listed in FEATURES.md LATER 4l).
This commit is contained in:
Ludovic Marie
2026-10-22 04:03:02 +02:00
committed by GitHub
+19
View File
@@ -1434,6 +1434,13 @@ impl LootContext<'_> {
.count() as u32;
}
}
// SetPotionFunction (the barter's fire resistance potions).
"minecraft:set_potion" => {
if let Some(id) = f["id"].as_str() {
*stack = std::mem::replace(stack, ItemStack::new("minecraft:air", 0))
.with_potion(id);
}
}
"minecraft:limit_count" => {
let limit = &f["limit"];
if let Some(min) = limit["min"].as_i64() {
@@ -1631,6 +1638,18 @@ mod tests {
);
}
#[test]
fn set_potion_gives_the_potion_its_contents() {
let items = Items::for_tests(HashMap::new());
let props = BTreeMap::new();
let table = json!({"pools":[{"rolls":1,"entries":[{"type":"minecraft:item","name":"minecraft:splash_potion",
"modifier":{"type":"minecraft:set_potion","id":"minecraft:fire_resistance"}}]}]});
let drops = ctx(&items, None, &props, "").evaluate(&table, &mut LegacyRandom::new(1));
assert_eq!(drops.len(), 1);
assert_eq!(&*drops[0].item, "minecraft:splash_potion");
assert_eq!(drops[0].potion(), Some("minecraft:fire_resistance"));
}
#[test]
fn always_edible_and_consume_effects_loaded() {
let root = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))