LTDV10/packet/kubejs/client_scripts/network.js
2026-04-14 18:20:56 +08:00

30 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const $FluidFX = Java.loadClass("com.simibubi.create.content.fluids.FluidFX")
const $HoloGui = Java.loadClass("se.mickelus.tetra.items.modular.impl.holo.gui.HoloGui")
NetworkEvents.dataReceived("kubejs_player_playsound", e => {
e.player.playSound(e.data.get("soundEvent").getAsString())
})
NetworkEvents.dataReceived("spawn_create_particle", e => {
const {fluid, x, y, z, vx, vy, vz, count, speed} = e.data
let particle = $FluidFX.getFluidParticle(Fluid.of(fluid).fluidStack)
e.player.level.spawnParticles(particle, true, x, y, z, vx, vy, vz, count, speed)
})
NetworkEvents.dataReceived("openholo", e => {
let gui = $HoloGui.getInstance()
Client.setScreen(gui)
gui.onShow()
})
// 发送玩家是否按下了Alt键用于 批量套壳 server_scripts/Custom/encase.js
let playerAltDown = false
let playerAltDown1 = false
PlayerEvents.tick(event => {
playerAltDown = Client.isAltDown()
if (playerAltDown1 != playerAltDown) {
event.player.sendData("isPlayerAltDown", { "Alt": playerAltDown })
playerAltDown1 = playerAltDown
}
})