Lock core to 16 blocks

This commit is contained in:
7cc5c4f330d47060 2025-02-10 17:25:48 -05:00
parent 0cc7f84da1
commit b06bc97aa7
Signed by: 7cc5c4f330d47060
SSH key fingerprint: SHA256:e+4tcZut1nBpe10PqjaO+Rvie0Q7W4qIvFzcUw+7riA

View file

@ -2,9 +2,13 @@ import uuidToInt from '../util/uuidtoint.js'
import plainParser from '../util/chatparse_plain.js'
import mcParser from '../util/chatparse_mc.js'
const cs = {
x: 4,
y: 6,
z: 4
x: 16,
y: 1,
z: 16
}
const r16 = number => {
return Math.floor(number/16)*16
}
export default function load (b) {
@ -15,9 +19,8 @@ export default function load (b) {
b.ccStarted = false
b.blocknoY = 0
b.pos = { x: 0, y: 0, z: 0 }
b.refillCoreCmd = `/fill ~ 55 ~ ~${cs.x - 1} ${54 + cs.y} ~${cs.z - 1} command_block{CustomName:'{"translate":"%s %s","with":[{"translate":"entity.minecraft.ender_dragon"},{"translate":"language.region"}],"color":"#FFAAEE"}'}`
const refillPayload = `command_block{CustomName:'{"translate":"%s %s","with":[{"translate":"entity.minecraft.ender_dragon"},{"translate":"language.name"}],"color":"#FFAAEE"}'}`
b.advanceccq = function () {
if (b.host.options.useChat) return
if (b.ccq[0] && b.ccq[0].length !== 0) {
@ -68,7 +71,9 @@ export default function load (b) {
})
if (!b.host.options.useChat) {
b.add_sc_task('cc', () => {
b.chat(b.refillCoreCmd)
const xstart = r16(b.pos.x);
const zstart = r16(b.pos.z);
b.chat(`/fill ${xstart} 55 ${zstart} ${xstart + cs.x - 1} 55 ${zstart + cs.z - 1} ${refillPayload}`)
}, true)
b.add_sc_task('cc_size', () => {
b.chat('/gamerule commandModificationBlockLimit 32768')
@ -91,23 +96,23 @@ export default function load (b) {
b.sc_tasks.cc_size.failed = 1
}
})
b._client.on('position', function (a) {
b._client.on('position', function (data) {
if (!b.ccStarted) {
b.original_pos = { x: a.x, y: a.y, z: a.z }
b.pos = { x: a.x, y: a.y, z: a.z }
b.original_pos = { x: r16(data.x), y: data.y, z: r16(data.z) }
b.pos = { x: data.x, y: data.y, z: data.z }
} else {
b.pos = { x: a.x, y: a.y, z: a.z }
if (a.x !== b.original_pos.x || a.z !== b.original_pos.z) {
b.original_pos = { x: a.x, y: a.y, z: a.z }
b.pos = { x: data.x, y: data.y, z: data.z }
if (r16(data.x) !== b.original_pos.x || r16(data.z) !== b.original_pos.z) {
b.original_pos = { x: r16(data.x), y: data.y, z: r16(data.z) }
b.sc_tasks.cc.failed = 1
}
}
b.commandPos = {
x: Math.floor(a.x),
z: Math.floor(a.z),
x: r16(data.x),
z: r16(data.z),
y: 55
}
b._client.write('teleport_confirm', { teleportId: a.teleportId })
b._client.write('teleport_confirm', { teleportId: data.teleportId })
})
b.tellraw = (uuid, message) => {