LTDV10Test/packet/kubejs/client_scripts/render/render_item_energy_bar.js
3944Realms 67a395b765
Some checks failed
Deploy to Remote Server / deploy (push) Failing after 1m11s
初始化
2026-04-14 18:20:56 +08:00

25 lines
997 B
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//依然参考忆然(?)
let tetra_item = ['tetra:modular_sword', 'tetra:modular_double', 'tetra:modular_bow', 'tetra:modular_shield', 'tetra:modular_crossbow', 'tetra:modular_single']
RenderJSEvents.RegisterItemDecorations(e => {
tetra_item.forEach(id => {
e.register(id, 'energy', c => {
if(!c.itemStack.nbt) return
let dx = 0, dy = -2
     RenderJSRenderSystem.setShaderColorJS(1,1,1,1)
RenderJSRenderSystem.disableDepthTestJS()
let MaxEnergy = c.itemStack.nbt.getInt('maxEnergy')
if (MaxEnergy > 0) {
let Energy = c.itemStack.nbt.getInt('energy')
c.pushPose()
c.translate(c.xOffset + 2, c.yOffset + 13, 200)
c.fill(dx, dy, dx + 13, dy + 2, 0, 0, 0, 255)
c.translate(0,0,1)
c.fill(dx, dy, dx + Energy / MaxEnergy * 13, dy + 1, 240, 63, 60, 255)
c.popPose()
}
})
})
})