your current location:首页 > news>1.20.1 Different items Lootjs Minecraft Game is dropped through LOOTJS

1.20.1 Different items Lootjs Minecraft Game is dropped through LOOTJS

2024-12-10 17:57:24|Myriagame |source:minecraft skins

This tutorial is set by the author's setting without permission.

Use LOOTJS to drop different drops of different games on creatures.

Code example:

<<<<<<<<<], that (">"> ">"> "> connection (paras) => {{

Const differentyloot = {

Hard: ["Minecraft: EMERALD", 0.1],

Easy: [[

["Minecraft: Diamond", 0.2],

["Minecraft: Diamond_block", 0.3],

],,,

};

Object.entries (dispicultyloot). Foreach

Const modifier = event

.AdDentityLootmodifier ("Minecraft: Pig")

.Playerpredicate (

(Player) => Player.getLevel (). GetDiffical () == Difficulty

);

If (Array.isarray (LOOT [0])) {{

LOOT.Foreach ([Item, CHANCE]) => {

Modifier.randomChance (CHANCE) .addloot (item);

});

} Else {

Modifier.randomChance (LOOT [1]). Addloot (loot [0]);

}

});

});

In the difficulty mode, the drop of pigs will drop the emerald. In the simple mode, the drop of the pig will drop diamonds and diamonds.Essence

Add ["item ID", probability], if it is 0, it must be dropped by not dropping 100.