2024-12-10 17:45:48|Myriagame |source:minecraft skins
This tutorial is set by the author to use the CC By-NC-SA protocol.
First of all, I would like to thank the big guys for providing the overall ideas:
KJS6#Advanced instance #Curios instance and Ambiguous ambiguity method processing- [KJS] Kubejs -MC Encyclopedia | The largest MINECRAFT Chinese Mod Encyclopedia (MCMOD.CN)
Newcomer learner, gangster lightly spray.
As shown in the title, this is a small tutorial on how to detect the jewelry on Kubejs6, and it also provides some simple ideas for LoadClass.
The version is 1.19.2 forge, the schematic diagram is as follows:
The overall code is as follows:
Itemevents.RightClicked ('Minecraft: Stick', E => {{Let {player} = e;
Player.tell (`` player $ {player.getName (). GetString ()} Right -click the wooden stick `);
Let Curiosapi = Java.loadClass ('Top.Theillusivec4.curios.api.curiosapi');
Let Curioshelper = Curiosapi.getcurioshelper ();
Let Curiosall = Curioshelper.Getequdcurios (Player) .Resolve (). GET ();
For (let i = 0; i
Let curiositem = Curiosall.getstackinslot (i);
If (! Curiositem.isempty ()) {
If (Curiositem.getItem () == 'Vampiric_glove') {{
Player.tell ('The detection of your blood -sucking gloves!!')
}
Player.tell (`` slot $ {i} items: $ {curiositem.getdisplayName (). GetString ()} `))
}}
});
Before starting:
If you can, install Probejs as much as possible (unless you are really confident in yourself)
Use Probejs's/Probejs Dump command to automatically complete the content of the required content when loadclass :)
Here I use the right button of the wooden stick (Itemevents.richtClicked). The specific needs can be added by yourself;
.getString () will output localized information and formatting styles. If there is no this item, it is only player.getName (), then the output is an ItextComponent object, which is reflected in the text.
Let Curiosapi = java.loadClass ('Top.theillusivec4.curios.api.curiosapi');
To introduce the API of Curios, the method of using LoadClass is introduced to introduce
Let Curioshelper = Curiosapi.Getcurioshelper ();Let Curiosall = Curioshelper.Getequdcurios (Player) .Resolve (). Get ();
The first behavior obtains the helping instrument of Curios, which provides the access and operating functions of the Curios of the player jewelry bar.
*How do I know that I want to introduce a helper first?
: Sorry, I can't help you, "What do you want to do".In fact, I also checked a lot of documents and asked AI to know this function.If you encounter something you want to learn, it is also recommended to go to GitHub or wiki to check related information, which is also the most difficult step.
The second behavior uses the helper's acquisition equipment function. The object is player. Use .Resolve (). Get () to analyze and return the values that may be obtained.
You can see wiki here, but the tutorial version is 1.20.x
for (let i = 0; iLet curiositem = Curiosall.getstackinslot (i);
If (! Curiositem.isempty ()) {
If (Curiositem.getItem () == 'Vampiric_glove') {{
Player.tell ('The detection of your blood -sucking gloves!!')
}
Player.tell (`` slot $ {i} items: $ {curiositem.getdisplayName (). GetString ()}}}}}
}
Now that we have got all the "equipment", it will be traveled to detect.
The getslots () method returns an integer value to indicate the total number of grooves available in the jewelry bar, but we traverse the Curiosall. Curiosall represents the total number of jewelry equipped by players, that is,:
Curiosall.getslots () returns the number of accessories for my total equipment.
Next is Curiosall.getStackinslot (i). He will return an object to indicate whether there is something to specify the position of the index I. If the following if (! Curiositem.IsEMPTY)), further testing is performed.
If (CuriOSITEM.Getitem () == 'Vampiric_glove') is judged. Curiositem is every index in our traversal. Use GetItem () to obtain its item object (of course, it is not so difficult to operate, and you can also use it.The following Curiositem.getdisplayName (). GetString () Get the name, or Curiositem.getid ()/Curiositem.GetidLocation () to get ID tags).Tick detection, continuously gives BUFF, etc.
It sounds ... it doesn't seem to be so difficult, right ...
But in fact, you will find that suffering will be heavy ...
Attachment: Different GETs and the feasibility of iron magic
National Service DNF Dark Ni
2025-01-28 09:19:27The new screenshot of the be
2025-01-28 09:18:57The 15th anniversary wallpap
2025-01-28 09:18:273DM Xuanyuan Sinicization Gr
2025-01-28 09:17:57French magazine is the first
2025-01-28 09:17:27The sneak game "Republic" wi
2025-01-28 09:16:57The story between humans and
2025-01-28 09:16:27Capture "Trinity 3: Artifact
2025-01-28 09:15:27Wind direction change "Myste
2025-01-28 09:14:57DICE's new project "Dream" w
2025-01-28 09:14:27Pirate Minecraft Skins
Minecraft Skins
2024-12-10 04:11:27Pirate Minecraft Skins
Minecraft Skins
2024-12-10 04:11:26Master Minecraft Skins
Minecraft Skins
2024-12-10 04:11:25King Minecraft Skins
Minecraft Skins
2024-12-10 04:11:25Guide Minecraft Skins
Minecraft Skins
2024-12-10 04:11:24Dark Knight Minecraft Skins
Minecraft Skins
2024-12-10 04:11:23Sparta Minecraft Skins
Minecraft Skins
2024-12-10 04:11:23Moncraft Skins of the War
Minecraft Skins
2024-12-10 04:11:22Red Witch Minecraft Skins
Minecraft Skins
2024-12-10 04:11:22Golden Cavaliers Minecraft S
Minecraft Skins
2024-12-10 04:11:22