const TNT_IDENTIFIER = "pa:private3"; const FLASH...
Создано: 24 февраля 2025 г.
Создано: 24 февраля 2025 г.
const TNT_IDENTIFIER = "pa:private3";
const FLASH_INTERVAL = 200; // Flash interval in milliseconds
const EXPLOSION_DELAY = 5000; // 5 seconds in milliseconds (same as minecraft:timer.time)
// Store active TNT entities and their timers
const activeTNTs = new Map();
// Function to handle TNT entity setup
function setupTNTEntity(entity) {
const entityId = entity.uniqueId;
text// Set initial variant value to 0 (matches minecraft:variant in JSON) entity.setNbt({ Variant: 0 }); // Add type family tags entity.addTag("tnt"); entity.addTag("inanimate"); // Setup collision box (matches minecraft:collision_box in JSON) entity.setNbt({ width: 0.98, height: 0.98 }); // Setup physics and pushable properties entity.setNbt({ pushable: false, allowPushingByPiston: true }); // Setup flash animation timer let isWhite = false; const flashTimer = setInterval(() => { if (entity.isValid()) { isWhite = !isWhite; // Update variant value to match component groups entity.setNbt({ Variant: isWhite ? 1 : 0 }); } else { clearInterval(flashTimer); } }, FLASH_INTERVAL); // Setup explosion timer (matches minecraft:timer in JSON) const explosionTimer = setTimeout(() => { if (entity.isValid()) { const pos = entity.pos; mc.runcmd(`function black`); entity.destroy(); } // Clean up timers clearInterval(flashTimer); activeTNTs.delete(entityId); }, EXPLOSION_DELAY); // Store timers for cleanup activeTNTs.set(entityId, { flashTimer, explosionTimer });
}
// Listen for TNT entity spawns
mc.listen("onMobSpawned", (entity) => {
if (entity.type === TNT_IDENTIFIER) {
setupTNTEntity(entity);
}
});
// Clean up when entities are removed
mc.listen("onMobDie", (entity) => {
if (entity.type === TNT_IDENTIFIER) {
const timers = activeTNTs.get(entity.uniqueId);
if (timers) {
clearInterval(timers.flashTimer);
clearTimeout(timers.explosionTimer);
activeTNTs.delete(entity.uniqueId);
}
}
});
// Handle TNT ignition with flint and steel
mc.listen("onUseItemOn", (player, item, block) => {
if (block.type === TNT_IDENTIFIER && item.type === "minecraft:flint_and_steel") {
const pos = block.pos;
text// Remove the TNT block mc.setBlock(pos.x, pos.y, pos.z,pos.dimid, "minecraft:air", 0); // Play fuse sound mc.runcmd(`playsound random.fuse @a ${pos.x} ${pos.y} ${pos.z} 1 1 0`); mc.runcmd(`summon bb:tnt ${pos.x} ${pos.y} ${pos.z}`); mc.runcmd(`function black`); // Spawn the TNT entity mc.spawnMob(TNT_IDENTIFIER, pos); }
});
log("CompressedTNT plugin loaded!"); сделай новый ккод чтобы когда тнт оыбчный заспавнился то если он падает или стоит на земле главное чтобы на земле был то ломается обсидиан крестиком только 1 раз и все это как усиленый тнт должен быть сделай полный готовый код мне нее надо гооврить о коде сразу код мне дай КОД ДАЙ LiteLoaderBDS
js/// <reference path="../HelperLib.js"/> // Если нужно, поправьте путь к HelperLib или уберите если не используете ll.registerPlugin( "BuffedTNT", "Усиленный обычный TNT, ломает обсидиан крестом", [1, 0, 0], {} ); function breakObsidianCross(x, y, z, dimid) { // Список смещений для "крестика": центр + четыре стороны const offsets = [ { x: 0, y: 0, z: 0 }, { x: 1, y: 0, z: 0 }, { x: -1, y: 0, z: 0 }, { x: 0, y: 0, z: 1 }, { x: 0, y: 0, z: -1 } ]; for (const off of offsets) { const bx = x + off.x; const by = y + off.y; const bz = z + off.z; const block = mc.getBlock(bx, by, bz, dimid); if (block && block.type === "minecraft:obsidian") { mc.setBlock(bx, by, bz, dimid, "minecraft:air", 0); } } } // Слушаем событие взрыва mc.listen("onExplode", (data) => { const source = data.source; // Сущность, вызвавшая взрыв if (!source) return; // Проверяем, что взорвался именно обычный TNT if (source.type === "minecraft:tnt") { const { x, y, z, dimid } = source.pos; // Ломаем обсидиан крестом (только 1 раз для этого TNT) breakObsidianCross(x, y, z, dimid); } }); log("BuffedTNT plugin loaded!");