your current location:首页 > news>Use Kubejs to quickly switch the sights [TACZ] Eternal Fleeing Workshop: Timeless and Classics Zero) Minecraft Game

Use Kubejs to quickly switch the sights [TACZ] Eternal Fleeing Workshop: Timeless and Classics Zero) Minecraft Game

2024-12-10 17:58:11|Myriagame |source:minecraft skins

This tutorial is set by the author to use the CC By-NC-SA protocol.

As shown in the figure, a few sights are added with the ARIP accessories package. They have installed multiple sights on the same mirror seat. At present, TACZ cannot quickly switch the sights.Lost meaning in the battle.

Therefore, I used Kubejs to register a button, just press it to quickly switch multiple sights on the same mirror seat.

The registration button method is the same as the Kubejs registration button, here only the content in the server_scripts

 networkVEVENTS.DataReceived ('Global.toggle_sight.ConsuMeClick', (event) => {{

Const {player} = EVENT

Const {mainhanditem} = player

Const {nbt} = Mainhanditem

Const scope_list = [[

[

'Arip: Sight_eotech_hhs5_ogl_FTC_NOZOOM',

'Arip: Sight_eotech_hhs5_ogl_ftc',

'Arip: Sight_eotech_HHS5_OGL_FTC_AIMINLASER'

],,,

['Arip: Sight_eotech_hhs8_nozoom', 'Arip: Sight_eotech_hhs8'],

[

'Arip: Sight_vortex_razorhdg3_6t36x56_but_venom_rd',

'Arip: Sight_vortex_razorhdg3_6T36X56'

]

]

If (nbt! = Undefined && nbt.contains ('gunid')) {let scope_id = string (nbt.attachmentScope? .Tagmentid)

Scope_list.Foreach ((scope) => {{

If (scope.indexof (scope_id)! = -1) {

Let i = scope.indexof (scope_id)

Nbt.attachmentscope.tag.attachmentid =

Scope [(i+1)%scope.length]

}

})

}

})

TACZ's guns have NBT. By reading NBT, you can get a sight ID; you can modify the sight by modifying the NBT.