Skip to content

Commit

Permalink
Try fixing folia off region POI accessing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Lora4967 committed Jun 10, 2024
1 parent 4c6f3c3 commit b22fc1f
Show file tree
Hide file tree
Showing 42 changed files with 58 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <novau233@163.com>
Date: Mon, 10 Jun 2024 13:07:46 +0000
Subject: [PATCH] Try fixing folia off region POI accessing issue


diff --git a/src/main/java/me/earthme/luminol/config/modules/fixes/FoliaPOIAccessOffRegionFixConfig.java b/src/main/java/me/earthme/luminol/config/modules/fixes/FoliaPOIAccessOffRegionFixConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..343c85ded7e7abc22fac0aaeb7be786e9bd7b39a
--- /dev/null
+++ b/src/main/java/me/earthme/luminol/config/modules/fixes/FoliaPOIAccessOffRegionFixConfig.java
@@ -0,0 +1,20 @@
+package me.earthme.luminol.config.modules.fixes;
+
+import me.earthme.luminol.config.ConfigInfo;
+import me.earthme.luminol.config.EnumConfigCategory;
+import me.earthme.luminol.config.IConfigModule;
+
+public class FoliaPOIAccessOffRegionFixConfig implements IConfigModule {
+ @ConfigInfo(baseName = "enabled")
+ public static boolean enabled = false;
+
+ @Override
+ public EnumConfigCategory getCategory() {
+ return EnumConfigCategory.FIXES;
+ }
+
+ @Override
+ public String getBaseName() {
+ return "folia.fix_poi_access_off_region";
+ }
+}
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
index 79e9e5ece5859938ca0c86ead4c25cf5bde9da27..63256feea83be1b180b1183cec94bab29b030c62 100644
--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
@@ -82,7 +82,7 @@ public class PoiManager extends SectionStorage<PoiSection> {

public Stream<PoiRecord> getInSquare(Predicate<Holder<PoiType>> typePredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus) {
int i = Math.floorDiv(radius, 16) + 1;
- return ChunkPos.rangeClosed(new ChunkPos(pos), i).flatMap(chunkPos -> this.getInChunk(typePredicate, chunkPos, occupationStatus)).filter(poi -> {
+ return ChunkPos.rangeClosed(new ChunkPos(pos), i).filter(cpos -> me.earthme.luminol.config.modules.fixes.FoliaPOIAccessOffRegionFixConfig.enabled ? io.papermc.paper.util.TickThread.isTickThreadFor(this.world,cpos) : true).flatMap(chunkPos -> this.getInChunk(typePredicate, chunkPos, occupationStatus)).filter(poi -> { //Luminol - Fix off region POI access
BlockPos blockPos2 = poi.getPos();
return Math.abs(blockPos2.getX() - pos.getX()) <= radius && Math.abs(blockPos2.getZ() - pos.getZ()) <= radius;
});
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ index 46df26bef2f1d4b0bd5a1313e8ee4f86c2fdf355..0086a1a4611b983eefd0cb7bf8e9cff6
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
this.chatVisibility = ChatVisiblity.FULL;
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 954809d8997750959541e6462668f17efd0b0f70..4fc9a47745b817d9ee2da4776cab26ff9f3b0025 100644
index e7b510dee355a9865bd67f5aea52c62957226eb3..e0f12426f18b343b27089440cd01127d79600ef0 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -675,7 +675,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
Expand All @@ -72,7 +72,7 @@ index 954809d8997750959541e6462668f17efd0b0f70..4fc9a47745b817d9ee2da4776cab26ff
// If the event is cancelled we move the player back to their old location.
if (event.isCancelled()) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 36f0175228f4ab80ebc67082e7c9bbbc2c14e147..ad15df5dfe34e20a6b5dafaf01e8a7306b158109 100644
index cbf5bda50b87b8520ee6fa6d0b41c94b5c9f3583..ac4533f69e9bb22c7375ad8bc83ddc23399a56d7 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3986,6 +3986,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Kaiiju Vanilla end portal teleportation


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 8749e1d7109b751ec69e771b43014c085c0802cd..b676200cb54afa7aebe23eee4e7aef7c9a6e0712 100644
index ac4533f69e9bb22c7375ad8bc83ddc23399a56d7..2ff3216c3789fc4779bb18502cb288f57e370ea0 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4193,12 +4193,17 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..dd45cf1fde5ee4cf8347064f106c64b8
+ }
+}
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 54297b9dde40fe853d873d60373cd8c0a3c9466b..7369d608c26e46e9d3a881ac14efe1d0f075b1cb 100644
index 3228d15fc21fec08e8683f96c829935a1de6cf45..7433a29577ecb36e847bd610059c0c83702d01f6 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -926,10 +926,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Pufferfish Cache climbing check for activation


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index b676200cb54afa7aebe23eee4e7aef7c9a6e0712..2fb2df4922a1b5b3acf732e68d8db7bb15ecc789 100644
index 2ff3216c3789fc4779bb18502cb288f57e370ea0..a19773b8721fb4011a48738977a162358b4dbcb5 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -309,7 +309,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Pufferfish Reduce entity fluid lookups if no fluids


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 2fb2df4922a1b5b3acf732e68d8db7bb15ecc789..9b4a9025f9b30834a07a83cc02e7ee7f665dcbd9 100644
index a19773b8721fb4011a48738977a162358b4dbcb5..ada744f8e594dbec516e2a66beaf6140e98d7510 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -5260,16 +5260,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..15697d69659b6e1e776acf5094684b5f
+ }
+}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 9b4a9025f9b30834a07a83cc02e7ee7f665dcbd9..835a6e73a340375e30e4822df45a1c99d36ac009 100644
index ada744f8e594dbec516e2a66beaf6140e98d7510..5c36b3c6bf38acfa3f38dcca4b666aca9665e7d4 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -812,6 +812,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..acc032f727e605e79b688efb4873ff47
+ }
+}
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 7f6b810f175e21dbbc85d17fefbba2a7c638144d..a892ff1b3bc11df5f46269c5ae8838c4a7f91ea9 100644
index 397c8ef1c83f0bf3c03d31ee19dbf1533dba9e48..abbbd6b56af8a177cd8ebfc5aa34c3f7282bdc59 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -230,11 +230,13 @@ public abstract class Mob extends LivingEntity implements Targeting {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..ed62d25d6cd6dfcf8c5db20ced36eb3d
+ }
+}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index c7c0f6e399e472792ecad75fc402a64785fae818..31f80438e82da6de1cd1ec35a2f77c45f0127722 100644
index 5b76c645214852f172c2a498751438090cc970ec..62f997aae20fe392bc271b23b632441ce989c69c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -5458,6 +5458,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Subject: [PATCH] Gale Don't trigger lootable refresh for non-player


diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
index a5cd70b6ada2b44f64db0985483ee5eadc67003f..e49be65c2d379027c2821c0db7f151bc3cd20a4b 100644
index fa64bf5ad13c278438039b663ea3134e72108411..cb3318c124337868f763b0e060f90e7eb3ba466d 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
@@ -68,6 +68,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Gale Skip entity move if movement is zero


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 6948342ef9fa4af0e13707e85cd788c815e34544..29cbafa048f61f7eb7d35dd103faff8c2b4a77f5 100644
index 485ca9a13a04ee47b27f1d23c6323583139865a1..2072664329f68552f43db55dee283ba96951ac09 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -317,6 +317,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Gale Replace AI attributes with optimized collections


diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
index 683c9693754d1a87b7e8fccc757a0d0963351f60..d904cc2d882f62f74ff34f7e8266947798563ed4 100644
index 8d6954d05d2bf6d6c1c4953db3127b011a858cec..0ddb031bfe8df351f1cf97d258f81558e4719dbf 100644
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
@@ -1,8 +1,6 @@
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Fix-MC-2025


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 29cbafa048f61f7eb7d35dd103faff8c2b4a77f5..0893b62e72fe03a14e7617f28676f53f77e7624c 100644
index 2072664329f68552f43db55dee283ba96951ac09..82ffe6571b06a482296fb28e37aa148daf6a0ce6 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2549,6 +2549,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
Expand Down
File renamed without changes.

0 comments on commit b22fc1f

Please sign in to comment.