From 74c2d06f188e5c210b4b1e696f3a0885580ab816 Mon Sep 17 00:00:00 2001 From: chipsams <77809761+chipsams@users.noreply.github.com> Date: Fri, 22 Nov 2024 15:05:29 +0000 Subject: [PATCH] exclude devices from bulk recycling it can exclude based on the tag "ptdye:recycle_excluded" and categorically refuses to recycle items with nbt, so that blocks with items inside like drawers cannot have their contents annihilated. --- kubejs/server_scripts/base/features/bulkrecycle-command.js | 2 +- kubejs/server_scripts/base/features/devices.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/kubejs/server_scripts/base/features/bulkrecycle-command.js b/kubejs/server_scripts/base/features/bulkrecycle-command.js index d0622ed9..21cfc06f 100644 --- a/kubejs/server_scripts/base/features/bulkrecycle-command.js +++ b/kubejs/server_scripts/base/features/bulkrecycle-command.js @@ -10,7 +10,7 @@ function compactItems(player,keepOne){ player.inventory.allItems.toArray().forEach( /** @param {Internal.ItemStack} i */ i=>{ - if(i.hasTag("forge:devices")){ + if(i.hasTag("forge:devices") && !i.hasTag("ptdye:recycle_excluded") && !i.hasNBT()){ let [_,type,fraction] = i.getTags() .toList() .filter((tag) => tag.location().path.startsWith("devices/"))[0] diff --git a/kubejs/server_scripts/base/features/devices.js b/kubejs/server_scripts/base/features/devices.js index 8d99e08a..c8d4add9 100644 --- a/kubejs/server_scripts/base/features/devices.js +++ b/kubejs/server_scripts/base/features/devices.js @@ -486,6 +486,7 @@ if (true) { deviceDefinitions.forEach((device) => { if(!device.enable) return; + addToTag("forge:generics/devices", device.generic); addToTag(`forge:generics/${device.tag.split(":")[1]}`, device.generic); let generic_id = Item.of(device.generic).id; //support both ids and kjs items @@ -542,6 +543,7 @@ if (true) { true ); //let players transmute any device but don't show in craftables panel + if(device.recycleExcluded) addToTag("ptdye:recycle_excluded") addToTag(device.tag + tagSuffix, item.id); addStonecutting(included_device, device.generic); });