2024-12-05 23:05:24|Myriagame |source:minecraft skins
This tutorial is set by the author to use the CC by-NC protocol.
Foreword
After looking for a day, I didn't find a reliable method of locking the player whether the player was equipped with a designated jewelry. In the end, he could only solve the problem by yourself.如果想写kubeJS非常推荐安装KubeJS Offline Documentation,这个mod可以用指令导出一个离线文档,包含了所有的MC及其mod的java类信息,注意是java的类信息,而且只导出部分名称信息,包括类Names, constant names, method names and parameter names, etc., without class attributes (can be seen on several attribute names on some constructed methods), no specific implementation of the class and methods and no comments, and the search function is slightly apparent.Disabled, but only the name guessing method is enough to write JS.If you are really curious, prepare a MOD environment, Decode a jar package to see the specific implementation.
If the parameters of the event recovery of an event recovery include the parameters of the parameters, you do not understand, and the official wiki of Kubejs is not explained, it is recommended to use consle.info (event)/) Or Player.tell (EVENT) print what the Event is Java class, and then go to the offline document to check the constructive method of the constructor, you can understand which parameters of Event are composed of.
For example, EEVENT printed by ENTITYEVENTS.HURT (event => {}) The recovery showed that this type of dev.latvian.mods.kubejs.entity.entityHurteventjs can be searched in the offline document that its structure method is as follows. TityHurteventjs (Livingntity Entity, DamageSourceSource, Float amount), which means that Event consists of three parameters: entity, source of damage, and damage value.
Because my computer is not too lazy to install, only IDEA, so I use a notebook to write JS. Of course, I still recommend Probejs. If you have a VS environment.
text
The MC version and MOD version number used in the following examples are,
Mc1.19.2
Forge 43.4.4
Kubejs-FORGE-1902.6.2-build.73.jar
Curios-FORGE-1.19.2-5.1.6.3.jar
Spore_1.19.2_2.1.1.jar
Provide a way to quickly search for a jewelry, CurioShelper.Findfirmcurio (Entity, Item ID), the return value is java.util.Optional
The following is an example of a fungal infection: the anti -toxic mask of the spores (FUNGAL Infection: SPORE), and the jewelry bar HEAD tags are added, and an example of the effect of immunobius infection in the jewelry bar.
const Curioshelper = java.loadClass ("Top.Theillusivec4.curios.api.curiosapi"). Getcurioshelper ()// Entity is equipped with jewelry with jewelry ID
// Return Boolean
Function ISEQUIPEDCURIO (Entity, Curioid) {
Return CurioShelper.fINDFIRSTCURIO (Entity, Curioid.
}
ServerEvents.tags ("item", event => {
Event.add ("Curios: Head", "SPORE: Gas_mask")
})
ENTITYEVENTS.HURT (Event => {{
Let {Entity, Source, amount} = EVENT
// Return when not for players
If (! Entity.class.tostring (). Contains ("serverplayer") {) {
Return
}
// Cancel the damage judgment when wearing a mask for acetic infection
Ifquippedcurio (Entity, "SPORE: GAS_MASK")) {{
If (source.tostring (). Contains ("Mycelium.overtake") {{) {{) {{
Event.cancel ()
}
}
})
Playrevents.Tick (event => {{
Let Player = Event.player
// When wearing a mask and acetic infection effect, remove the mycelium infection
ISEQUIPDCURIO (Player, "SPORE: GAS_MASK") {{) {
If (Player.haseffect ("Spore: Mycelium_ef") {{) {{
Player.removeeffect ("Spore: Mycelium_ef")
}
}
})
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