9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-21 07:49:29 +00:00
Files
SakuraMC/patches/server/0048-Allow-disabling-random-dispenser-item-selection.patch
2024-11-21 22:10:57 +00:00

28 lines
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samsuik <40902469+Samsuik@users.noreply.github.com>
Date: Fri, 8 Dec 2023 18:12:20 +0000
Subject: [PATCH] Allow disabling random dispenser item selection
diff --git a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
index c7f1937b0f171eee967388ab4699703dcdcfbd2b..77d2c11d5a01a1f209336c62ac5153b5efadbfd3 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
@@ -74,8 +74,15 @@ public class DispenserBlockEntity extends RandomizableContainerBlockEntity {
int j = 1;
for (int k = 0; k < this.items.size(); ++k) {
- if (!((ItemStack) this.items.get(k)).isEmpty() && random.nextInt(j++) == 0) {
+ // Sakura start - allow disabling dispenser random item selection
+ if (this.level.sakuraConfig().technical.dispenserRandomItemSelection || this instanceof DropperBlockEntity) {
+ if (!((ItemStack) this.items.get(k)).isEmpty() && random.nextInt(j++) == 0) {
+ i = k;
+ }
+ } else if (!this.items.get(k).isEmpty()) {
i = k;
+ break;
+ // Sakura end
}
}