From 19eb07ff072f2d7f9c3ffcc1fb8567fb1d9f7953 Mon Sep 17 00:00:00 2001 From: Yarden Zamir <dev@yarden-zamir.com> Date: Mon, 16 Dec 2024 09:23:59 +0200 Subject: [PATCH] fix: Milk automation advancement not triggering --- kubejs/server_scripts/base/features/milk.js | 7 +++++++ .../base/features/milkAdvancementTrigger.js | 8 -------- 2 files changed, 7 insertions(+), 8 deletions(-) delete mode 100644 kubejs/server_scripts/base/features/milkAdvancementTrigger.js diff --git a/kubejs/server_scripts/base/features/milk.js b/kubejs/server_scripts/base/features/milk.js index 71d82a0c..5b803786 100644 --- a/kubejs/server_scripts/base/features/milk.js +++ b/kubejs/server_scripts/base/features/milk.js @@ -1,3 +1,5 @@ +// Priority: 1 + // addPurify('white_concrete_powder', 'milk', 15) addPurify('white_concrete_powder', 'ptdye:flowing_milk', 15) ServerEvents.tags("fluid", (event) => {event.add("ptdye:flowing_milk", ["minecraft:flowing_milk"]);}); @@ -40,6 +42,11 @@ function milk(event, currentTime) { } ItemEvents.entityInteracted("minecraft:bucket", (event) => { if (!event.getTarget().getType() == "minecraft:cow") return + if (event.getTarget().getType() == "minecraft:cow") { // advancement trigger + if (event.player.persistentData.isEmpty()){ //this makes sure it's a deployer + Utils.server.runCommandSilent(`advancement grant ${event.player.name.string} only ptd:milk`) + } + } let currentTime = event.getTarget().level.getTime(); event.player.swing(); if (!event.getTarget().persistentData.get("lastMilked")) { diff --git a/kubejs/server_scripts/base/features/milkAdvancementTrigger.js b/kubejs/server_scripts/base/features/milkAdvancementTrigger.js deleted file mode 100644 index 3b43fd86..00000000 --- a/kubejs/server_scripts/base/features/milkAdvancementTrigger.js +++ /dev/null @@ -1,8 +0,0 @@ -// Priority: 1 -ItemEvents.entityInteracted("minecraft:bucket", (event) => { - if (event.getTarget().getType() == "minecraft:cow") { - if (event.player.persistentData.isEmpty()){ //this makes sure it's a deployer - Utils.server.runCommandSilent(`advancement grant ${event.player.name.string} only ptd:milk`) - } - } -});