1.8 KiB
1.8 KiB
potion_rain.js — q() (satır 160)
var expected = cfg.timed ? cfg.rate * totalTicks : cfg.count;
var grid = buildCells(cfg, safe, expected);
var center = findCenter(p, cfg.mode);
var world = p.getWorld();
var server = c.getServer();
var visual = k.type !== "vanilla";
var staticMorph = (k.type === "image" && cfg.spin) || k.type === "skin" || k.type === "custom" ||
(k.type === "morph" && !k.flip && !(k.tilt && cfg.spin));
var morphCache = staticMorph ? morphFor(k, cfg) : null;
var gunCache = (visual && staticMorph && k.type === "image") ? gunNbt(k, cfg, morphCache, name) : null;
var sent = 0;
var tick = 0;
var failed = 0;
// Bitince kilit COOLDOWN_MS'e iner; loop olurse en gec failsafe sonra acilir
mappet.set(G_STOP + name, 0);
mappet.set(G_BUSY + name, t + totalTicks * 150 + 60000);
function dropOne(w, shooter, cx, cy, cz) {
var off = nextOffset(grid, safe);
var x = cx + off[0];
var z = cz + off[1];
var y = Math.floor(cy) + cfg.height + Math.random() * 2;
if (y > MAX_Y) y = MAX_Y - Math.random() * 2;
if (y < MIN_Y) y = MIN_Y;
if (!visual) {
return w.spawnEntity(k.entity, x, y, z, mappet.createCompound(vanillaNbt(k, cfg, name)));
}
var nbt = gunCache || gunNbt(k, cfg, morphCache || morphFor(k, cfg), name);
return w.shootBBGunProjectile(shooter, x, y, z, 0, 90, nbt);
}
function wave(ctx) {
var stop = Number(mappet.get(G_STOP + name)) === 1;
var w = world, cx = center.x, cy = center.y, cz = center.z;
var shooter = p;
var pp = null;