your current location:首页 > news>loot js mineCraft

loot js mineCraft

2024-12-12 09:23:52|Myriagame |source:minecraft skins

Overview

This is a FORGE/Neoforge module, which requires the front Kubejs.

The module uses the Global Loot System and Kubejs of FORGE/Neoforge to add specific conditions to modification based on specific conditions.

The author will not transplant it to 1.17 or 1.16.5.

Install

Download the latest versions from CurseForge (or github).

Download the latest version of Kubejs.

Install Forge/Neoforge.

Put the two modules in the Mods folder.

Example

The modification of the loot should be processed on the server, so the script should be placed in the Kubejs/Server_Scripts folder and create a. JS file.

This is a simple example of adding gunpowder warriper to Creeper: Creeper:

 OneVent ("LOOTJS", (Event) => {Event .adDentityLootmodifier ("Minecraft: Creeper") .RANDOMCHANCE (0.3) // 30 %Probability. THENADD ("Minecraft: GunPowder");}); 

In addition to specifying the loot table, you can also modify all the entities:

 Onevent ("Lootjs", (Event) => {Event .addlootTypeModifier (LOOTTYPE.ENTITY) can be applied to multiple types. Logname ("it's Raining Loot ") //You can customize the name displayed in the log .Weathercheck ({raining: true,}) .Thenmodify (Ingredient.getall () => {Return itemstack.withcou nt (Itemstack.getCount ()*2);});}); 

And you can also detect whether to hold a designated item:

 OneVent ("LOOTJS", (Event) => {Event .addblockLootmodifier ("#FORGE: ORS") // Note that this is a block tag instead of item tag .matcheq. UIP (Equipmentslot.Mainhand, item.of ("minecraft: netherite_pickaxe"). IGNORENBT ()) .TheNadd ("Minecraft: Gravel"); // Test the master and the auxiliary example as follows: // matchmainhand (item. of ("Minecraft: Netherite_pickaxe")") .ignorenbt ())) // matchoffhand (item.of ("minecraft: netherite_pickaxe"). Ignorenbt ())}); 
High version (1.19+))

Because the high version Kubejs has changed a lot, the 1.16 JavaScript code part is no longer common

Official examples from GitHub Wiki, add gunpowder to the gravel as a random drop:

 LOOTJS.MODIFIERS ((EVENT) => {Event .addBlockLootmodifier ("Minecraft: Gravel") add Modifier .RANDOMC Hance (0.3) // probability is 30%.addloot("Minecraft: GunPowder");}); // The drop content is gunpowder 

You can still be afraid of adding gunpowder as a drop:

 LOOTJS.MODIFIERS ((EVENT) => {Event .adDentityLootmodifier ("MineCraft: Creeper") for the bitterness. .Addloot ("Minecraft: GunPowder");); // The drop content is gunpowder 
. You can also add a list of war products:

 LOOTJS.MODIFIERS ((Event) => {// by ID adds EVENT.AddloottableModifier ("Minecraft: Entities/C. Reeper ") // Use the hardships of hardships and fearList .RANDOMCHANCE (0.3) // probability of 30%.addloot ("Minecraft: GunPowder"); // Add Event .addloottablemodifier (/.* Creeper.*//) // Regular expression, the content is still bitter and scared .randomChaance (0.3)

// The probability is 30%.addloot ("Minecraft: GunPowder");}); //

For more functions and information about the module, check Wiki or examples.

Disable of loot tables

Some squares such as leaves are randomly destroyed.You can disable their loot tables.

 Onevent ("lootjs", (event) => {// Disable all leaves event.disableLootmodification (/.*: blocks /.*_ leaves/);.disableLootmodification ("Minecraft: Entities/Bat");}); 

Modify and enable log records for looting

When a large number of modifications are performed, it is difficult to track which modifications are triggered under specific conditions.After enabling EnableLogging, Lootjs will record the modified logs to the logs/kubejs/server.txt.