mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-21 16:09:19 +00:00
* Region based comment helper functions * (Region based comment) Dont save entity * (Region based comment) Pufferfish DAB * (Region based comment) Cache EntityType * (Region based comment) Cache EntityType * (Region based comment) Pufferfish EntityTTL * (Region based comment) Faster sequence * (Region based comment) FastRNG * (Region based comment) 0042 * (Region based comment) 0721 * (Region based comment) 0009 * (Region based comment) V1rtUal tHReaD * (Region based comment) ZSSM * [ci skip] (Region based comment) 0079 * [ci skip] (Region based comment) 0089 0090 * [ci skip] (Region based comment) 0049 0118 0138 * [ci skip] (Region based comment) 0006 0017 0018 0080 0081 * [ci skip] (Region based comment) 0019 0038 0059 0108 0117 0127 * ALL PATCHES ARE DONE * [ci skip] NZDD
57 lines
2.9 KiB
Diff
57 lines
2.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: MrPowerGamerBR <git@mrpowergamerbr.com>
|
|
Date: Fri, 23 Aug 2024 16:20:45 -0300
|
|
Subject: [PATCH] SparklyPaper: Allow throttling hopper checks if the target
|
|
container is full
|
|
|
|
Original project: https://github.com/SparklyPower/SparklyPaper
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
|
index 67425f4270c0745fc962c6ffb90e98bb4362d261..989e0f049805a734d6aa18434dd2a3b2d6c2ace1 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
|
@@ -441,6 +441,11 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
Direction enumdirection = blockEntity.facing.getOpposite();
|
|
|
|
if (HopperBlockEntity.isFullContainer(iinventory, enumdirection)) {
|
|
+ // Leaf start - Throttle hopper when full
|
|
+ if (org.dreeam.leaf.config.modules.opt.ThrottleHopperWhenFull.enabled && org.dreeam.leaf.config.modules.opt.ThrottleHopperWhenFull.skipTicks > 0) {
|
|
+ blockEntity.setCooldown(org.dreeam.leaf.config.modules.opt.ThrottleHopperWhenFull.skipTicks);
|
|
+ }
|
|
+ // Leaf end - Throttle hopper when full
|
|
return false;
|
|
} else {
|
|
// Paper start - Perf: Optimize Hoppers
|
|
diff --git a/src/main/java/org/dreeam/leaf/config/modules/opt/ThrottleHopperWhenFull.java b/src/main/java/org/dreeam/leaf/config/modules/opt/ThrottleHopperWhenFull.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..3facc08ed627a710a1cf26c67abfbfa1b380fe44
|
|
--- /dev/null
|
|
+++ b/src/main/java/org/dreeam/leaf/config/modules/opt/ThrottleHopperWhenFull.java
|
|
@@ -0,0 +1,26 @@
|
|
+package org.dreeam.leaf.config.modules.opt;
|
|
+
|
|
+import org.dreeam.leaf.config.ConfigModules;
|
|
+import org.dreeam.leaf.config.EnumConfigCategory;
|
|
+
|
|
+public class ThrottleHopperWhenFull extends ConfigModules {
|
|
+
|
|
+ public String getBasePath() {
|
|
+ return EnumConfigCategory.PERF.getBaseKeyName() + ".throttle-hopper-when-full";
|
|
+ }
|
|
+
|
|
+ public static boolean enabled = false;
|
|
+ public static int skipTicks = 0;
|
|
+
|
|
+ @Override
|
|
+ public void onLoaded() {
|
|
+ enabled = config.getBoolean(getBasePath() + ".enabled", enabled, config.pickStringRegionBased("""
|
|
+ Throttles the hopper if target container is full.""",
|
|
+ """
|
|
+ 是否在目标容器已满时阻塞漏斗."""));
|
|
+ skipTicks = config.getInt(getBasePath() + ".skip-ticks", skipTicks, config.pickStringRegionBased("""
|
|
+ How many ticks to throttle when the Hopper is throttled.""",
|
|
+ """
|
|
+ 每次阻塞多少 tick."""));
|
|
+ }
|
|
+}
|