9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2026-01-04 15:41:40 +00:00
Files
Leaf/patches/server/0050-Reduce-items-finding-hopper-nearby-check.patch
2024-05-26 21:06:49 +08:00

43 lines
2.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Mon, 15 Jan 2024 10:53:10 -0500
Subject: [PATCH] Reduce items finding hopper nearby check
This patch add a toggle for items checking MinecraftHopper nearby,
But still recommend to turn-off `checkForMinecartNearItemWhileActive`
Since `Reduce-hopper-item-checks.patch` will cause lag under massive dropped items
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index 00eb84726a6563ef1d7b29977566086df1bab090..056f3c234fc853a46f804d9d21f51eed47321e3f 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -238,7 +238,9 @@ public class ItemEntity extends Entity implements TraceableEntity {
this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
return; // Gale - EMC - reduce hopper item checks
}
- this.markNearbyHopperCartsAsImmune(); // Gale - EMC - reduce hopper item checks
+ if (level().galeConfig().smallOptimizations.reducedIntervals.checkNearbyItem.hopper.minecart.temporaryImmunity.checkForMinecartNearItemWhileActive) { // Leaf - Reduce items finding hopper nearby check
+ this.markNearbyHopperCartsAsImmune(); // Gale - EMC - reduce hopper item checks
+ }
}
}
diff --git a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
index 356ec77bf63da9a218036c92bde9bf5fa006c1ac..0ac00c3c6aa6c5418b21a68e91520224d13a7b00 100644
--- a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
+++ b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
@@ -76,10 +76,11 @@ public class GaleWorldConfiguration extends ConfigurationPart {
public TemporaryImmunity temporaryImmunity;
public class TemporaryImmunity extends ConfigurationPart {
+ public boolean checkForMinecartNearItemWhileActive = false; // Leaf - Make it configurable and reorder code
+ public boolean checkForMinecartNearItemWhileInactive = true;
public int duration = 100;
public int nearbyItemMaxAge = 1200;
public int checkForMinecartNearItemInterval = 20;
- public boolean checkForMinecartNearItemWhileInactive = true;
public double maxItemHorizontalDistance = 24.0;
public double maxItemVerticalDistance = 4.0;
}