your current location:首页 > news>Malithful Kubejs Magic Reform API Leitlan-MineCraft Game

Malithful Kubejs Magic Reform API Leitlan-MineCraft Game

2024-12-09 18:31:56|Myriagame |source:minecraft skins

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

brief

You need the most basic Kubejs knowledge to use these functions.

This code should be placed in Kubejs/Server_scripts, and you can use the corresponding function according to the prompts in JSDOC.

API function

There are seven functions, which can determine whether the monster has the corresponding entry/obtain the level of the corresponding entry/set the entry of the monster/get the level of the monster/set the level on the basis of not repeating the entries/In the case of entry, the upgrade level will give the monster random entry/obtain all the entries and levels of the monster according to the modified level.

 const $ hostilentity = java.loadclass ("dev.xkmc.l2hostility.content.capability.mobtraitcap");

/**

*@Typedef {"l2hostility: adaptive"

*| "L2hostility: arena"

*| "L2hostility: Blindness"

*| "L2hostility: Corross" "

*| "L2hostility: Countr_Strike"

*| "L2hostility: cursed"

*| "L2hostility: DEMENTOR"

*| "L2hostility: Dispell"

*| "L2hostility: draw"

*| "L2hostility: EROSION"

*| "L2HostIlity: FIERY"

*| "L2hostility: Freezing"

*| "L2hostility: Gravity"

*| "L2hostility: Grenade"

*| "L2hostility: Growth"

*| "L2hostility: Invisible"

*| "L2hostility: Killer_aura"

*| "L2hostility: Levitch"

*| "L2hostility: Master"

*| "L2hostility: Moonwalk"

*| "L2hostility: NAUSEA"

*| "L2hostility: poison"

*| "L2hostility: Protection"

*| "L2hostility: Pulling"

*| "L2hostility: Ragnarok"

*| "L2hostility: Reflect"

*| "L2hostility: Regnerate"

*| "L2hostility: Repelling"*| "L2Hostility: REPRINT"

*| "L2hostility: Shulker"

*| "L2hostility: Slowness"

*| "L2hostility: soul_burner"

*| "L2hostility: Speedy"

*| "L2hostility: Split"

*| "L2hostility: tank"

*| "L2hostility: Teleport"

*| "L2hostility: Undying"

*| "L2hostility: Weakness"

*| "L2hostility: Wither"} Trait

*/

/**

*@Descripting check if the mobile.

*@Param {Entity} Entity-The Mobile you want to check.

*@Param {Trart} Trait-The Trait You Want to Check.

*@ReturnS {Boolean} -Thether the mob has the tract.

*/

Function Hastrait (Entity, Trait) {

Let hastrait = false;

Entity.getCapability ($ hostilentity.capability) .ifrendsnt (mobtraitcap => {{

Console.log ("Capability Present");

Let traits = mobtraitcap.traits;

Console.log ("traits:", traits);

For (let entry of traits.entrySet ()) {{) {

Let key = entry.getKey (). Getid (); if (key.equals (tract)) {

Hastrait = true;

Break;

}

}

});

Return hastrait;

}

/**

*@Descripting get the level of the specify tract of the mob.

*@Param {Entity} Entity-The Mobile you want to get the track.

*@Param {Trart} Trait-The Trait You Want to get.

*@Return {number}-The level of the tract.

*/

Function Gettraital (Entity, Trait) {

Let tractLevel = -1;

Entity.getCapability ($ hostilentity.capability) .ifrendsnt (mobtraitcap => {{

Console.log ("Capability Present");

Let traits = mobtraitcap.traits;

Console.log ("traits:", traits);

For (let entry of traits.entrySet ()) {Let Key = ENTRY.Getkey (). Getid ();

If (key.equals (tract)) {

Traity = Entry.getValue ();

Break;

}

}

});

Return Trartlevel;

}

/**

*@Descripting set the track of the mob.

*@Param {Entity} Entity-The Mobile you want to set the track.

*@Param {Trart} Trait-The Trait You Want to Set.

*@Param {number} lv-the level of the tract.

*/

function settrait (Entity, Trait, LV) {

Entity.getCapability ($ hostilentity.capability) .ifrendsnt (mobtraitcap => {{

Mobtraitcap.Settrait (Trart, LV);

Entity.server.ScheduleInticks (1, () => {

Mobtraitcap.Synctoclient (Entity);

Entity.health+= Entity.Getattributevalue ("Minecraft: GENERIC.MAX_HEALTH");});

});

}

/**

*Get the level of the mob.

*@Param {Entity} Entity-The Mobile you want to get the level.

*@ReturnS {NUMBER}-The level of the mob.

*/

Function GetDifficultLevel (Entity) {{Entity) {

Let LV = 0;

Entity.getCapability ($ hostilentity.capability) .ifrendsnt (mobtraitcap => {{

Lv = mobtraitcap.getlevel ();

});

Return LV;

}

/**

*@Descripting set the level of the mob withthout REROLLING The Traits.

*@Param {Entity} Entity-The Mobile you want to set the level.

*@Param {number} lv-the level you want to set.

*/

Function Setlevelwithoutreroll (Entity, LV) {{

Entity.getCapability ($ hostilentity.capability) .ifrendsnt (mobtraitcap => {{

Mobtraitcap.setLevel (Entity, LV);

Entity.server.ScheduleInticks (1, () => {

MobtraitCap.Synctoclient (Entity); Entity.Health+= ENTITY.GetATTRIBUTEVALUE ("MineCraft: Generic.max_health")

});

});

}

/**

*Set the level of the mob and raoll the traits.

*@Param {Entity} Entity-The Mobile you want to set the level.

*@Param {number} lv-the level you want to set.

*@Param {Boolean} Boolean-WHETHER the MOB Will Reroll the Traits with Max CHANCE.

*/

Function Setlevelwitheroll (Entity, Lv, Boolean) {{

Entity.getCapability ($ hostilentity.capability) .ifrendsnt (mobtraitcap => {{

Mobtraitcap.reinit (Entity, LV, Boolean);

Entity.server.ScheduleInticks (1, () => {

Mobtraitcap.Synctoclient (Entity);

Entity.health+= Entity.Getattributevalue ("Minecraft: GENERIC.MAX_HEALTH");

});

});

}

/**

*@Descripting get all the traits of the mob.

*@Param {Entity} Entity-The Mob You WANT OT GET The Traits.*@Returns {Array}

*/

Function GetAllTraits (Entity) {

Let traitsList = [];

Entity.getCapability ($ hostilentity.capability) .ifrendsnt (mobtraitcap => {{

Let traits = mobtraitcap.traits;

Let entries = traits.entryset ();

For (let entry of entries) {

TraitsList.push ({{{

Trart: Entry.getkey (). Getid (), Getid (),

Level: Entry.getValue ()

});

}

});

Return TraitsList;

}