mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-23 00:39:20 +00:00
Begin backporting to 1.18.2
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
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 f74c5bb8e1ba42c77c59d481b871fd992483b128..4c77d0333808324640dfb77246baecf204188579 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
|
||||
@@ -75,8 +75,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() && DispenserBlockEntity.RANDOM.nextInt(j++) == 0) {
|
||||
+ // Sakura start - allow disabling dispenser random item selection
|
||||
+ if (this.level.sakuraConfig.dispenserRandomItemSelection || this instanceof DropperBlockEntity) {
|
||||
+ if (!((ItemStack) this.items.get(k)).isEmpty() && DispenserBlockEntity.RANDOM.nextInt(j++) == 0) {
|
||||
+ i = k;
|
||||
+ }
|
||||
+ } else if (!this.items.get(k).isEmpty()) {
|
||||
i = k;
|
||||
+ break;
|
||||
+ // Sakura end
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user