Files
PlazmaBukkitMC/patches/server/0031-Allow-throttling-hopper-checks-if-the-target-contain.patch
AlphaKR93 33701c1eca more work
2024-11-02 16:39:08 +09:00

39 lines
2.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Fri, 25 Oct 2024 19:13:21 +0900
Subject: [PATCH] Allow throttling hopper checks if the target container is
full
Based on SparklyPaper, Copyright (C) 2024 SparklyPower.
commit: c023b928439b9c71277f27cc9b5bd36ca32624ea
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 5ebbdb94d9b91c442ff60eb6872f740ebd790fa0..aeeb8af68ea43ae6c93952610918d77b1593ed54 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,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
Direction enumdirection = blockEntity.facing.getOpposite();
if (HopperBlockEntity.isFullContainer(iinventory, enumdirection)) {
+ if (world.plazmaConfig().block.hopper.fullCooldown != 0) blockEntity.setCooldown(world.plazmaConfig().block.hopper.fullCooldown); // Plazma - Allow throttling hopper checks if the target container is full
return false;
} else {
// Paper start - Perf: Optimize Hoppers
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index 6c9c28ae5fbe62ba647e7790acccb377d1e62490..0618db9893eda1fac0da6b771cc4d456b247d237 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -64,6 +64,12 @@ public class WorldConfigurations extends ConfigurationPart {
public Block block;
public class Block extends ConfigurationPart {
+ public Hopper hopper;
+ public class Hopper extends ConfigurationPart {
+
+ public int fullCooldown = 0;
+
+ }
}