Skip to content

Commit

Permalink
fix: milking betsy with more than one empty bucket in hand voids the …
Browse files Browse the repository at this point in the history
…extra buckets. Now will reduce by 1 instead
  • Loading branch information
Yarden-zamir committed Nov 24, 2024
1 parent 3e5cf11 commit ce095dc
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions kubejs/server_scripts/base/features/milk.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,15 @@ function milk(event, currentTime) {
event.getTarget().persistentData.put("lastMilked", currentTime)
let pitch = Math.random() + 0.8;
Utils.server.runCommandSilent(`playsound minecraft:entity.cow.milk neutral @a ${event.getTarget().getX()} ${event.getTarget().getY()} ${event.getTarget().getZ()} 1 ${pitch}`)
event.server.scheduleInTicks(1, () => {
event.player.setMainHandItem("minecraft:milk_bucket");
});
if (event.player.getMainHandItem().count == 1)
event.server.scheduleInTicks(1, () => {
event.player.setMainHandItem("minecraft:milk_bucket");
});
else{
event.player.setMainHandItem(event.player.getMainHandItem().withCount(event.player.getMainHandItem().count - 1))
event.player.give(Item.of("minecraft:milk_bucket").withCount(1))
}

}
ItemEvents.entityInteracted("minecraft:bucket", (event) => {
if (!event.getTarget().getType() == "minecraft:cow") return
Expand Down

0 comments on commit ce095dc

Please sign in to comment.