mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-30 12:19:08 +00:00
Allow disabling random dispenser item selection
This commit is contained in:
@@ -621,10 +621,10 @@ index 0000000000000000000000000000000000000000..5fc23a0b579d7cbe03baf5324bef887a
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5bee36934f9510abcd365b3856dc5b3e69fdfe27
|
||||
index 0000000000000000000000000000000000000000..ae06ef765e8e2aeabd2ba3b5af6d2506761bdabf
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java
|
||||
@@ -0,0 +1,162 @@
|
||||
@@ -0,0 +1,163 @@
|
||||
+package me.samsuik.sakura.configuration;
|
||||
+
|
||||
+import com.mojang.logging.LogUtils;
|
||||
@@ -734,6 +734,7 @@ index 0000000000000000000000000000000000000000..5bee36934f9510abcd365b3856dc5b3e
|
||||
+ public class Technical extends ConfigurationPart {
|
||||
+ @NestedSetting({"redstone", "redstone-cache"})
|
||||
+ public boolean redstoneCache = false;
|
||||
+ public boolean dispenserRandomItemSelection = true;
|
||||
+ }
|
||||
+
|
||||
+ public Players players;
|
||||
|
||||
@@ -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 881379681c39230a00b3a1f11cd87498984396c7..73e6fbf818944e73885db9c528114b0ea684de47 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
|
||||
@@ -73,8 +73,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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user