This commit is contained in:
parent
49a8ef908a
commit
c4878e6d42
6
.prettierrc.json5
Normal file
6
.prettierrc.json5
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
// Formatter configuration for the KubeJS scripts.
|
||||||
|
{
|
||||||
|
tabWidth: 4,
|
||||||
|
trailingComma: "always",
|
||||||
|
}
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
- fixed some tags and recipes
|
- fixed some tags and recipes
|
||||||
- removed ae2 spatial anchor (broken on fabric)
|
- removed ae2 spatial anchor (broken on fabric)
|
||||||
|
- added `/rtp` command
|
||||||
|
|
37
overrides/kubejs/server_scripts/99-rtp.js
Normal file
37
overrides/kubejs/server_scripts/99-rtp.js
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
const diameter = 1000000;
|
||||||
|
const y = 200;
|
||||||
|
|
||||||
|
function getRandomCoord() {
|
||||||
|
var n = Math.floor(Math.random() * diameter);
|
||||||
|
if (Math.round(Math.random())) {
|
||||||
|
n *= -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onRtpExecute(ctx) {
|
||||||
|
const player = ctx.source.getPlayerOrException().asKJS();
|
||||||
|
const x = getRandomCoord();
|
||||||
|
const z = getRandomCoord();
|
||||||
|
|
||||||
|
// add slow falling so the player doesn't immediately die
|
||||||
|
player.potionEffects.add(
|
||||||
|
"minecraft:slow_falling",
|
||||||
|
15 * 20, // 15 seconds
|
||||||
|
);
|
||||||
|
|
||||||
|
// teleport
|
||||||
|
player.setPositionAndRotation(x, y, z, 0, 0);
|
||||||
|
|
||||||
|
// 1 = success
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function commandRegistry(ev) {
|
||||||
|
const { commands: Commands } = ev;
|
||||||
|
|
||||||
|
ev.register(Commands.literal("rtp").executes(onRtpExecute));
|
||||||
|
}
|
||||||
|
|
||||||
|
onEvent("command.registry", commandRegistry);
|
Loading…
Reference in a new issue