Kubejs6 sets the effect of the Curio event [KJS] Kubejs Minecraft Game

Forewords, because I turned it over in Kubejs 6 and found the time that could define the effect of Curio. It was so hot that it was a bit red. With the help of group friends, I solved some problems, and after that, I found it on MC Encyclopedia.Related methods, so help everyone to write a tutorial.

Earlier states that because I am not a software -related professional background, and I do n’t know much about the code, I can only say that I can write this way. Among them, many places refer to the solutions given in the ChatGPT. I hope that there are big guys to help the code to help the code of the codeContinue optimization.

In this article, refer to the tutorial of two MC encyclopedia UU:

[1.18.2] How to make special bonuses with physical damage events?(ALTNOIR gangsters provide this article for how to judge players, entities, and damage types)

The basic tips of the decoration effect and the decoration effect Kubejs: The skills of reading NBT data by using the. NBT suffix (the wooden boss provides the judgment of Curio)

The specific code is as follows, and many of them are modified with ChatGPT, but it can indeed identify the judgment itself and output the corresponding effect.(I only do a small part of the interpretation here) (specific demonstration pictures)

 EntityEvents.Hurt ((EVENT) => {

// Judgment the source of the attack is a player, and the injured entity is alive

If (if (if (if

Event.source.actual &&

Event.entity.isliving () &&

Event.source.actual.isplayer ()

) {{

// Check whether Damage Type is scgus.bullet

Let damageType = Typeof event.source.type === 'Function'? Event.source.type (): event.source.type;

Let msgid = typeof damageType.msgid === 'function'? DamageType.msgid (): damageType.msgid;

If (msgid! == 'scguns.bullet') Return;

// Check whether the player has netherite_quiver

Let PlayernBt = EVENT.SOURCE.ACTual.nbt ["ForgetCaps"] && Event.source.Actual.nbt ["ForgetCaps"] [Curios: Inventory "] &&&SOURCE.Actua l.NBT ["Forgetcaps"] ["] ["Curios: Inventory "] [" Curios "]; if (! Playernbt) {

Return;

}

Let PlayernBTRING = PLAYERNBTRING ();

If (PlayernBTRINGRINGEXOF ("Nyfsquiver: Netherite_quiver") === -1) {

Return;

}

// If the player is equipped with netherite_quiver, output the physical health

Let health = math.floor (event.entity.gethealth ());

// Send the information to the world chat window

Let Playername = Event.source.Actual.GetName ();

Let entityName = event.entity.getName ();

Event.server.runcommandsilent (`/say $ {playername} Attacked $ {EntityName}. Entity Health is now $ {Health}.

}

});