mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-23 08:59:23 +00:00
All patches done
This commit is contained in:
@@ -3,6 +3,8 @@ From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
|
||||
Date: Fri, 14 Jun 2024 17:34:17 -0400
|
||||
Subject: [PATCH] Fix-MC-183518
|
||||
|
||||
Removed since Leaf 1.21.3, Mojang fixed in 1.21.2 24w33a
|
||||
|
||||
Related MC issue: https://bugs.mojang.com/browse/MC-183518
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -476,7 +476,7 @@ index 414e30430eb7bcb935ef2cc038fcb7c27747bdd4..4129d894d6604f3b2495a35ad2d026c4
|
||||
@Override
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/bot/BotStatsCounter.java b/src/main/java/org/leavesmc/leaves/bot/BotStatsCounter.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..1dfbda8b2439e3f21fea953292aa0e3e853b22e0
|
||||
index 0000000000000000000000000000000000000000..5bd34353b6ea86cd15ff48b8d6570167f35d75f0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/bot/BotStatsCounter.java
|
||||
@@ -0,0 +1,38 @@
|
||||
@@ -518,10 +518,9 @@ index 0000000000000000000000000000000000000000..1dfbda8b2439e3f21fea953292aa0e3e
|
||||
+ return 0;
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/entity/CraftPhotographer.java b/src/main/java/org/leavesmc/leaves/entity/CraftPhotographer.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..23c2f699f3ae12d1a36efc7860e869facea9c175
|
||||
index 0000000000000000000000000000000000000000..fed2005cb711d0d15d5c87e5f0f7939c7a6a8ffa
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/entity/CraftPhotographer.java
|
||||
@@ -0,0 +1,73 @@
|
||||
@@ -598,7 +597,6 @@ index 0000000000000000000000000000000000000000..23c2f699f3ae12d1a36efc7860e869fa
|
||||
+ return "CraftPhotographer{" + "name=" + getName() + '}';
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/entity/CraftPhotographerManager.java b/src/main/java/org/leavesmc/leaves/entity/CraftPhotographerManager.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e87d1e72902207dbcea67e8300c7375aa9161269
|
||||
@@ -689,7 +687,7 @@ index 0000000000000000000000000000000000000000..e87d1e72902207dbcea67e8300c7375a
|
||||
+}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/replay/DigestOutputStream.java b/src/main/java/org/leavesmc/leaves/replay/DigestOutputStream.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ffb753377aea3a2c9fd653da8245d5e733fee0cf
|
||||
index 0000000000000000000000000000000000000000..e67ff063b7f50b4bfdaaaeb88f225eb768d89623
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/replay/DigestOutputStream.java
|
||||
@@ -0,0 +1,46 @@
|
||||
@@ -739,10 +737,9 @@ index 0000000000000000000000000000000000000000..ffb753377aea3a2c9fd653da8245d5e7
|
||||
+ out.write(b, off, len);
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/replay/RecordMetaData.java b/src/main/java/org/leavesmc/leaves/replay/RecordMetaData.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f6b9d5d47dd957d30f725c2daad596226e21af32
|
||||
index 0000000000000000000000000000000000000000..5a3ea3e1e8df362262e1beaac167d667bd10adfa
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/replay/RecordMetaData.java
|
||||
@@ -0,0 +1,23 @@
|
||||
@@ -769,7 +766,6 @@ index 0000000000000000000000000000000000000000..f6b9d5d47dd957d30f725c2daad59622
|
||||
+
|
||||
+ public Set<UUID> players = new HashSet<>();
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/replay/Recorder.java b/src/main/java/org/leavesmc/leaves/replay/Recorder.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..d1fb2f08f2d357c6551de7832eb3cf6980d44fb5
|
||||
@@ -1063,7 +1059,7 @@ index 0000000000000000000000000000000000000000..d1fb2f08f2d357c6551de7832eb3cf69
|
||||
+}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/replay/RecorderOption.java b/src/main/java/org/leavesmc/leaves/replay/RecorderOption.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7183f7fc3eb4fc12aa90b94661b652f476de396b
|
||||
index 0000000000000000000000000000000000000000..e1c32a60fa60054b351b0f4267d2e3e20c129e9b
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/replay/RecorderOption.java
|
||||
@@ -0,0 +1,57 @@
|
||||
@@ -1124,7 +1120,6 @@ index 0000000000000000000000000000000000000000..7183f7fc3eb4fc12aa90b94661b652f4
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/replay/ReplayFile.java b/src/main/java/org/leavesmc/leaves/replay/ReplayFile.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c6bb5431c3fe14935b0f0a871308830e476271d8
|
||||
@@ -1331,7 +1326,7 @@ index 0000000000000000000000000000000000000000..c6bb5431c3fe14935b0f0a871308830e
|
||||
+}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/replay/ReplayMarker.java b/src/main/java/org/leavesmc/leaves/replay/ReplayMarker.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..219b9ea88f8cebaf8aab73b123d3efd586cc3147
|
||||
index 0000000000000000000000000000000000000000..1568f6928d5d4f38ca1919c6de6ec9bb9deb20b2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/replay/ReplayMarker.java
|
||||
@@ -0,0 +1,43 @@
|
||||
@@ -1378,7 +1373,6 @@ index 0000000000000000000000000000000000000000..219b9ea88f8cebaf8aab73b123d3efd5
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/replay/ServerPhotographer.java b/src/main/java/org/leavesmc/leaves/replay/ServerPhotographer.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..d8f8f071c67cd0e29411d3f0f3b5e931abe86f65
|
||||
@@ -1609,7 +1603,7 @@ index 0000000000000000000000000000000000000000..d8f8f071c67cd0e29411d3f0f3b5e931
|
||||
+}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/replay/ServerPhotographerGameMode.java b/src/main/java/org/leavesmc/leaves/replay/ServerPhotographerGameMode.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..41adf5787bdab11806c76fd379275403c00466a9
|
||||
index 0000000000000000000000000000000000000000..c612215b0f1e8c3fae641e7a23c7cf7d165eca87
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/replay/ServerPhotographerGameMode.java
|
||||
@@ -0,0 +1,35 @@
|
||||
@@ -1648,10 +1642,9 @@ index 0000000000000000000000000000000000000000..41adf5787bdab11806c76fd379275403
|
||||
+ public void tick() {
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/util/UUIDSerializer.java b/src/main/java/org/leavesmc/leaves/util/UUIDSerializer.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..93f72a99595a0b1f182f3950de36f1282a171e84
|
||||
index 0000000000000000000000000000000000000000..b0834f4b569b3e28ec7e026b3ff4236219498011
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/util/UUIDSerializer.java
|
||||
@@ -0,0 +1,17 @@
|
||||
@@ -1672,4 +1665,3 @@ index 0000000000000000000000000000000000000000..93f72a99595a0b1f182f3950de36f128
|
||||
+ return new JsonPrimitive(src.toString());
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
|
||||
@@ -7,18 +7,10 @@ Replace `thenApply` with `thenCompose`. Once one task is completed then the next
|
||||
to prevent blocking threads while waiting to complete all tasks. But may cause the sequence of future compose disorder.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
|
||||
index 1360aa8202542d3d0f32247f1123575fc2c38ff1..b177428857e17a0fb9df0031d60e3027d5b996a1 100644
|
||||
index 1360aa8202542d3d0f32247f1123575fc2c38ff1..8701e64aa7287093f8cac3921e0189f94c62cae9 100644
|
||||
--- a/src/main/java/net/minecraft/Util.java
|
||||
+++ b/src/main/java/net/minecraft/Util.java
|
||||
@@ -40,6 +40,7 @@ import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
+import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Iterator;
|
||||
@@ -586,17 +587,44 @@ public class Util {
|
||||
@@ -586,17 +586,44 @@ public class Util {
|
||||
return enumMap;
|
||||
}
|
||||
|
||||
@@ -48,7 +40,7 @@ index 1360aa8202542d3d0f32247f1123575fc2c38ff1..b177428857e17a0fb9df0031d60e3027
|
||||
+ private static <V> CompletableFuture<List<V>> sequenceFaster(List<? extends CompletableFuture<V>> futures, CompletableFuture<Void> completableFuture) {
|
||||
+ return completableFuture.thenCompose(void_ ->
|
||||
+ CompletableFuture.supplyAsync(() -> {
|
||||
+ List<V> list = new ArrayList<>();
|
||||
+ List<V> list = new java.util.ArrayList<>();
|
||||
+
|
||||
+ for (CompletableFuture<V> future : futures) {
|
||||
+ list.add(future.join());
|
||||
|
||||
@@ -86,12 +86,12 @@ index 796322fc35da0b47654e60388ec93cae7b999766..84d95b8e718609d06f5a259f22599494
|
||||
|
||||
public Vec3 getPositionBase() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||
index bd5e034ce58ebe53d2121209d76ae60134ce72fe..739e178b4544964d24e242b088393093348cc15f 100644
|
||||
index bd5e034ce58ebe53d2121209d76ae60134ce72fe..063a58e7413092918a66dd57a6178f02c78f165a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||
@@ -434,6 +434,16 @@ public class ItemFrame extends HangingEntity {
|
||||
@@ -175,6 +175,16 @@ public class ItemFrame extends HangingEntity {
|
||||
this.setItem(ItemStack.fromBukkitCopy(event.getItemStack()), false);
|
||||
}
|
||||
this.setItem(ItemStack.fromBukkitCopy(event.getItemStack()));
|
||||
// Paper end - Add PlayerItemFrameChangeEvent
|
||||
+ // Paper start - add decoration and mark everything dirty for other players who are already tracking this frame
|
||||
+ final ItemStack item = this.getItem();
|
||||
@@ -103,11 +103,11 @@ index bd5e034ce58ebe53d2121209d76ae60134ce72fe..739e178b4544964d24e242b088393093
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.gameEvent(GameEvent.BLOCK_CHANGE, player);
|
||||
itemstack.consume(1, player);
|
||||
return InteractionResult.SUCCESS;
|
||||
this.dropItem(world, source.getEntity(), false);
|
||||
this.gameEvent(GameEvent.BLOCK_CHANGE, source.getEntity());
|
||||
this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||
index aabc0b5a3e50aad8c4f902fa41e6bed319599ff3..18ba99619fa5acc5b7148c2e8a4e9b086c6a072c 100644
|
||||
index aabc0b5a3e50aad8c4f902fa41e6bed319599ff3..8c26a86d4a79b64da790bf6fda1f76a11bc26569 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||
@@ -81,6 +81,16 @@ public class MapItemSavedData extends SavedData {
|
||||
@@ -140,7 +140,7 @@ index aabc0b5a3e50aad8c4f902fa41e6bed319599ff3..18ba99619fa5acc5b7148c2e8a4e9b08
|
||||
}
|
||||
|
||||
this.setDecorationsDirty();
|
||||
+ if (type.value().showOnItemFrame() || (mapicon1 != null && mapicon.type().value().showOnItemFrame())) this.dirtyFrameDecorations = true; // Paper
|
||||
+ if (mapicon.renderOnFrame()) this.dirtyFrameDecorations = true; // Paper
|
||||
}
|
||||
|
||||
}
|
||||
@@ -165,32 +165,28 @@ index aabc0b5a3e50aad8c4f902fa41e6bed319599ff3..18ba99619fa5acc5b7148c2e8a4e9b08
|
||||
Iterator iterator = this.carriedBy.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -561,7 +586,11 @@ public class MapItemSavedData extends SavedData {
|
||||
public void removedFromFrame(BlockPos pos, int id) {
|
||||
@@ -562,6 +587,7 @@ public class MapItemSavedData extends SavedData {
|
||||
this.removeDecoration(MapItemSavedData.getFrameKey(id));
|
||||
this.frameMarkers.remove(MapFrame.frameId(pos));
|
||||
+<<<<<<< HEAD
|
||||
this.setDirty();
|
||||
+=======
|
||||
+ this.dirtyFrameDecorations = true; // Paper
|
||||
+>>>>>>> PaperPR: Rewrite framed map tracker ticking
|
||||
}
|
||||
|
||||
public boolean updateColor(int x, int z, byte color) {
|
||||
@@ -623,6 +652,93 @@ public class MapItemSavedData extends SavedData {
|
||||
@@ -623,6 +649,93 @@ public class MapItemSavedData extends SavedData {
|
||||
return "frame-" + id;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public final @Nullable Packet<?> framedUpdatePacket(MapId mapid, @Nullable Player player) {
|
||||
+ return createUpdatePacket(mapid, player, false);
|
||||
+ public final @Nullable Packet<?> framedUpdatePacket(MapId id, @Nullable Player player) {
|
||||
+ return createUpdatePacket(id, player, false);
|
||||
+ }
|
||||
+
|
||||
+ public final @Nullable Packet<?> fullUpdatePacket(MapId mapid, @Nullable Player player) {
|
||||
+ return createUpdatePacket(mapid, player, true);
|
||||
+ public final @Nullable Packet<?> fullUpdatePacket(MapId id, @Nullable Player player) {
|
||||
+ return createUpdatePacket(id, player, true);
|
||||
+ }
|
||||
+
|
||||
+ public final @Nullable Packet<?> createUpdatePacket(MapId mapid, @Nullable Player player, boolean full) {
|
||||
+ public final @Nullable Packet<?> createUpdatePacket(MapId id, @Nullable Player player, boolean full) {
|
||||
+ if (!dirtyColorData && !dirtyFrameDecorations && (player == null || server.getCurrentTick() % 5 != 0) && !full) // Periodically send update packets if a renderer is added
|
||||
+ return null;
|
||||
+
|
||||
@@ -225,7 +221,7 @@ index aabc0b5a3e50aad8c4f902fa41e6bed319599ff3..18ba99619fa5acc5b7148c2e8a4e9b08
|
||||
+
|
||||
+ for (final org.bukkit.map.MapCursor cursor : render.cursors) {
|
||||
+ if (cursor.isVisible()) {
|
||||
+ decorations.add(new MapDecoration(CraftMapCursor.CraftType.bukkitToMinecraftHolder(cursor.getType()), cursor.getX(), cursor.getY(), cursor.getDirection(), CraftChatMessage.fromStringOrOptional(cursor.getCaption()))); // Paper - Adventure
|
||||
+ decorations.add(new MapDecoration(CraftMapCursor.CraftType.bukkitToMinecraftHolder(cursor.getType()), cursor.getX(), cursor.getY(), cursor.getDirection(), Optional.ofNullable(PaperAdventure.asVanilla(cursor.caption())))); // Paper - Adventure
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
@@ -53,7 +53,7 @@ index 252aef3ffe0fecd47ebea1ed7df48e14fa873eb9..5b4599927effca11293b367c5bac4541
|
||||
RandomSource fork();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 3665fa73fb0bd788335a8bbbdaa8f5aba0b45d8b..e7423f95187098ab99e05e16f6b76549a0b0a1b9 100644
|
||||
index 3665fa73fb0bd788335a8bbbdaa8f5aba0b45d8b..4543116afc9a86961377b9e2d20868c9e73c698d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -184,7 +184,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -61,7 +61,7 @@ index 3665fa73fb0bd788335a8bbbdaa8f5aba0b45d8b..e7423f95187098ab99e05e16f6b76549
|
||||
|
||||
// Paper start - Share random for entities to make them more random
|
||||
- public static RandomSource SHARED_RANDOM = new RandomRandomSource();
|
||||
+ public static RandomSource SHARED_RANDOM = org.dreeam.leaf.config.modules.opt.FastRNG.enabled ? org.dreeam.leaf.util.math.random.FasterRandomSource.SHARED_INSTANCE : new RandomRandomSource.RandomRandomSource(); // Leaf - Faster random generator
|
||||
+ public static RandomSource SHARED_RANDOM = org.dreeam.leaf.config.modules.opt.FastRNG.enabled ? org.dreeam.leaf.util.math.random.FasterRandomSource.SHARED_INSTANCE : new RandomRandomSource(); // Leaf - Faster random generator
|
||||
// Paper start - replace random
|
||||
private static final class RandomRandomSource extends ca.spottedleaf.moonrise.common.util.ThreadUnsafeRandom {
|
||||
public RandomRandomSource() {
|
||||
|
||||
@@ -67,7 +67,7 @@ index 38428ba2c522108f4f9f7986bc3535d1232ac1f8..02f143b41350660486de79e240259245
|
||||
return blockState;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java b/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java
|
||||
index 0e6dfe2635ea5f5e410049b05f94f5083b2f18a4..e19086b3a65d992cf6687222557a34a896e84385 100644
|
||||
index 0e6dfe2635ea5f5e410049b05f94f5083b2f18a4..75a378bea8fdb03b6864fad49bc38fee83523bd9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java
|
||||
@@ -9,13 +9,16 @@ public record MaterialRuleList(NoiseChunk.BlockStateFiller[] materialRuleList) i
|
||||
@@ -81,10 +81,10 @@ index 0e6dfe2635ea5f5e410049b05f94f5083b2f18a4..e19086b3a65d992cf6687222557a34a8
|
||||
- }
|
||||
+ // Leaf start - Avoid iterator allocation
|
||||
+ BlockState blockState = null;
|
||||
+ int s = this.materialRuleList.size();
|
||||
+ int length = this.materialRuleList.length;
|
||||
+
|
||||
+ for (int i = 0; blockState == null && i < s; i++) {
|
||||
+ NoiseChunk.BlockStateFiller blockStateFiller = this.materialRuleList.get(i);
|
||||
+ for (int i = 0; blockState == null && i < length; i++) {
|
||||
+ NoiseChunk.BlockStateFiller blockStateFiller = this.materialRuleList[i];
|
||||
+ blockState = blockStateFiller.calculate(pos);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Do not place player if the server is full
|
||||
Fix https://github.com/PaperMC/Paper/issues/10668
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 6da4b4d3f00527aabf398ab614140bc6f8c7442c..f3b98a4a66cec8d6c9dc46479d573c2fb453837a 100644
|
||||
index bed0b5ff2c84252bddcedcac30fe0a02252d01bf..2ccecc0a81c62d96978906aec2124563f3be7541 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -377,6 +377,13 @@ public abstract class PlayerList {
|
||||
@@ -378,6 +378,13 @@ public abstract class PlayerList {
|
||||
return;
|
||||
}
|
||||
// Gale end - MultiPaper - do not place player in world if kicked before being spawned in
|
||||
@@ -23,12 +23,12 @@ index 6da4b4d3f00527aabf398ab614140bc6f8c7442c..f3b98a4a66cec8d6c9dc46479d573c2f
|
||||
|
||||
Location loc = ev.getSpawnLocation();
|
||||
worldserver1 = ((CraftWorld) loc.getWorld()).getHandle();
|
||||
@@ -914,7 +921,7 @@ public abstract class PlayerList {
|
||||
@@ -878,7 +885,7 @@ public abstract class PlayerList {
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, io.papermc.paper.adventure.PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure
|
||||
} else {
|
||||
// return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile) ? IChatBaseComponent.translatable("multiplayer.disconnect.server_full") : null;
|
||||
- if (this.realPlayers.size() >= this.maxPlayers && !(player.hasPermission("purpur.joinfullserver") || this.canBypassPlayerLimit(gameprofile))) { // Purpur // Leaves - skip
|
||||
+ if (this.realPlayers.size() >= this.maxPlayers && !(player.hasPermission("purpur.joinfullserver") || this.canBypassPlayerLimit(gameprofile))) { // Purpur // Leaves - skip // Leaf - Do not place player if the server is full - diff on change
|
||||
- if (this.realPlayers.size() >= this.maxPlayers && !(player.hasPermission("purpur.joinfullserver") || this.canBypassPlayerLimit(gameprofile))) { // Purpur // Leaves - only real player
|
||||
+ if (this.realPlayers.size() >= this.maxPlayers && !(player.hasPermission("purpur.joinfullserver") || this.canBypassPlayerLimit(gameprofile))) { // Purpur // Leaves - only real player // Leaf - Do not place player if the server is full - diff on change
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_FULL, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.serverFullMessage)); // Spigot // Paper - Adventure
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Fix MC-65198
|
||||
Mojang issues: https://bugs.mojang.com/browse/MC-65198
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
|
||||
index b3bd9bbd96efc4784b86c2be6bb857da4db919b8..5b65fade746fee7208719b20164bf944d8e8d3a8 100644
|
||||
index ac9df238ef0f3d009f25976b95e0b750e963e952..b94daec80a5222468d6065cec4ac693a1de92b38 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
|
||||
@@ -141,6 +141,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
|
||||
@@ -129,6 +129,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
|
||||
ItemStack itemstack1 = slot1.getItem();
|
||||
|
||||
itemstack = itemstack1.copy();
|
||||
@@ -17,7 +17,7 @@ index b3bd9bbd96efc4784b86c2be6bb857da4db919b8..5b65fade746fee7208719b20164bf944
|
||||
int j = this.getInventorySlotStart();
|
||||
int k = this.getUseRowEnd();
|
||||
|
||||
@@ -179,7 +180,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
|
||||
@@ -165,7 +166,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
|
||||
}
|
||||
|
||||
this.activeQuickItem = itemstack; // Purpur - Anvil API
|
||||
@@ -27,10 +27,10 @@ index b3bd9bbd96efc4784b86c2be6bb857da4db919b8..5b65fade746fee7208719b20164bf944
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/ResultSlot.java b/src/main/java/net/minecraft/world/inventory/ResultSlot.java
|
||||
index 37a89bf79017eb65f82276b054a70ddb5eb5e549..05d0c97966f35a6e8576c975d33990f482d05e12 100644
|
||||
index ff30071f3ef37d1b28cf86e26ce4f7477335a07a..78122f7aaa095278095a57974b9906f7999a17df 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/ResultSlot.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/ResultSlot.java
|
||||
@@ -46,7 +46,7 @@ public class ResultSlot extends Slot {
|
||||
@@ -49,7 +49,7 @@ public class ResultSlot extends Slot {
|
||||
@Override
|
||||
protected void checkTakeAchievements(ItemStack stack) {
|
||||
if (this.removeCount > 0) {
|
||||
@@ -40,10 +40,10 @@ index 37a89bf79017eb65f82276b054a70ddb5eb5e549..05d0c97966f35a6e8576c975d33990f4
|
||||
|
||||
if (this.container instanceof RecipeCraftingHolder recipeCraftingHolder) {
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
|
||||
index 5a0015f761f6a25d7bb7b9cfe7a9b4771a6a37ec..bd056f001e5efc34ad5c8cedc9e891514cfe5853 100644
|
||||
index ca65965757e6f12abc972250a04817c7547bb0bd..675300ca10b2328be102a7cbc447e1c25ef12f82 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
|
||||
@@ -264,6 +264,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
|
||||
@@ -255,6 +255,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
|
||||
Item item = itemstack1.getItem();
|
||||
|
||||
itemstack = itemstack1.copy();
|
||||
@@ -51,12 +51,15 @@ index 5a0015f761f6a25d7bb7b9cfe7a9b4771a6a37ec..bd056f001e5efc34ad5c8cedc9e89151
|
||||
if (slot == 1) {
|
||||
item.onCraftedBy(itemstack1, player.level(), player);
|
||||
if (!this.moveItemStackTo(itemstack1, 2, 38, true)) {
|
||||
@@ -296,7 +297,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
|
||||
@@ -287,9 +288,9 @@ public class StonecutterMenu extends AbstractContainerMenu {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
- slot1.onTake(player, itemstack1);
|
||||
+ slot1.onTake(player, itemStack2); // Leaf - Fix MC-65198
|
||||
this.broadcastChanges();
|
||||
if (slot == 1) {
|
||||
- player.drop(itemstack1, false);
|
||||
+ player.drop(itemStack2, false); // Leaf - Fix MC-65198
|
||||
}
|
||||
|
||||
this.broadcastChanges();
|
||||
@@ -6,19 +6,19 @@ Subject: [PATCH] Fix-MC-200418
|
||||
Related MC issue: https://bugs.mojang.com/browse/MC-200418
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
index 7ac5f6fc44fd5f901c30fe93856ed6b04b86a265..f6545e1703d6a957a051915effa4084427ff06fe 100644
|
||||
index 160fcd1f8917d69dde01089111661337827da20a..0963ccca2f5f38a415bc733333976d9df67378a1 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
@@ -335,6 +335,12 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
|
||||
@@ -327,6 +327,12 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
|
||||
if (!this.isSilent()) {
|
||||
world.levelEvent((Player) null, 1027, this.blockPosition(), 0);
|
||||
}
|
||||
|
||||
+
|
||||
+ // Leaf start - Fix MC-200418
|
||||
+ if (entityvillager.isPassenger() && entityvillager.getVehicle() instanceof net.minecraft.world.entity.animal.Chicken && entityvillager.isBaby()) {
|
||||
+ entityvillager.removeVehicle();
|
||||
+ }
|
||||
+ // Leaf end
|
||||
+
|
||||
}
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
}, EntityTransformEvent.TransformReason.CURED, CreatureSpawnEvent.SpawnReason.CURED);
|
||||
if (converted == null) {
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Fix-MC-119417
|
||||
Related MC issue: https://bugs.mojang.com/browse/MC-119417
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 79df52237b7a5822e0cbaff015ccd193a8195980..edef689792b163e6a33921fe2e4b1af69715a2ee 100644
|
||||
index 3eb3cd1089ec46c64f82e99f25d19cee9e0cdfbe..a27b0a3895290f5abb3a8e07fb886530fdf28c75 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -2260,6 +2260,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
@@ -2507,6 +2507,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, (float) gameMode.getId()));
|
||||
if (gameMode == GameType.SPECTATOR) {
|
||||
this.removeEntitiesOnShoulder();
|
||||
@@ -6,14 +6,14 @@ Subject: [PATCH] Fix-MC-223153
|
||||
Related MC issue: https://bugs.mojang.com/browse/MC-223153
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Blocks.java b/src/main/java/net/minecraft/world/level/block/Blocks.java
|
||||
index 7d58a95f7ae8983b466b275f4f82597d38762af0..6a2faa69e86123aeb902c2792bb225a6eaf8ba53 100644
|
||||
index 63d67d46d30ed8ed57cdc0e59b6cb6b75ab22c1f..539b5625ba0ef7389ff1e7041af86f538640f3d9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Blocks.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Blocks.java
|
||||
@@ -7535,6 +7535,7 @@ public class Blocks {
|
||||
@@ -6611,6 +6611,7 @@ public class Blocks {
|
||||
.mapColor(MapColor.COLOR_ORANGE)
|
||||
.instrument(NoteBlockInstrument.BASEDRUM)
|
||||
.requiresCorrectToolForDrops()
|
||||
+ .sound(SoundType.COPPER) // Leaf - Fix MC-223153
|
||||
.strength(5.0F, 6.0F)
|
||||
)
|
||||
);
|
||||
public static final Block RAW_GOLD_BLOCK = register(
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Fix MC-177381
|
||||
Related MC issue: https://bugs.mojang.com/browse/MC-177381
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/commands/LocateCommand.java b/src/main/java/net/minecraft/server/commands/LocateCommand.java
|
||||
index 74a00a9b636b7457c54f9e76f60432de1701239b..39f5deea47d8f573c3cfec5df431216ee806c32c 100644
|
||||
index 2972f041eea95b92b37c2ab869f9f8ed3d142a27..dcdde4cd7f15d34eabba4b3802971db20e6ae9d2 100644
|
||||
--- a/src/main/java/net/minecraft/server/commands/LocateCommand.java
|
||||
+++ b/src/main/java/net/minecraft/server/commands/LocateCommand.java
|
||||
@@ -197,8 +197,10 @@ public class LocateCommand {
|
||||
@@ -196,8 +196,10 @@ public class LocateCommand {
|
||||
}
|
||||
|
||||
private static float dist(int x1, int y1, int x2, int y2) {
|
||||
@@ -8,10 +8,10 @@ Related MC issue: https://bugs.mojang.com/browse/MC-150224
|
||||
This patch was backported from Minecraft snapshot 24w46a.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java
|
||||
index 459c0c95a27ddeb72e8714d3c2fcae1870051b3c..2d87d2c405a3c08c844601fe5791493f627b36bb 100644
|
||||
index b3a0146ccfcda9fa33b91d33458086b510bb4d7b..c89f1ae4858f5af68bd958c2c92c38d0af150899 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java
|
||||
@@ -193,9 +193,11 @@ public class Rabbit extends Animal implements VariantHolder<Rabbit.Variant> {
|
||||
@@ -192,9 +192,11 @@ public class Rabbit extends Animal implements VariantHolder<Rabbit.Variant> {
|
||||
// Purpur end
|
||||
float f = 0.3F;
|
||||
|
||||
@@ -25,7 +25,7 @@ index 459c0c95a27ddeb72e8714d3c2fcae1870051b3c..2d87d2c405a3c08c844601fe5791493f
|
||||
|
||||
Path pathentity = this.navigation.getPath();
|
||||
|
||||
@@ -207,9 +209,11 @@ public class Rabbit extends Animal implements VariantHolder<Rabbit.Variant> {
|
||||
@@ -206,9 +208,11 @@ public class Rabbit extends Animal implements VariantHolder<Rabbit.Variant> {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ index 459c0c95a27ddeb72e8714d3c2fcae1870051b3c..2d87d2c405a3c08c844601fe5791493f
|
||||
|
||||
return super.getJumpPower(f / 0.42F);
|
||||
}
|
||||
@@ -580,7 +584,7 @@ public class Rabbit extends Animal implements VariantHolder<Rabbit.Variant> {
|
||||
@@ -578,7 +582,7 @@ public class Rabbit extends Animal implements VariantHolder<Rabbit.Variant> {
|
||||
public void vanillaTick() { // Purpur
|
||||
if (this.rabbit.onGround() && !this.rabbit.jumping && !((Rabbit.RabbitJumpControl) this.rabbit.jumpControl).wantJump()) {
|
||||
this.rabbit.setSpeedModifier(0.0D);
|
||||
@@ -10,12 +10,12 @@ It is no necessary to check whether enable every tick..., so I changed the init
|
||||
modules and will do init again when server reload or config reload
|
||||
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/protocol/AppleSkinProtocol.java b/src/main/java/org/leavesmc/leaves/protocol/AppleSkinProtocol.java
|
||||
index c496c97c99cd352c2566731d3017cf1b14ee74ec..9b54e24bd094465625dca12f6ac5724f51775adb 100644
|
||||
index eb51acf0351769af0910ebb2d4a5abf542cbfb90..1e5d14690d92c7f9eccecd1cd0f3ecc6c90fc258 100644
|
||||
--- a/src/main/java/org/leavesmc/leaves/protocol/AppleSkinProtocol.java
|
||||
+++ b/src/main/java/org/leavesmc/leaves/protocol/AppleSkinProtocol.java
|
||||
@@ -31,6 +31,10 @@ public class AppleSkinProtocol {
|
||||
@@ -33,6 +33,10 @@ public class AppleSkinProtocol {
|
||||
|
||||
private static final Set<ServerPlayer> players = new HashSet<>();
|
||||
private static final Map<ServerPlayer, Set<String>> subscribedChannels = new HashMap<>();
|
||||
|
||||
+ public static boolean shouldEnable() {
|
||||
+ return org.dreeam.leaf.config.modules.network.ProtocolSupport.appleskinProtocol;
|
||||
@@ -24,7 +24,7 @@ index c496c97c99cd352c2566731d3017cf1b14ee74ec..9b54e24bd094465625dca12f6ac5724f
|
||||
@Contract("_ -> new")
|
||||
public static @NotNull ResourceLocation id(String path) {
|
||||
return new ResourceLocation(PROTOCOL_ID, path);
|
||||
@@ -38,49 +42,41 @@ public class AppleSkinProtocol {
|
||||
@@ -40,17 +44,13 @@ public class AppleSkinProtocol {
|
||||
|
||||
@ProtocolHandler.PlayerJoin
|
||||
public static void onPlayerLoggedIn(@NotNull ServerPlayer player) {
|
||||
@@ -37,68 +37,30 @@ index c496c97c99cd352c2566731d3017cf1b14ee74ec..9b54e24bd094465625dca12f6ac5724f
|
||||
@ProtocolHandler.PlayerLeave
|
||||
public static void onPlayerLoggedOut(@NotNull ServerPlayer player) {
|
||||
- if (org.dreeam.leaf.config.modules.network.ProtocolSupport.appleskinProtocol) {
|
||||
- players.remove(player);
|
||||
- resetPlayerData(player);
|
||||
subscribedChannels.remove(player);
|
||||
resetPlayerData(player);
|
||||
- }
|
||||
+ players.remove(player);
|
||||
+ resetPlayerData(player);
|
||||
}
|
||||
|
||||
@ProtocolHandler.MinecraftRegister(ignoreId = true)
|
||||
public static void onPlayerSubscribed(@NotNull ServerPlayer player) {
|
||||
- if (org.dreeam.leaf.config.modules.network.ProtocolSupport.appleskinProtocol) {
|
||||
- players.add(player);
|
||||
- }
|
||||
+ players.add(player);
|
||||
}
|
||||
@@ -62,7 +62,6 @@ public class AppleSkinProtocol {
|
||||
|
||||
@ProtocolHandler.Ticker
|
||||
public static void tick() {
|
||||
- if (org.dreeam.leaf.config.modules.network.ProtocolSupport.appleskinProtocol) {
|
||||
- for (ServerPlayer player : players) {
|
||||
- FoodData data = player.getFoodData();
|
||||
-
|
||||
- float saturation = data.getSaturationLevel();
|
||||
- Float previousSaturation = previousSaturationLevels.get(player.getUUID());
|
||||
- if (previousSaturation == null || saturation != previousSaturation) {
|
||||
- ProtocolUtils.sendPayloadPacket(player, SATURATION_KEY, buf -> {
|
||||
- buf.writeFloat(saturation);
|
||||
- });
|
||||
- previousSaturationLevels.put(player.getUUID(), saturation);
|
||||
if (MinecraftServer.getServer().getTickCount() % org.dreeam.leaf.config.modules.network.ProtocolSupport.appleskinSyncTickInterval != 0) {
|
||||
return;
|
||||
}
|
||||
@@ -102,7 +101,6 @@ public class AppleSkinProtocol {
|
||||
}
|
||||
}
|
||||
}
|
||||
- }
|
||||
-
|
||||
- float exhaustion = data.getExhaustionLevel();
|
||||
- Float previousExhaustion = previousExhaustionLevels.get(player.getUUID());
|
||||
- if (previousExhaustion == null || Math.abs(exhaustion - previousExhaustion) >= MINIMUM_EXHAUSTION_CHANGE_THRESHOLD) {
|
||||
- ProtocolUtils.sendPayloadPacket(player, EXHAUSTION_KEY, buf -> {
|
||||
- buf.writeFloat(exhaustion);
|
||||
- });
|
||||
- previousExhaustionLevels.put(player.getUUID(), exhaustion);
|
||||
- }
|
||||
+ for (ServerPlayer player : players) {
|
||||
+ FoodData data = player.getFoodData();
|
||||
+
|
||||
+ float saturation = data.getSaturationLevel();
|
||||
+ Float previousSaturation = previousSaturationLevels.get(player.getUUID());
|
||||
+ if (previousSaturation == null || saturation != previousSaturation) {
|
||||
+ ProtocolUtils.sendPayloadPacket(player, SATURATION_KEY, buf -> {
|
||||
+ buf.writeFloat(saturation);
|
||||
+ });
|
||||
+ previousSaturationLevels.put(player.getUUID(), saturation);
|
||||
+ }
|
||||
+
|
||||
+ float exhaustion = data.getExhaustionLevel();
|
||||
+ Float previousExhaustion = previousExhaustionLevels.get(player.getUUID());
|
||||
+ if (previousExhaustion == null || Math.abs(exhaustion - previousExhaustion) >= MINIMUM_EXHAUSTION_CHANGE_THRESHOLD) {
|
||||
+ ProtocolUtils.sendPayloadPacket(player, EXHAUSTION_KEY, buf -> {
|
||||
+ buf.writeFloat(exhaustion);
|
||||
+ });
|
||||
+ previousExhaustionLevels.put(player.getUUID(), exhaustion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ProtocolHandler.ReloadServer
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/protocol/AsteorBarProtocol.java b/src/main/java/org/leavesmc/leaves/protocol/AsteorBarProtocol.java
|
||||
index ed8d9888a24d3ae6cf8fe2f8b269554102e451df..1bdd77078c7345db1a675fbdc26b37e96bf468b0 100644
|
||||
index e6f3a52c3b6a23d8a8f7c4ae7828efa5dd51523e..1f22ebe756bd19afca3b7f826ff12cd6735da59f 100644
|
||||
--- a/src/main/java/org/leavesmc/leaves/protocol/AsteorBarProtocol.java
|
||||
+++ b/src/main/java/org/leavesmc/leaves/protocol/AsteorBarProtocol.java
|
||||
@@ -30,6 +30,10 @@ public class AsteorBarProtocol {
|
||||
@@ -112,7 +74,7 @@ index ed8d9888a24d3ae6cf8fe2f8b269554102e451df..1bdd77078c7345db1a675fbdc26b37e9
|
||||
@Contract("_ -> new")
|
||||
public static @NotNull ResourceLocation id(String path) {
|
||||
return ResourceLocation.fromNamespaceAndPath(PROTOCOL_ID, path);
|
||||
@@ -37,51 +41,43 @@ public class AsteorBarProtocol {
|
||||
@@ -37,29 +41,22 @@ public class AsteorBarProtocol {
|
||||
|
||||
@ProtocolHandler.PlayerJoin
|
||||
public static void onPlayerLoggedIn(@NotNull ServerPlayer player) {
|
||||
@@ -143,70 +105,32 @@ index ed8d9888a24d3ae6cf8fe2f8b269554102e451df..1bdd77078c7345db1a675fbdc26b37e9
|
||||
@ProtocolHandler.Ticker
|
||||
public static void tick() {
|
||||
- if (org.dreeam.leaf.config.modules.network.ProtocolSupport.asteorBarProtocol) {
|
||||
- for (ServerPlayer player : players) {
|
||||
- FoodData data = player.getFoodData();
|
||||
-
|
||||
- float saturation = data.getSaturationLevel();
|
||||
- Float previousSaturation = previousSaturationLevels.get(player.getUUID());
|
||||
- if (previousSaturation == null || saturation != previousSaturation) {
|
||||
- ProtocolUtils.sendPayloadPacket(player, NETWORK_KEY, buf -> {
|
||||
- buf.writeByte(1);
|
||||
- buf.writeFloat(saturation);
|
||||
- });
|
||||
- previousSaturationLevels.put(player.getUUID(), saturation);
|
||||
for (ServerPlayer player : players) {
|
||||
FoodData data = player.getFoodData();
|
||||
|
||||
@@ -83,7 +80,6 @@ public class AsteorBarProtocol {
|
||||
previousExhaustionLevels.put(player.getUUID(), exhaustion);
|
||||
}
|
||||
}
|
||||
- }
|
||||
-
|
||||
- float exhaustion = data.getExhaustionLevel();
|
||||
- Float previousExhaustion = previousExhaustionLevels.get(player.getUUID());
|
||||
- if (previousExhaustion == null || Math.abs(exhaustion - previousExhaustion) >= THRESHOLD) {
|
||||
- ProtocolUtils.sendPayloadPacket(player, NETWORK_KEY, buf -> {
|
||||
- buf.writeByte(0);
|
||||
- buf.writeFloat(exhaustion);
|
||||
- });
|
||||
- previousExhaustionLevels.put(player.getUUID(), exhaustion);
|
||||
- }
|
||||
+ for (ServerPlayer player : players) {
|
||||
+ FoodData data = player.getFoodData();
|
||||
+
|
||||
+ float saturation = data.getSaturationLevel();
|
||||
+ Float previousSaturation = previousSaturationLevels.get(player.getUUID());
|
||||
+ if (previousSaturation == null || saturation != previousSaturation) {
|
||||
+ ProtocolUtils.sendPayloadPacket(player, NETWORK_KEY, buf -> {
|
||||
+ buf.writeByte(1);
|
||||
+ buf.writeFloat(saturation);
|
||||
+ });
|
||||
+ previousSaturationLevels.put(player.getUUID(), saturation);
|
||||
+ }
|
||||
+
|
||||
+ float exhaustion = data.getExhaustionLevel();
|
||||
+ Float previousExhaustion = previousExhaustionLevels.get(player.getUUID());
|
||||
+ if (previousExhaustion == null || Math.abs(exhaustion - previousExhaustion) >= THRESHOLD) {
|
||||
+ ProtocolUtils.sendPayloadPacket(player, NETWORK_KEY, buf -> {
|
||||
+ buf.writeByte(0);
|
||||
+ buf.writeFloat(exhaustion);
|
||||
+ });
|
||||
+ previousExhaustionLevels.put(player.getUUID(), exhaustion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ProtocolHandler.ReloadServer
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/protocol/ChatImageProtocol.java b/src/main/java/org/leavesmc/leaves/protocol/ChatImageProtocol.java
|
||||
index 5ef387ccfe19bb91bbcb926d44e7a01450035a1d..1ddafae8b8c3d5c0f12bb12dc01d09ecaa5d68cf 100644
|
||||
index dd652437c0e999f0b523b69bca8f5803611ead6c..364922e9756193130608c51e052ddc9679854ced 100644
|
||||
--- a/src/main/java/org/leavesmc/leaves/protocol/ChatImageProtocol.java
|
||||
+++ b/src/main/java/org/leavesmc/leaves/protocol/ChatImageProtocol.java
|
||||
@@ -30,7 +30,12 @@ public class ChatImageProtocol {
|
||||
@@ -31,6 +31,10 @@ public class ChatImageProtocol {
|
||||
public static int MAX_STRING = 532767;
|
||||
private static final Gson gson = new Gson();
|
||||
|
||||
- public record FileInfoChannelPacket(String message) implements LeavesCustomPayload<LeavesProtocolManager.LeavesPayload> {
|
||||
+ public static boolean shouldEnable() {
|
||||
+ return org.dreeam.leaf.config.modules.network.ProtocolSupport.chatImageProtocol;
|
||||
+ }
|
||||
+
|
||||
+ public record FileInfoChannelPacket(
|
||||
+ String message) implements LeavesCustomPayload<LeavesProtocolManager.LeavesPayload> {
|
||||
public record FileInfoChannelPacket(
|
||||
String message) implements LeavesCustomPayload<LeavesProtocolManager.LeavesPayload> {
|
||||
private static final ResourceLocation FILE_INFO = ChatImageProtocol.id("file_info");
|
||||
|
||||
@New
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/protocol/XaeroMapProtocol.java b/src/main/java/org/leavesmc/leaves/protocol/XaeroMapProtocol.java
|
||||
index 9e35dfaf8bb5511b4cd0a71175d7ecb6d835042f..5ef19098512ae8a070dea270a68c27695c34624b 100644
|
||||
--- a/src/main/java/org/leavesmc/leaves/protocol/XaeroMapProtocol.java
|
||||
@@ -232,7 +156,7 @@ index 9e35dfaf8bb5511b4cd0a71175d7ecb6d835042f..5ef19098512ae8a070dea270a68c2769
|
||||
buf.writeByte(0);
|
||||
buf.writeInt(org.dreeam.leaf.config.modules.network.ProtocolSupport.xaeroMapServerID);
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java b/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java
|
||||
index b76eb38942171d22dcd767ea353f012e5920f1f5..ec901ea7103ce5a3e1d6fa1efd8135ce020e18ce 100644
|
||||
index 87b1502c1b980d33cae205ae35d336f7450e5e94..89cc2bc49c9a8d6ae5dd3ff10ac96e4282d9a727 100644
|
||||
--- a/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java
|
||||
+++ b/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java
|
||||
@@ -10,30 +10,21 @@ import org.bukkit.event.player.PlayerKickEvent;
|
||||
@@ -346,7 +270,7 @@ index b76eb38942171d22dcd767ea353f012e5920f1f5..ec901ea7103ce5a3e1d6fa1efd8135ce
|
||||
public static LeavesCustomPayload<?> decode(ResourceLocation id, FriendlyByteBuf buf) {
|
||||
for (LeavesProtocol protocol : KNOWN_TYPES.keySet()) {
|
||||
if (!ArrayUtils.contains(protocol.namespace(), id.getNamespace())) {
|
||||
@@ -297,81 +316,6 @@ public class LeavesProtocolManager {
|
||||
@@ -296,81 +315,6 @@ public class LeavesProtocolManager {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,7 +353,7 @@ index b76eb38942171d22dcd767ea353f012e5920f1f5..ec901ea7103ce5a3e1d6fa1efd8135ce
|
||||
@Override
|
||||
public void write(@NotNull FriendlyByteBuf buf) {
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/protocol/jade/JadeProtocol.java b/src/main/java/org/leavesmc/leaves/protocol/jade/JadeProtocol.java
|
||||
index fed4f91689f635dc107987e3714129250e2d458a..d59ef7d063841c912796b8436383290337b04452 100644
|
||||
index 41e4f98203b2e4392b0f76a560a4ed22db31adef..7777bfba21233625b21876ae55e09157ce84e04c 100644
|
||||
--- a/src/main/java/org/leavesmc/leaves/protocol/jade/JadeProtocol.java
|
||||
+++ b/src/main/java/org/leavesmc/leaves/protocol/jade/JadeProtocol.java
|
||||
@@ -98,6 +98,10 @@ public class JadeProtocol {
|
||||
@@ -8,10 +8,10 @@ and the results are always same, thus there is no need to do the convert process
|
||||
Save ~0.16ms per tick, and improve 11660ms -> 60ms in around 1 hour.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/util/SpawnUtil.java b/src/main/java/net/minecraft/util/SpawnUtil.java
|
||||
index 5c8e36ea8287029b1789719c687bac1a2c4c3a69..466e8213ded4c75d6240e4bf8ccd6ed9fb69dd39 100644
|
||||
index 34c3bf85473b3ad89355ebc21b68c59b3c683b84..a86955c3afc3468e92fb54c5ee0bf9c592f0b0cb 100644
|
||||
--- a/src/main/java/net/minecraft/util/SpawnUtil.java
|
||||
+++ b/src/main/java/net/minecraft/util/SpawnUtil.java
|
||||
@@ -37,7 +37,7 @@ public class SpawnUtil {
|
||||
@@ -38,7 +38,7 @@ public class SpawnUtil {
|
||||
// Paper start - PreCreatureSpawnEvent
|
||||
com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
|
||||
io.papermc.paper.util.MCUtil.toLocation(worldserver, blockposition),
|
||||
@@ -21,10 +21,10 @@ index 5c8e36ea8287029b1789719c687bac1a2c4c3a69..466e8213ded4c75d6240e4bf8ccd6ed9
|
||||
);
|
||||
if (!event.callEvent()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
index 6ac3dfab99cfb0b51c81cc20e71da1261a8c567c..992ce1076ac186ea21e1084624c31bd8077ab58b 100644
|
||||
index 002795df9c9c8d27f07f855dff148dfe353bef68..ca9459d3f8dbde237329dad1ec62f0791edb6a6c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
@@ -442,7 +442,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||
@@ -512,7 +512,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||
// Paper start - PreCreatureSpawnEvent
|
||||
com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
|
||||
io.papermc.paper.util.MCUtil.toLocation(worldserver, blockposition),
|
||||
@@ -34,7 +34,7 @@ index 6ac3dfab99cfb0b51c81cc20e71da1261a8c567c..992ce1076ac186ea21e1084624c31bd8
|
||||
);
|
||||
if (!event.callEvent()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
index 967af8771ff8564c715d89f4b4b69b16c25add59..e7fafb3f919a7275212896c65a6eff682427ee34 100644
|
||||
index bb4411cfdf1bc7adc12c2f918d2eec830299f38b..b23397ae135f31abb7ac6bafd9064d7ef5e94218 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
@@ -137,7 +137,7 @@ public abstract class BaseSpawner {
|
||||
@@ -47,10 +47,10 @@ index 967af8771ff8564c715d89f4b4b69b16c25add59..e7fafb3f919a7275212896c65a6eff68
|
||||
);
|
||||
if (!event.callEvent()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
index 4d009e649fedd4fc2fbbd4856cad33cdd38ff1eb..95a000dbf1a05cfd8182f15c0e0bbf7023578974 100644
|
||||
index 88b3715df673c6d12aea69fde075ad3caa8c51e8..cc07f55e65589549c349cc078afa3b0fa81c203d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
@@ -343,7 +343,7 @@ public final class NaturalSpawner {
|
||||
@@ -368,7 +368,7 @@ public final class NaturalSpawner {
|
||||
// Paper start - PreCreatureSpawnEvent
|
||||
com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
|
||||
io.papermc.paper.util.MCUtil.toLocation(world, pos),
|
||||
@@ -108,10 +108,10 @@ index 1e7a27bc783e68f9579d4d3c72ec165bde7175b9..72dfd388bb784009ac77ff0c93db56eb
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 77c04c79a7cf58c4f862ca92f4eca24146796fb7..b0058d6895b00c10d28113ae7e37223c9cd107db 100644
|
||||
index 410b42fe4f5b4f545f2f035c84f0786003bf1915..0332266782d326d557709b360b9c647e464c0726 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -83,7 +83,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
@@ -84,7 +84,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
public CraftEntity(final CraftServer server, final Entity entity) {
|
||||
this.server = server;
|
||||
this.entity = entity;
|
||||
@@ -120,7 +120,7 @@ index 77c04c79a7cf58c4f862ca92f4eca24146796fb7..b0058d6895b00c10d28113ae7e37223c
|
||||
this.taskScheduler = new io.papermc.paper.threadedregions.EntityScheduler(this.entity.getServer(), this); // SparklyPaper - skip EntityScheduler's executeTick checks if there isn't any tasks to be run
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
@@ -124,7 +124,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,10 +143,10 @@ index b605924b96a9ec20bdccebdfa34067c1c1f95ada..32a0009c3c4f5fbb5ce3caa602416d25
|
||||
|
||||
public static CraftEntityFactory instance() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntitySnapshot.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntitySnapshot.java
|
||||
index 7b014b39e07decda09c6b0658a190bcd0b2504e8..3a012825e8f6700277b406f25ed7ed8995a7819c 100644
|
||||
index 6642bdc117d54aa2560518d4e08438a88e6fb3a1..14858bf98a4e3a88d0fb8a1ed7503fa2fda999b9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntitySnapshot.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntitySnapshot.java
|
||||
@@ -81,7 +81,7 @@ public class CraftEntitySnapshot implements EntitySnapshot {
|
||||
@@ -82,7 +82,7 @@ public class CraftEntitySnapshot implements EntitySnapshot {
|
||||
}
|
||||
|
||||
public static CraftEntitySnapshot create(CompoundTag tag) {
|
||||
@@ -156,10 +156,10 @@ index 7b014b39e07decda09c6b0658a190bcd0b2504e8..3a012825e8f6700277b406f25ed7ed89
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityType.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityType.java
|
||||
index 266b616419a47f518a43b990cc7cbb4516beda03..700c1f1fc2b87ad5aa4a5ff3f29124889ce9dfc3 100644
|
||||
index d230cbc26f61d8ac5880825aca4dfab197c20401..1fdf2d7880f6b4f05702c5742c2b33e7eeba3af9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityType.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityType.java
|
||||
@@ -13,6 +13,23 @@ import org.bukkit.entity.EntityType;
|
||||
@@ -14,6 +14,23 @@ import org.bukkit.entity.EntityType;
|
||||
|
||||
public class CraftEntityType {
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Configurable player knockback zombie
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 21fbf1f88dbf8e767549a8fd0a7e9a8e0e434d54..042e9075bd1b62f9f25647502aad496a4f474967 100644
|
||||
index 7aab6970bf73108435e79a6ef39896e9fca8659e..b816d4509f5d1154fdbe462a0534a17c0d238281 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2040,6 +2040,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -2109,6 +2109,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
public void knockback(double d0, double d1, double d2, @Nullable Entity attacker, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause cause) { // Paper - knockback events
|
||||
@@ -17,7 +17,7 @@ index 21fbf1f88dbf8e767549a8fd0a7e9a8e0e434d54..042e9075bd1b62f9f25647502aad496a
|
||||
d0 *= 1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE);
|
||||
if (true || d0 > 0.0D) { // CraftBukkit - Call event even when force is 0
|
||||
//this.hasImpulse = true; // CraftBukkit - Move down
|
||||
@@ -2067,6 +2069,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -2136,6 +2138,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Hide specified item components to clients
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
|
||||
index 8cca2ac616a2c80268c96b9f95e33f834a0fc8fd..c2c0e88962ea010ece20f9710dfcd83b7b61bf91 100644
|
||||
index 8d5939e03a065197af125d95a10134abbccd07ec..0acd7a54dea269b172fb909dd28ac82f6691c319 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
|
||||
@@ -23,17 +23,17 @@ public class ClientboundContainerSetContentPacket implements Packet<ClientGamePa
|
||||
@@ -21,7 +21,7 @@ index 8cca2ac616a2c80268c96b9f95e33f834a0fc8fd..c2c0e88962ea010ece20f9710dfcd83b
|
||||
}
|
||||
|
||||
private ClientboundContainerSetContentPacket(RegistryFriendlyByteBuf buf) {
|
||||
this.containerId = buf.readUnsignedByte();
|
||||
this.containerId = buf.readContainerId();
|
||||
this.stateId = buf.readVarInt();
|
||||
- this.items = ItemStack.OPTIONAL_LIST_STREAM_CODEC.decode(buf);
|
||||
- this.carriedItem = ItemStack.OPTIONAL_STREAM_CODEC.decode(buf);
|
||||
@@ -31,10 +31,10 @@ index 8cca2ac616a2c80268c96b9f95e33f834a0fc8fd..c2c0e88962ea010ece20f9710dfcd83b
|
||||
|
||||
// Paper start - Handle large packets disconnecting client
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java
|
||||
index 63f6a2437da9363786b55af0a7cbc5373232d35b..f4c85b78eafb27331ab7c3e45c8493b271583241 100644
|
||||
index 97b6605ba56584a44cfc4361af7389e876496ef2..b60827b281fe03b855c42099df437080a535c714 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java
|
||||
@@ -21,14 +21,14 @@ public class ClientboundContainerSetSlotPacket implements Packet<ClientGamePacke
|
||||
@@ -19,14 +19,14 @@ public class ClientboundContainerSetSlotPacket implements Packet<ClientGamePacke
|
||||
this.containerId = syncId;
|
||||
this.stateId = revision;
|
||||
this.slot = slot;
|
||||
@@ -43,7 +43,7 @@ index 63f6a2437da9363786b55af0a7cbc5373232d35b..f4c85b78eafb27331ab7c3e45c8493b2
|
||||
}
|
||||
|
||||
private ClientboundContainerSetSlotPacket(RegistryFriendlyByteBuf buf) {
|
||||
this.containerId = buf.readByte();
|
||||
this.containerId = buf.readContainerId();
|
||||
this.stateId = buf.readVarInt();
|
||||
this.slot = buf.readShort();
|
||||
- this.itemStack = ItemStack.OPTIONAL_STREAM_CODEC.decode(buf);
|
||||
@@ -52,11 +52,11 @@ index 63f6a2437da9363786b55af0a7cbc5373232d35b..f4c85b78eafb27331ab7c3e45c8493b2
|
||||
|
||||
private void write(RegistryFriendlyByteBuf buf) {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 573c380e123473e35c0b72c44b32c8d6ba8e61c6..feacc41ecf7f4028e0a1cce5d2012ced96a26d30 100644
|
||||
index a7a44fa556a41512d6a76626618afceccd139c64..709d9997f25369a9a0ac5af94cfe391604081ea1 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -374,7 +374,7 @@ public class ServerEntity {
|
||||
ItemStack itemstack = ((LivingEntity) this.entity).getItemBySlot(enumitemslot);
|
||||
@@ -413,7 +413,7 @@ public class ServerEntity {
|
||||
ItemStack itemstack = entityliving.getItemBySlot(enumitemslot);
|
||||
|
||||
if (!itemstack.isEmpty()) {
|
||||
- list.add(Pair.of(enumitemslot, itemstack.copy()));
|
||||
@@ -65,32 +65,32 @@ index 573c380e123473e35c0b72c44b32c8d6ba8e61c6..feacc41ecf7f4028e0a1cce5d2012ced
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index fd7ad7866d9f16c62850d37c98d1736cd54242e4..82b885a6037afa35da76997d9eab6fe3390df5c2 100644
|
||||
index 4ecefd90defffeac792d4cb2375ee2d68513b170..0684a8e9e0d91c1724d1e066daa71030bba70904 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2958,7 +2958,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -2979,7 +2979,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
entity.refreshEntityData(ServerGamePacketListenerImpl.this.player);
|
||||
// SPIGOT-7136 - Allays
|
||||
if (entity instanceof Allay || entity instanceof net.minecraft.world.entity.animal.horse.AbstractHorse) { // Paper - Fix horse armor desync
|
||||
- ServerGamePacketListenerImpl.this.send(new ClientboundSetEquipmentPacket(entity.getId(), Arrays.stream(net.minecraft.world.entity.EquipmentSlot.VALUES).map((slot) -> Pair.of(slot, ((LivingEntity) entity).getItemBySlot(slot).copy())).collect(Collectors.toList()), true)); // Paper - sanitize // Gale - JettPack - reduce array allocations
|
||||
+ ServerGamePacketListenerImpl.this.send(new ClientboundSetEquipmentPacket(entity.getId(), Arrays.stream(net.minecraft.world.entity.EquipmentSlot.VALUES).map((slot) -> Pair.of(slot, org.dreeam.leaf.util.item.ItemStackObfuscator.stripMeta(((LivingEntity) entity).getItemBySlot(slot), true))).collect(Collectors.toList()), true)); // Paper - sanitize // Gale - JettPack - reduce array allocations // Leaf - Hide specified item components
|
||||
- ServerGamePacketListenerImpl.this.send(new ClientboundSetEquipmentPacket(entity.getId(), Arrays.stream(net.minecraft.world.entity.EquipmentSlot.VALUES_ARRAY).map((slot) -> Pair.of(slot, ((LivingEntity) entity).getItemBySlot(slot).copy())).collect(Collectors.toList()), true)); // Paper - sanitize // Gale - JettPack - reduce array allocations
|
||||
+ ServerGamePacketListenerImpl.this.send(new ClientboundSetEquipmentPacket(entity.getId(), Arrays.stream(net.minecraft.world.entity.EquipmentSlot.VALUES_ARRAY).map((slot) -> Pair.of(slot, org.dreeam.leaf.util.item.ItemStackObfuscator.stripMeta(((LivingEntity) entity).getItemBySlot(slot), true))).collect(Collectors.toList()), true)); // Paper - sanitize // Gale - JettPack - reduce array allocations // Leaf - Hide specified item components
|
||||
}
|
||||
|
||||
ServerGamePacketListenerImpl.this.player.containerMenu.sendAllDataToRemote(); // Paper - fix slot desync - always refresh player inventory
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 042e9075bd1b62f9f25647502aad496a4f474967..a2b40565395921ad293068829355275b4655cf54 100644
|
||||
index b816d4509f5d1154fdbe462a0534a17c0d238281..004cecfe99d279a51c21d610833bbea62c8ff25f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3416,7 +3416,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
ItemStack itemstack1 = itemstack;
|
||||
ItemStack itemstack2 = this.getItemBySlot(enumitemslot);
|
||||
@@ -3552,7 +3552,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
ItemStack itemstack2 = itemstack1; final ItemStack oldEquipment = itemstack2; // Paper - PlayerArmorChangeEvent - obfhelper
|
||||
|
||||
- if (this.equipmentHasChanged(itemstack1, itemstack2)) {
|
||||
+ if (this.equipmentHasChanged(org.dreeam.leaf.util.item.ItemStackObfuscator.stripMeta(itemstack1, true), org.dreeam.leaf.util.item.ItemStackObfuscator.stripMeta(itemstack2, true))) { // Leaf - Hide specified item components
|
||||
itemstack = this.getItemBySlot(enumitemslot); final ItemStack newEquipment = itemstack;// Paper - PlayerArmorChangeEvent - obfhelper
|
||||
- if (this.equipmentHasChanged(itemstack2, itemstack)) {
|
||||
+ if (this.equipmentHasChanged(org.dreeam.leaf.util.item.ItemStackObfuscator.stripMeta(itemstack2, true), org.dreeam.leaf.util.item.ItemStackObfuscator.stripMeta(itemstack, true))) { // Leaf - Hide specified item components
|
||||
// Paper start - PlayerArmorChangeEvent
|
||||
if (this instanceof ServerPlayer && enumitemslot.getType() == EquipmentSlot.Type.HUMANOID_ARMOR) {
|
||||
final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack1);
|
||||
@@ -3500,7 +3500,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(oldEquipment);
|
||||
@@ -3629,7 +3629,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
equipmentChanges.forEach((enumitemslot, itemstack) -> {
|
||||
ItemStack itemstack1 = itemstack.copy();
|
||||
|
||||
@@ -100,10 +100,10 @@ index 042e9075bd1b62f9f25647502aad496a4f474967..a2b40565395921ad293068829355275b
|
||||
case HAND:
|
||||
this.setLastHandItem(enumitemslot, itemstack1);
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
index ecfa807e78c16a24099d40becd0c7916f239aed1..f1b4adeeb4dad5178a5e52870f420beaa8e13034 100644
|
||||
index bfc90524bd739ed1d91fe9912e38093b3c28928f..71f8946a77f755a4b5ada4313ca154caca070556 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
@@ -295,7 +295,7 @@ public abstract class AbstractContainerMenu {
|
||||
@@ -323,7 +323,7 @@ public abstract class AbstractContainerMenu {
|
||||
private void triggerSlotListeners(int slot, ItemStack stack, Supplier<ItemStack> copySupplier) {
|
||||
ItemStack itemstack1 = (ItemStack) this.lastSlots.get(slot);
|
||||
|
||||
@@ -112,7 +112,7 @@ index ecfa807e78c16a24099d40becd0c7916f239aed1..f1b4adeeb4dad5178a5e52870f420bea
|
||||
ItemStack itemstack2 = (ItemStack) copySupplier.get();
|
||||
|
||||
this.lastSlots.set(slot, itemstack2);
|
||||
@@ -314,7 +314,7 @@ public abstract class AbstractContainerMenu {
|
||||
@@ -342,7 +342,7 @@ public abstract class AbstractContainerMenu {
|
||||
if (!this.suppressRemoteUpdates) {
|
||||
ItemStack itemstack1 = (ItemStack) this.remoteSlots.get(slot);
|
||||
|
||||
@@ -121,7 +121,7 @@ index ecfa807e78c16a24099d40becd0c7916f239aed1..f1b4adeeb4dad5178a5e52870f420bea
|
||||
ItemStack itemstack2 = (ItemStack) copySupplier.get();
|
||||
|
||||
this.remoteSlots.set(slot, itemstack2);
|
||||
@@ -342,7 +342,7 @@ public abstract class AbstractContainerMenu {
|
||||
@@ -370,7 +370,7 @@ public abstract class AbstractContainerMenu {
|
||||
|
||||
private void synchronizeCarriedToRemote() {
|
||||
if (!this.suppressRemoteUpdates) {
|
||||
@@ -132,12 +132,13 @@ index ecfa807e78c16a24099d40becd0c7916f239aed1..f1b4adeeb4dad5178a5e52870f420bea
|
||||
this.synchronizer.sendCarriedChange(this, this.remoteCarried);
|
||||
diff --git a/src/main/java/org/dreeam/leaf/config/modules/misc/HiddenItemComponents.java b/src/main/java/org/dreeam/leaf/config/modules/misc/HiddenItemComponents.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f89b21cbe62d66afd61c7a61d3a126a5dfda373e
|
||||
index 0000000000000000000000000000000000000000..81f28d84ad9043d9e5f3e86dbb231d10cf6c8520
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/dreeam/leaf/config/modules/misc/HiddenItemComponents.java
|
||||
@@ -0,0 +1,51 @@
|
||||
@@ -0,0 +1,60 @@
|
||||
+package org.dreeam.leaf.config.modules.misc;
|
||||
+
|
||||
+import net.minecraft.core.Holder;
|
||||
+import net.minecraft.core.component.DataComponentType;
|
||||
+import net.minecraft.core.registries.BuiltInRegistries;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
@@ -147,6 +148,7 @@ index 0000000000000000000000000000000000000000..f89b21cbe62d66afd61c7a61d3a126a5
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.List;
|
||||
+import java.util.Optional;
|
||||
+
|
||||
+public class HiddenItemComponents extends ConfigModules {
|
||||
+
|
||||
@@ -177,10 +179,17 @@ index 0000000000000000000000000000000000000000..f89b21cbe62d66afd61c7a61d3a126a5
|
||||
+
|
||||
+ for (String id : list) {
|
||||
+ // Find and check
|
||||
+ DataComponentType<?> type = BuiltInRegistries.DATA_COMPONENT_TYPE.get(ResourceLocation.parse(id));
|
||||
+ Optional<Holder.Reference<DataComponentType<?>>> optional = BuiltInRegistries.DATA_COMPONENT_TYPE.get(ResourceLocation.parse(id));
|
||||
+
|
||||
+ if (optional.isEmpty()) continue;
|
||||
+
|
||||
+ DataComponentType<?> type = optional.get().value();
|
||||
+
|
||||
+ if (type != null) {
|
||||
+ types.add(type);
|
||||
+ } else LeafConfig.LOGGER.warn("Unknown component type: {}", id);
|
||||
+ } else {
|
||||
+ LeafConfig.LOGGER.warn("Unknown component type: {}", id);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ hiddenItemComponentTypes = types;
|
||||
@@ -8,7 +8,7 @@ Original project: https://github.com/PaperMC/Paper
|
||||
Paper pull request: https://github.com/PaperMC/Paper/pull/10990
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 02d7180e5b932dd8c7e8867f1334cbc47e26f5bd..9d196c8a8a0dc49a54264471429b6ff6da8c2b06 100644
|
||||
index eb547af300d8ecea19b3e02e5ebe6139330c9d62..1e4729be4a245a811fd15ea1c02179b37defd67c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -239,6 +239,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
@@ -24,7 +24,7 @@ index 02d7180e5b932dd8c7e8867f1334cbc47e26f5bd..9d196c8a8a0dc49a54264471429b6ff6
|
||||
if (this.goalSelector.inactiveTick(this.activatedPriority, true) && !isThrottled) { // Pufferfish - pass activated priroity // Pufferfish - throttle inactive goal selector ticking
|
||||
this.goalSelector.tick();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
index 92e81a7092e594d1fbe2b239af363739fbba881a..0dc4491799806dc53da0c3815a02c082409ec988 100644
|
||||
index 4767cd3a59155f643d95211c71c19810e6569d85..f09042fc07dd1fdbff9dc89b413858d29ffacc83 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
@@ -323,7 +323,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
@@ -34,7 +34,7 @@ index 92e81a7092e594d1fbe2b239af363739fbba881a..0dc4491799806dc53da0c3815a02c082
|
||||
- if (this.isEffectiveAi()) {
|
||||
+ if (this.isEffectiveAi() && (!org.dreeam.leaf.config.modules.opt.SkipAIForNonAwareMob.enabled || this.aware)) { // Paper - Skip AI during inactive ticks for non-aware mobs
|
||||
if (this.level().spigotConfig.tickInactiveVillagers) {
|
||||
this.customServerAiStep();
|
||||
this.customServerAiStep(this.level().getMinecraftWorld());
|
||||
} else {
|
||||
diff --git a/src/main/java/org/dreeam/leaf/config/modules/opt/SkipAIForNonAwareMob.java b/src/main/java/org/dreeam/leaf/config/modules/opt/SkipAIForNonAwareMob.java
|
||||
new file mode 100644
|
||||
@@ -12,12 +12,12 @@ before spawning, it checks isSpawnPositionOk() for the position which loads the
|
||||
This patch ensures the chunk at the random location is loaded before trying to spawn the reinforcement zombie in it.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
index aa1fd8f2fba06292e93aba279cf18640b6909add..49c37853a0c26cef749a8a5ef4130554c0319ad9 100644
|
||||
index 5924509cbe36d3fee9d2f119d58e67c4b083e4c4..6efb548b6e1b466628eb70bc45ef98d09604c9df 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
@@ -384,6 +384,12 @@ public class Zombie extends Monster {
|
||||
@@ -405,6 +405,12 @@ public class Zombie extends Monster {
|
||||
int k1 = k + Mth.nextInt(this.random, 7, 40) * Mth.nextInt(this.random, -1, 1);
|
||||
BlockPos blockposition = new BlockPos(i1, j1, k1);
|
||||
EntityType<?> entitytypes = entityzombie.getType();
|
||||
|
||||
+ // Paper start - Prevent reinforcement checks from loading chunks
|
||||
+ if (this.level().getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) == null) {
|
||||
@@ -25,6 +25,6 @@ index aa1fd8f2fba06292e93aba279cf18640b6909add..49c37853a0c26cef749a8a5ef4130554
|
||||
+ }
|
||||
+ // Paper end - Prevent reinforcement checks from loading chunks
|
||||
+
|
||||
if (SpawnPlacements.isSpawnPositionOk(entitytypes, this.level(), blockposition) && SpawnPlacements.checkSpawnRules(entitytypes, worldserver, MobSpawnType.REINFORCEMENT, blockposition, this.level().random)) {
|
||||
if (SpawnPlacements.isSpawnPositionOk(entitytypes, world, blockposition) && SpawnPlacements.checkSpawnRules(entitytypes, world, EntitySpawnReason.REINFORCEMENT, blockposition, world.random)) {
|
||||
entityzombie.setPos((double) i1, (double) j1, (double) k1);
|
||||
if (!this.level().hasNearbyAlivePlayerThatAffectsSpawning((double) i1, (double) j1, (double) k1, 7.0D) && this.level().isUnobstructed(entityzombie) && this.level().noCollision((Entity) entityzombie) && !this.level().containsAnyLiquid(entityzombie.getBoundingBox())) { // Paper - Affects Spawning API
|
||||
if (!world.hasNearbyAlivePlayerThatAffectsSpawning((double) i1, (double) j1, (double) k1, 7.0D) && world.isUnobstructed(entityzombie) && world.noCollision((Entity) entityzombie) && (entityzombie.canSpawnInLiquids() || !world.containsAnyLiquid(entityzombie.getBoundingBox()))) { // Paper - affects spawning api
|
||||
@@ -14,10 +14,10 @@ Moves the deactivate event call into the onRemove method for the beacon block it
|
||||
The field I added feels a bit wrong but it works, it's to prevent the activation event being called immediately after loading, can't see any better way to differentiate between a newly placed beacon and a newly loaded one.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BeaconBlock.java b/src/main/java/net/minecraft/world/level/block/BeaconBlock.java
|
||||
index 56793f1ce1a4b919b5066966abf1768bf64540c8..d93756eadfef8ae260ba4f8253775aa4aa92c0d3 100644
|
||||
index debe8dbf1d5f3e58774903c5fcdcea672274ea61..413d6978d3acd441c90cdba6128bd35411048645 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BeaconBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BeaconBlock.java
|
||||
@@ -61,4 +61,16 @@ public class BeaconBlock extends BaseEntityBlock implements BeaconBeamBlock {
|
||||
@@ -57,4 +57,16 @@ public class BeaconBlock extends BaseEntityBlock implements BeaconBeamBlock {
|
||||
protected RenderShape getRenderShape(BlockState state) {
|
||||
return RenderShape.MODEL;
|
||||
}
|
||||
@@ -35,7 +35,7 @@ index 56793f1ce1a4b919b5066966abf1768bf64540c8..d93756eadfef8ae260ba4f8253775aa4
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
index df02a78855f1d0c32d1f744c20803fc97a8085c0..fa7f74811755186417508dc1bbb523c833060168 100644
|
||||
index 2d190b3a6378b8cbadfa65510df1ccfbd5882ef8..f2f5ef254e21134bf85f10d32541c9fbf883042f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
@@ -122,6 +122,8 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
||||
@@ -68,7 +68,7 @@ index df02a78855f1d0c32d1f744c20803fc97a8085c0..fa7f74811755186417508dc1bbb523c8
|
||||
@@ -251,11 +258,11 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
||||
|
||||
if (blockEntity.lastCheckY >= l) {
|
||||
blockEntity.lastCheckY = world.getMinBuildHeight() - 1;
|
||||
blockEntity.lastCheckY = world.getMinY() - 1;
|
||||
- boolean flag = i1 > 0;
|
||||
+ boolean flag = prevActive; // Paper - Fix MC-183981
|
||||
|
||||
@@ -96,5 +96,5 @@ index df02a78855f1d0c32d1f744c20803fc97a8085c0..fa7f74811755186417508dc1bbb523c8
|
||||
this.levels = nbt.getInt("Levels"); // CraftBukkit - SPIGOT-5053, use where available
|
||||
+ this.justLoadedAndPreviouslyActive = this.levels > 0; // Paper
|
||||
if (nbt.contains("CustomName", 8)) {
|
||||
this.name = parseCustomNameSafe(nbt.getString("CustomName"), registryLookup);
|
||||
this.name = parseCustomNameSafe(nbt.getString("CustomName"), registries);
|
||||
}
|
||||
@@ -9,11 +9,11 @@ Original license: MIT
|
||||
Original project: https://github.com/PurpurMC/Purpur
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index feacc41ecf7f4028e0a1cce5d2012ced96a26d30..05125144ce0cb50fa6ac769fa025cda010c93f14 100644
|
||||
index 709d9997f25369a9a0ac5af94cfe391604081ea1..bea671ae16a90e9cb9d2f312eed3c816da05b23c 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -229,6 +229,8 @@ public class ServerEntity {
|
||||
flag5 = true;
|
||||
@@ -243,6 +243,8 @@ public class ServerEntity {
|
||||
flag4 = true;
|
||||
}
|
||||
|
||||
+ if (org.dreeam.leaf.config.modules.opt.ReduceUselessPackets.reduceUselessEntityMovePackets && isUselessMoveEntityPacket(packet1)) packet1 = null; // Purpur
|
||||
@@ -21,7 +21,7 @@ index feacc41ecf7f4028e0a1cce5d2012ced96a26d30..05125144ce0cb50fa6ac769fa025cda0
|
||||
if ((this.trackDelta || this.entity.hasImpulse || this.entity instanceof LivingEntity && ((LivingEntity) this.entity).isFallFlying()) && this.tickCount > 0) {
|
||||
Vec3 vec3d1 = this.entity.getDeltaMovement();
|
||||
if (vec3d1 != this.lastSentMovement) { // SparklyPaper start - skip distanceToSqr call in ServerEntity#sendChanges if the delta movement hasn't changed
|
||||
@@ -311,6 +313,27 @@ public class ServerEntity {
|
||||
@@ -349,6 +351,27 @@ public class ServerEntity {
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
|
||||
Date: Tue, 27 Aug 2024 22:53:08 -0400
|
||||
Subject: [PATCH] Don't spawn if lastSpawnState is null
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index 09e06dbb8e3f9ce65fb0f9010aeb3066b6c21671..c649a21b2631ed8a2abe1b8d2ff1a5fbf5f511ec 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -633,7 +633,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
|
||||
ChunkPos chunkcoordintpair = chunk.getPos();
|
||||
|
||||
chunk.incrementInhabitedTime(timeDelta);
|
||||
- if (!list1.isEmpty() && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && (!org.dreeam.leaf.config.modules.async.AsyncMobSpawning.enabled || _pufferfish_spawnCountsReady.get()) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair, true)) { // Spigot // Pufferfish
|
||||
+ if (!list1.isEmpty() && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && lastSpawnState != null && (!org.dreeam.leaf.config.modules.async.AsyncMobSpawning.enabled || _pufferfish_spawnCountsReady.get()) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair, true)) { // Spigot // Pufferfish // Leaf - Don't spawn if lastSpawnState is null
|
||||
NaturalSpawner.spawnForChunk(this.level, chunk, lastSpawnState, list1); // Pufferfish
|
||||
}
|
||||
|
||||
@@ -41,10 +41,10 @@ index e42677bb004201efe1702779a78cc8d0ca05e80f..6676be8304e9415099ed423d3315180c
|
||||
}
|
||||
// Leaves start - skip photographer
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 6985da233e41a62bea04277260f81b3ba200a415..58e79417e3722ce73cbbc1f9c74cbc73178f762d 100644
|
||||
index 2b67936faa5fe058f4927610f01c4dc458117bf0..231f36edefffcbbf7256f73dcae922c17e74ae73 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -234,6 +234,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -240,6 +240,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
return;
|
||||
}
|
||||
final ServerPlayer[] backingSet = inRange.getRawDataUnchecked();
|
||||
@@ -60,7 +60,7 @@ index 6985da233e41a62bea04277260f81b3ba200a415..58e79417e3722ce73cbbc1f9c74cbc73
|
||||
for (int i = 0, len = inRange.size(); i < len; i++) {
|
||||
++(backingSet[i].mobCounts[index]);
|
||||
}
|
||||
@@ -972,6 +981,21 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -947,6 +956,21 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
((ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerEntity)entity).moonrise$setTrackedEntity(null); // Paper - optimise entity tracker
|
||||
}
|
||||
|
||||
@@ -81,8 +81,8 @@ index 6985da233e41a62bea04277260f81b3ba200a415..58e79417e3722ce73cbbc1f9c74cbc73
|
||||
+
|
||||
// Paper start - optimise entity tracker
|
||||
private void newTrackerTick() {
|
||||
final ca.spottedleaf.moonrise.common.misc.NearbyPlayers nearbyPlayers = ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getNearbyPlayers();
|
||||
@@ -1005,6 +1029,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
final ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup entityLookup = (ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup)((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getEntityLookup();;
|
||||
@@ -969,6 +993,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Paper end - optimise entity tracker
|
||||
|
||||
protected void tick() {
|
||||
@@ -96,7 +96,7 @@ index 6985da233e41a62bea04277260f81b3ba200a415..58e79417e3722ce73cbbc1f9c74cbc73
|
||||
// Paper start - optimise entity tracker
|
||||
if (true) {
|
||||
this.newTrackerTick();
|
||||
@@ -1154,7 +1185,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1118,7 +1149,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
final Entity entity;
|
||||
private final int range;
|
||||
SectionPos lastSectionPos;
|
||||
@@ -107,7 +107,7 @@ index 6985da233e41a62bea04277260f81b3ba200a415..58e79417e3722ce73cbbc1f9c74cbc73
|
||||
|
||||
// Paper start - optimise entity tracker
|
||||
private long lastChunkUpdate = -1L;
|
||||
@@ -1181,7 +1214,39 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1145,7 +1178,39 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.lastTrackedChunk = chunk;
|
||||
|
||||
final ServerPlayer[] playersRaw = players.getRawDataUnchecked();
|
||||
@@ -147,7 +147,7 @@ index 6985da233e41a62bea04277260f81b3ba200a415..58e79417e3722ce73cbbc1f9c74cbc73
|
||||
for (int i = 0, len = players.size(); i < len; ++i) {
|
||||
final ServerPlayer player = playersRaw[i];
|
||||
this.updatePlayer(player);
|
||||
@@ -1196,6 +1261,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1160,6 +1225,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,7 @@ index 6985da233e41a62bea04277260f81b3ba200a415..58e79417e3722ce73cbbc1f9c74cbc73
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1250,14 +1317,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1219,14 +1286,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}
|
||||
|
||||
public void broadcast(Packet<?> packet) {
|
||||
@@ -174,7 +174,7 @@ index 6985da233e41a62bea04277260f81b3ba200a415..58e79417e3722ce73cbbc1f9c74cbc73
|
||||
}
|
||||
|
||||
public void broadcastAndSend(Packet<?> packet) {
|
||||
@@ -1269,18 +1333,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1238,18 +1302,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}
|
||||
|
||||
public void broadcastRemoved() {
|
||||
@@ -197,7 +197,7 @@ index 6985da233e41a62bea04277260f81b3ba200a415..58e79417e3722ce73cbbc1f9c74cbc73
|
||||
if (this.seenBy.remove(player.connection)) {
|
||||
this.serverEntity.removePairing(player);
|
||||
}
|
||||
@@ -1288,8 +1349,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1257,8 +1318,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}
|
||||
|
||||
public void updatePlayer(ServerPlayer player) {
|
||||
@@ -224,10 +224,10 @@ index 4f91107f9ae42f96c060c310596db9aa869a8dbc..f9889f593ed144ee8f1f5bd380e631c6
|
||||
public boolean visible = true;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 05125144ce0cb50fa6ac769fa025cda010c93f14..189bfe0e97943f3f560fa3c2674013e2e833bd5e 100644
|
||||
index bea671ae16a90e9cb9d2f312eed3c816da05b23c..36026f9f4cad3930cd45918012bf54498f2de973 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -115,7 +115,13 @@ public class ServerEntity {
|
||||
@@ -119,7 +119,13 @@ public class ServerEntity {
|
||||
this.broadcastAndSend(new ClientboundSetPassengersPacket(this.entity)); // CraftBukkit
|
||||
ServerEntity.removedPassengers(list, this.lastPassengers).forEach((entity) -> {
|
||||
if (entity instanceof ServerPlayer entityplayer) {
|
||||
@@ -242,7 +242,7 @@ index 05125144ce0cb50fa6ac769fa025cda010c93f14..189bfe0e97943f3f560fa3c2674013e2
|
||||
}
|
||||
|
||||
});
|
||||
@@ -336,7 +342,11 @@ public class ServerEntity {
|
||||
@@ -374,7 +380,11 @@ public class ServerEntity {
|
||||
|
||||
public void removePairing(ServerPlayer player) {
|
||||
this.entity.stopSeenByPlayer(player);
|
||||
@@ -255,7 +255,7 @@ index 05125144ce0cb50fa6ac769fa025cda010c93f14..189bfe0e97943f3f560fa3c2674013e2
|
||||
}
|
||||
|
||||
public void addPairing(ServerPlayer player) {
|
||||
@@ -344,7 +354,11 @@ public class ServerEntity {
|
||||
@@ -382,7 +392,11 @@ public class ServerEntity {
|
||||
|
||||
Objects.requireNonNull(list);
|
||||
this.sendPairingData(player, list::add);
|
||||
@@ -268,7 +268,7 @@ index 05125144ce0cb50fa6ac769fa025cda010c93f14..189bfe0e97943f3f560fa3c2674013e2
|
||||
this.entity.startSeenByPlayer(player);
|
||||
}
|
||||
|
||||
@@ -464,19 +478,28 @@ public class ServerEntity {
|
||||
@@ -502,19 +516,28 @@ public class ServerEntity {
|
||||
|
||||
if (list != null) {
|
||||
this.trackedDataValues = datawatcher.getNonDefaultValues();
|
||||
@@ -301,10 +301,10 @@ index 05125144ce0cb50fa6ac769fa025cda010c93f14..189bfe0e97943f3f560fa3c2674013e2
|
||||
|
||||
set.clear();
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 0874d1da44c82c87a8061233f1ed089ee0e0179d..6d8fb4fe9733bd1e83af7f8c148bdb54fa26a14b 100644
|
||||
index 9a7a76599a44dfd51d5e9e9a0e892994528c7680..4a92789d77313e165ab1252cd469e34a8b7eb575 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2398,7 +2398,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
@@ -2561,7 +2561,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
|
||||
@Override
|
||||
public LevelEntityGetter<Entity> getEntities() {
|
||||
@@ -314,20 +314,20 @@ index 0874d1da44c82c87a8061233f1ed089ee0e0179d..6d8fb4fe9733bd1e83af7f8c148bdb54
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 82b885a6037afa35da76997d9eab6fe3390df5c2..e0962547709d6951cc98da94f028bd4d5b7b25dd 100644
|
||||
index 0684a8e9e0d91c1724d1e066daa71030bba70904..dd6174a4b695bdaa2229a21c9680e757c6869755 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1811,7 +1811,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -1833,7 +1833,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
}
|
||||
|
||||
public void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<RelativeMovement> set) { // Paper
|
||||
public void internalTeleport(PositionMoveRotation positionmoverotation, Set<Relative> set) {
|
||||
- org.spigotmc.AsyncCatcher.catchOp("teleport"); // Paper
|
||||
+ //org.spigotmc.AsyncCatcher.catchOp("teleport"); // Paper // Leaf - Multithreaded tracker
|
||||
// Paper start - Prevent teleporting dead entities
|
||||
if (player.isRemoved()) {
|
||||
LOGGER.info("Attempt to teleport removed player {} restricted", player.getScoreboardName());
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeInstance.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeInstance.java
|
||||
index d28f9e077a50122e86848cfa9db83f6b0e8eef6c..3b717cc52c68994e26a389579ec02640ae526f0d 100644
|
||||
index 27a7852a5d3f8c8960f098646ff5587c50556aa5..f492a3d58e43c1ef9ef6652b40d894874471abd3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeInstance.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeInstance.java
|
||||
@@ -24,8 +24,11 @@ public class AttributeInstance {
|
||||
@@ -345,7 +345,7 @@ index d28f9e077a50122e86848cfa9db83f6b0e8eef6c..3b717cc52c68994e26a389579ec02640
|
||||
private boolean dirty = true;
|
||||
private double cachedValue;
|
||||
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 14ceb3308474e76220bd64b0254df3f2925d4206..6cd45791b19df76e367d2693bce349c66def65d8 100644
|
||||
index 7bc3a6f4dabc6411b6ff17e6dbbd190d57076cd1..4d060255d1446e65214f75fc5d03cabd4fb00576 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
|
||||
@@ -19,11 +19,14 @@ import org.slf4j.Logger;
|
||||
@@ -368,10 +368,10 @@ index 14ceb3308474e76220bd64b0254df3f2925d4206..6cd45791b19df76e367d2693bce349c6
|
||||
private final net.minecraft.world.entity.LivingEntity entity; // Purpur
|
||||
diff --git a/src/main/java/org/dreeam/leaf/async/tracker/MultithreadedTracker.java b/src/main/java/org/dreeam/leaf/async/tracker/MultithreadedTracker.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4f214a8f058434cb7f4930df75fc3d0f310878ae
|
||||
index 0000000000000000000000000000000000000000..1e7377c4f7c21300f4eba738d8f12e24004cb8b1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/dreeam/leaf/async/tracker/MultithreadedTracker.java
|
||||
@@ -0,0 +1,182 @@
|
||||
@@ -0,0 +1,140 @@
|
||||
+package org.dreeam.leaf.async.tracker;
|
||||
+
|
||||
+import ca.spottedleaf.moonrise.common.list.ReferenceList;
|
||||
@@ -382,12 +382,12 @@ index 0000000000000000000000000000000000000000..4f214a8f058434cb7f4930df75fc3d0f
|
||||
+import ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerTrackedEntity;
|
||||
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
+import net.minecraft.server.level.ChunkMap;
|
||||
+import net.minecraft.server.level.FullChunkStatus;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
+import net.minecraft.world.entity.Entity;
|
||||
+import org.apache.logging.log4j.LogManager;
|
||||
+import org.apache.logging.log4j.Logger;
|
||||
+
|
||||
+import java.util.Arrays;
|
||||
+import java.util.concurrent.Executor;
|
||||
+import java.util.concurrent.LinkedBlockingQueue;
|
||||
+import java.util.concurrent.ThreadPoolExecutor;
|
||||
@@ -459,22 +459,6 @@ index 0000000000000000000000000000000000000000..4f214a8f058434cb7f4930df75fc3d0f
|
||||
+ tracker.serverEntity.sendChanges();
|
||||
+ }
|
||||
+ });
|
||||
+
|
||||
+ // process unloads
|
||||
+ final ReferenceList<Entity> unloadedEntities = entityLookup.trackerUnloadedEntities;
|
||||
+ final Entity[] unloadedEntitiesRaw = Arrays.copyOf(unloadedEntities.getRawDataUnchecked(), unloadedEntities.size());
|
||||
+ unloadedEntities.clear();
|
||||
+
|
||||
+ // Move player unload to off-main
|
||||
+ trackerExecutor.execute(() -> {
|
||||
+ for (final Entity entity : unloadedEntitiesRaw) {
|
||||
+ final ChunkMap.TrackedEntity tracker = ((EntityTrackerEntity) entity).moonrise$getTrackedEntity();
|
||||
+
|
||||
+ if (tracker == null) continue;
|
||||
+
|
||||
+ ((EntityTrackerTrackedEntity) tracker).moonrise$clearPlayers();
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
+ private static void tickAsyncWithCompatMode(ChunkSystemServerLevel level) {
|
||||
@@ -505,27 +489,11 @@ index 0000000000000000000000000000000000000000..4f214a8f058434cb7f4930df75fc3d0f
|
||||
+ sendChanges.run();
|
||||
+ }
|
||||
+ });
|
||||
+
|
||||
+ // process unloads
|
||||
+ final ReferenceList<Entity> unloadedEntities = entityLookup.trackerUnloadedEntities;
|
||||
+ final Entity[] unloadedEntitiesRaw = Arrays.copyOf(unloadedEntities.getRawDataUnchecked(), unloadedEntities.size());
|
||||
+ unloadedEntities.clear();
|
||||
+
|
||||
+ trackerExecutor.execute(() -> {
|
||||
+ for (final Entity entity : unloadedEntitiesRaw) {
|
||||
+ final ChunkMap.TrackedEntity tracker = ((EntityTrackerEntity) entity).moonrise$getTrackedEntity();
|
||||
+
|
||||
+ if (tracker == null) continue;
|
||||
+
|
||||
+ ((EntityTrackerTrackedEntity) tracker).moonrise$clearPlayers();
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
+ // Original ChunkMap#newTrackerTick of Paper
|
||||
+ // Just for diff usage for future update
|
||||
+ private static void tickOriginal(ServerLevel level) {
|
||||
+ final ca.spottedleaf.moonrise.common.misc.NearbyPlayers nearbyPlayers = ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel) level).moonrise$getNearbyPlayers();
|
||||
+ final ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup entityLookup = (ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup) ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel) level).moonrise$getEntityLookup();
|
||||
+
|
||||
+ final ca.spottedleaf.moonrise.common.list.ReferenceList<net.minecraft.world.entity.Entity> trackerEntities = entityLookup.trackerEntities;
|
||||
@@ -536,21 +504,11 @@ index 0000000000000000000000000000000000000000..4f214a8f058434cb7f4930df75fc3d0f
|
||||
+ if (tracker == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ ((ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerTrackedEntity) tracker).moonrise$tick(nearbyPlayers.getChunk(entity.chunkPosition()));
|
||||
+ ((ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerTrackedEntity) tracker).moonrise$tick(((ca.spottedleaf.moonrise.patches.chunk_system.entity.ChunkSystemEntity) entity).moonrise$getChunkData().nearbyPlayers);
|
||||
+ if (((ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerTrackedEntity) tracker).moonrise$hasPlayers()
|
||||
+ || ((ca.spottedleaf.moonrise.patches.chunk_system.entity.ChunkSystemEntity) entity).moonrise$getChunkStatus().isOrAfter(FullChunkStatus.ENTITY_TICKING)) {
|
||||
+ tracker.serverEntity.sendChanges();
|
||||
+ }
|
||||
+
|
||||
+ // process unloads
|
||||
+ final ca.spottedleaf.moonrise.common.list.ReferenceList<net.minecraft.world.entity.Entity> unloadedEntities = entityLookup.trackerUnloadedEntities;
|
||||
+ final Entity[] unloadedEntitiesRaw = java.util.Arrays.copyOf(unloadedEntities.getRawDataUnchecked(), unloadedEntities.size());
|
||||
+ unloadedEntities.clear();
|
||||
+
|
||||
+ for (final Entity entity : unloadedEntitiesRaw) {
|
||||
+ final ChunkMap.TrackedEntity tracker = ((ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerEntity) entity).moonrise$getTrackedEntity();
|
||||
+ if (tracker == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ ((ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerTrackedEntity) tracker).moonrise$clearPlayers();
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
@@ -7,7 +7,7 @@ Original license: GPL v3
|
||||
Original project: https://github.com/Gensokyo-Reimagined/Nitori
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java b/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java
|
||||
index 85ba843ce7e1f62971e736fa2cc028c47b274ce4..7d018095f9cafbe727be41655742875bee2c028b 100644
|
||||
index cdca5ae69991cc068bfbc0686b5defb3604a5440..5ab705731209fd4d4c20cd342ee7bf1bf26f3b0c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java
|
||||
@@ -605,7 +605,11 @@ public class LevelStorageSource {
|
||||
@@ -56,7 +56,7 @@ index b148cf247acdd36f856d0495cde4cc5ad32b5a2f..e825d9e573a38531f5a3b3f9cdccc245
|
||||
Path path = this.playerDir.toPath();
|
||||
diff --git a/src/main/java/org/dreeam/leaf/async/AsyncPlayerDataSaving.java b/src/main/java/org/dreeam/leaf/async/AsyncPlayerDataSaving.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6f74ca2f5bdae24434255976ec24f28c4980ac17
|
||||
index 0000000000000000000000000000000000000000..b5e661cdb936c85c566b33d8645f84eb80f50d9d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/dreeam/leaf/async/AsyncPlayerDataSaving.java
|
||||
@@ -0,0 +1,23 @@
|
||||
@@ -79,7 +79,7 @@ index 0000000000000000000000000000000000000000..6f74ca2f5bdae24434255976ec24f28c
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ ExecutorService ioExecutor = Util.backgroundExecutor();
|
||||
+ ExecutorService ioExecutor = Util.backgroundExecutor().service();
|
||||
+ CompletableFuture.runAsync(runnable, ioExecutor);
|
||||
+ }
|
||||
+}
|
||||
@@ -10,10 +10,10 @@ TODO - Dreeam:
|
||||
- ...still testing lol
|
||||
|
||||
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 af0f7ce6efa799e6f5ea6d34250d462f51b1c4e3..7db0f22a22f6752380d62d4e53bc9481464e2233 100644
|
||||
index 8eed7d70d5716f6d58c46b31a526b5de2a891f16..baf50c2f50325c64951dc37b1d57076b4a9c5b99 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -348,7 +348,13 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -351,7 +351,13 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
private boolean isMergable() {
|
||||
ItemStack itemstack = this.getItem();
|
||||
|
||||
@@ -28,7 +28,7 @@ index af0f7ce6efa799e6f5ea6d34250d462f51b1c4e3..7db0f22a22f6752380d62d4e53bc9481
|
||||
}
|
||||
|
||||
private void tryToMerge(ItemEntity other) {
|
||||
@@ -366,11 +372,24 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -369,11 +375,24 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
}
|
||||
|
||||
public static boolean areMergable(ItemStack stack1, ItemStack stack2) {
|
||||
@@ -55,7 +55,7 @@ index af0f7ce6efa799e6f5ea6d34250d462f51b1c4e3..7db0f22a22f6752380d62d4e53bc9481
|
||||
ItemStack itemstack2 = stack1.copyWithCount(stack1.getCount() + j);
|
||||
|
||||
stack2.shrink(j);
|
||||
@@ -378,7 +397,14 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -381,7 +400,14 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
}
|
||||
|
||||
private static void merge(ItemEntity targetEntity, ItemStack stack1, ItemStack stack2) {
|
||||
@@ -72,7 +72,7 @@ index af0f7ce6efa799e6f5ea6d34250d462f51b1c4e3..7db0f22a22f6752380d62d4e53bc9481
|
||||
targetEntity.setItem(itemstack2);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemUtils.java b/src/main/java/net/minecraft/world/item/ItemUtils.java
|
||||
index 4901f0d89ae2472bce7f242d9529236674f5d134..127f41511cdcaacc00e0f128c20339f38c7ce733 100644
|
||||
index 0c4074ed8b4fd9d6fcb838e8843d66f6f286ed5d..4728dd8bcbfc514eb5beeee716d849e578d5a53e 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemUtils.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemUtils.java
|
||||
@@ -42,14 +42,32 @@ public class ItemUtils {
|
||||
@@ -5,51 +5,22 @@ Subject: [PATCH] Reduce object complexity to make block isValid calls more
|
||||
efficient
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index 4eab34f932ae564aa038cecf4426b9f74a513ee7..3b553138f7fb5f19aa303ec18317b8258f10ce7e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -109,6 +109,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
// Paper end
|
||||
@Nullable
|
||||
private String descriptionId;
|
||||
+ private int descriptionIdHash; // Leaf - Reduce object complexity to make block isValid calls more efficient
|
||||
@Nullable
|
||||
private Item item;
|
||||
private static final int CACHE_SIZE = 2048;
|
||||
@@ -481,6 +482,16 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
return this.descriptionId;
|
||||
}
|
||||
|
||||
+ // Leaf start - Reduce object complexity to make block isValid calls more efficient
|
||||
+ public int getDescriptionIdHash() {
|
||||
+ if (this.descriptionIdHash == 0) {
|
||||
+ this.descriptionIdHash = getDescriptionId().hashCode();
|
||||
+ }
|
||||
+
|
||||
+ return this.descriptionIdHash;
|
||||
+ }
|
||||
+ // Leaf end - Reduce object complexity to make block isValid calls more efficient
|
||||
+
|
||||
public void fallOn(Level world, BlockState state, BlockPos pos, Entity entity, float fallDistance) {
|
||||
entity.causeFallDamage(fallDistance * fallDistanceMultiplier, fallDamageMultiplier, entity.damageSources().fall()); // Purpur
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java
|
||||
index 96b99aab3720e5bdf293fd4a95944c7218ce43c0..0577b192853b591db49c9c77ae536492e0fb4888 100644
|
||||
index dea945a9b278353647dca3ed001158c198dab668..d3a82a012b8bbb9d4c6936dbb40a1994b21956cc 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java
|
||||
@@ -269,6 +269,7 @@ public class BlockEntityType<T extends BlockEntity> {
|
||||
public static final BlockEntityType<VaultBlockEntity> VAULT = register("vault", BlockEntityType.Builder.of(VaultBlockEntity::new, Blocks.VAULT));
|
||||
@@ -230,6 +230,7 @@ public class BlockEntityType<T extends BlockEntity> {
|
||||
public static final BlockEntityType<VaultBlockEntity> VAULT = register("vault", VaultBlockEntity::new, Blocks.VAULT);
|
||||
private final BlockEntityType.BlockEntitySupplier<? extends T> factory;
|
||||
public final Set<Block> validBlocks;
|
||||
+ public final it.unimi.dsi.fastutil.ints.IntOpenHashSet validBlocksByIdHash = new it.unimi.dsi.fastutil.ints.IntOpenHashSet(0); // Leaf - Reduce object complexity to make block isValid calls more efficient
|
||||
private final Type<?> dataType;
|
||||
private final Holder.Reference<BlockEntityType<?>> builtInRegistryHolder = BuiltInRegistries.BLOCK_ENTITY_TYPE.createIntrusiveHolder(this);
|
||||
|
||||
@@ -290,6 +291,13 @@ public class BlockEntityType<T extends BlockEntity> {
|
||||
@Nullable
|
||||
@@ -251,6 +252,13 @@ public class BlockEntityType<T extends BlockEntity> {
|
||||
private BlockEntityType(BlockEntityType.BlockEntitySupplier<? extends T> factory, Set<Block> blocks) {
|
||||
this.factory = factory;
|
||||
this.validBlocks = blocks;
|
||||
this.dataType = type;
|
||||
+
|
||||
+ // Leaf start - Reduce object complexity to make block isValid calls more efficient
|
||||
+ for (Block block : blocks) {
|
||||
@@ -60,7 +31,7 @@ index 96b99aab3720e5bdf293fd4a95944c7218ce43c0..0577b192853b591db49c9c77ae536492
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -301,6 +309,13 @@ public class BlockEntityType<T extends BlockEntity> {
|
||||
@@ -262,6 +270,13 @@ public class BlockEntityType<T extends BlockEntity> {
|
||||
return this.validBlocks.contains(state.getBlock());
|
||||
}
|
||||
|
||||
@@ -71,14 +42,47 @@ index 96b99aab3720e5bdf293fd4a95944c7218ce43c0..0577b192853b591db49c9c77ae536492
|
||||
+ }
|
||||
+ // Leaf end - Reduce object complexity to make block isValid calls more efficient
|
||||
+
|
||||
@Nullable
|
||||
@Deprecated
|
||||
public Holder.Reference<BlockEntityType<?>> builtInRegistryHolder() {
|
||||
return this.builtInRegistryHolder;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
index 9b94d8bf3415734776c81297d5d34eea46ad7e78..ca2b57d13128717ebb772dd6523d2909f12560cd 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
@@ -102,6 +102,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
public final BlockBehaviour.Properties properties; // Purpur - protected -> public
|
||||
protected final Optional<ResourceKey<LootTable>> drops;
|
||||
protected final String descriptionId;
|
||||
+ private final int descriptionIdHash; // Leaf - Reduce object complexity to make block isValid calls more efficient
|
||||
|
||||
public BlockBehaviour(BlockBehaviour.Properties settings) {
|
||||
this.hasCollision = settings.hasCollision;
|
||||
@@ -116,6 +117,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
this.dynamicShape = settings.dynamicShape;
|
||||
this.requiredFeatures = settings.requiredFeatures;
|
||||
this.properties = settings;
|
||||
+ this.descriptionIdHash = getDescriptionId().hashCode(); // Leaf - Reduce object complexity to make block isValid calls more efficient
|
||||
}
|
||||
|
||||
public BlockBehaviour.Properties properties() {
|
||||
@@ -371,6 +373,12 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
return this.descriptionId;
|
||||
}
|
||||
|
||||
+ // Leaf start - Reduce object complexity to make block isValid calls more efficient
|
||||
+ public int getDescriptionIdHash() {
|
||||
+ return this.descriptionIdHash;
|
||||
+ }
|
||||
+ // Leaf end - Reduce object complexity to make block isValid calls more efficient
|
||||
+
|
||||
protected void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) {}
|
||||
|
||||
protected boolean propagatesSkylightDown(BlockState state) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index 308fde6ec1df5dce8e6c323f0cb07a99451a086e..ae693e08434d251ee57b89d606d3cbd51288d496 100644
|
||||
index b8246d7255bffc7e12a67772df2ceac1925b2a05..06a969587f25748d4e29036e1b73ab8ff27fe12f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -1056,7 +1056,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
@@ -1092,7 +1092,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
try {
|
||||
BlockState iblockdata = LevelChunk.this.getBlockState(blockposition);
|
||||
|
||||
@@ -7,10 +7,10 @@ Use SpottedLeaf's nearby players system to avoid iterating over all online playe
|
||||
and reduce the cost on predicate test
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
||||
index fca917561944017e032ea39ffb22cbd2c89b9f51..b4a51c54eb6a93d107a45fb01c9a3c9ff9d9b3e9 100644
|
||||
index 59c4d3753c7084e92402608b7fb3c4adbc6c2f65..68b59afe54fa1dcc1b24e90fb0cdcff83d898232 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
||||
@@ -45,7 +45,7 @@ public final class EntitySelector {
|
||||
@@ -44,7 +44,7 @@ public final class EntitySelector {
|
||||
private EntitySelector() {}
|
||||
// Paper start - Affects Spawning API
|
||||
public static final Predicate<Entity> PLAYER_AFFECTS_SPAWNING = (entity) -> {
|
||||
@@ -20,20 +20,20 @@ index fca917561944017e032ea39ffb22cbd2c89b9f51..b4a51c54eb6a93d107a45fb01c9a3c9f
|
||||
// Paper end - Affects Spawning API
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
index 49c37853a0c26cef749a8a5ef4130554c0319ad9..776e0295f0ba38157cabdc7ab5d0a3f845bad158 100644
|
||||
index 6efb548b6e1b466628eb70bc45ef98d09604c9df..d053019e3a1fb2d15ad231e31f761d136dca8417 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
@@ -392,7 +392,7 @@ public class Zombie extends Monster {
|
||||
@@ -413,7 +413,7 @@ public class Zombie extends Monster {
|
||||
|
||||
if (SpawnPlacements.isSpawnPositionOk(entitytypes, this.level(), blockposition) && SpawnPlacements.checkSpawnRules(entitytypes, worldserver, MobSpawnType.REINFORCEMENT, blockposition, this.level().random)) {
|
||||
if (SpawnPlacements.isSpawnPositionOk(entitytypes, world, blockposition) && SpawnPlacements.checkSpawnRules(entitytypes, world, EntitySpawnReason.REINFORCEMENT, blockposition, world.random)) {
|
||||
entityzombie.setPos((double) i1, (double) j1, (double) k1);
|
||||
- if (!this.level().hasNearbyAlivePlayerThatAffectsSpawning((double) i1, (double) j1, (double) k1, 7.0D) && this.level().isUnobstructed(entityzombie) && this.level().noCollision((Entity) entityzombie) && !this.level().containsAnyLiquid(entityzombie.getBoundingBox())) { // Paper - Affects Spawning API
|
||||
+ if (!this.level().hasNearbyAlivePlayerThatAffectsSpawningForZombie(i1, j1, k1, 7.0D) && this.level().isUnobstructed(entityzombie) && this.level().noCollision((Entity) entityzombie) && !this.level().containsAnyLiquid(entityzombie.getBoundingBox())) { // Paper - Affects Spawning API // Leaf - Optimize nearby alive players for spawning
|
||||
- if (!world.hasNearbyAlivePlayerThatAffectsSpawning((double) i1, (double) j1, (double) k1, 7.0D) && world.isUnobstructed(entityzombie) && world.noCollision((Entity) entityzombie) && (entityzombie.canSpawnInLiquids() || !world.containsAnyLiquid(entityzombie.getBoundingBox()))) { // Paper - affects spawning api
|
||||
+ if (!world.hasNearbyAlivePlayerThatAffectsSpawningForZombie(i1, j1, k1, 7.0D) && world.isUnobstructed(entityzombie) && world.noCollision((Entity) entityzombie) && (entityzombie.canSpawnInLiquids() || !world.containsAnyLiquid(entityzombie.getBoundingBox()))) { // Paper - affects spawning api // Leaf - Optimize nearby alive players for spawning
|
||||
entityzombie.setTarget(entityliving, EntityTargetEvent.TargetReason.REINFORCEMENT_TARGET, true); // CraftBukkit
|
||||
entityzombie.finalizeSpawn(worldserver, this.level().getCurrentDifficultyAt(entityzombie.blockPosition()), MobSpawnType.REINFORCEMENT, (SpawnGroupData) null);
|
||||
worldserver.addFreshEntityWithPassengers(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
|
||||
entityzombie.finalizeSpawn(world, world.getCurrentDifficultyAt(entityzombie.blockPosition()), EntitySpawnReason.REINFORCEMENT, (SpawnGroupData) null);
|
||||
world.addFreshEntityWithPassengers(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
|
||||
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
index e7fafb3f919a7275212896c65a6eff682427ee34..5939b85ef3a2eab9def80ed5d9419df8db7a3173 100644
|
||||
index b23397ae135f31abb7ac6bafd9064d7ef5e94218..37c98981c71b73daa078c49319e124c20628fcc8 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
@@ -60,7 +60,7 @@ public abstract class BaseSpawner {
|
||||
@@ -46,10 +46,10 @@ index e7fafb3f919a7275212896c65a6eff682427ee34..5939b85ef3a2eab9def80ed5d9419df8
|
||||
|
||||
public void clientTick(Level world, BlockPos pos) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java
|
||||
index d5d2a6467b48bcf8e5322dd5938f6e4fb37ca467..d654059a52c269e0c7cb1fa4b3fa769a2bc32cf9 100644
|
||||
index 6b2cda6d578a0983b2401ea20629275431018433..47f80547a4f2285dc097c6f73954419848cfe895 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/EntityGetter.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/EntityGetter.java
|
||||
@@ -183,6 +183,89 @@ public interface EntityGetter extends ca.spottedleaf.moonrise.patches.chunk_syst
|
||||
@@ -180,6 +180,89 @@ public interface EntityGetter extends ca.spottedleaf.moonrise.patches.chunk_syst
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Cache blockstate cache
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
index cdaa5a8af0c6a8a78e587141b9ab1c84766589e9..de299465937074a1067a6adfc208eaaa24bcae67 100644
|
||||
index ca2b57d13128717ebb772dd6523d2909f12560cd..cabb4b79248725ea8f831d5f1b27902c3c9ea262 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
@@ -1379,6 +1379,10 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
@@ -1446,6 +1446,10 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
|
||||
private static final Direction[] DIRECTIONS = Direction.values();
|
||||
private static final int SUPPORT_TYPE_COUNT = SupportType.values().length;
|
||||
@@ -16,10 +16,10 @@ index cdaa5a8af0c6a8a78e587141b9ab1c84766589e9..de299465937074a1067a6adfc208eaaa
|
||||
+ private static final SupportType[] SUPPORT_TYPE_VALUES = SupportType.values();
|
||||
+ private static final Direction.Axis[] DIRECTION_AXIS_VALUES = Direction.Axis.values();
|
||||
+ // Leaf end - Cache blockstate cache array
|
||||
protected final boolean solidRender;
|
||||
final boolean propagatesSkylightDown;
|
||||
final int lightBlock;
|
||||
@@ -1418,7 +1422,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
protected final VoxelShape collisionShape;
|
||||
protected boolean largeCollisionShape; // Leaf - not final
|
||||
private final boolean[] faceSturdy;
|
||||
@@ -1459,7 +1463,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
throw new IllegalStateException(String.format(Locale.ROOT, "%s has a collision shape and an offset type, but is not marked as dynamicShape in its properties.", BuiltInRegistries.BLOCK.getKey(block)));
|
||||
} else {
|
||||
// Leaf start - Remove stream
|
||||
@@ -28,12 +28,12 @@ index cdaa5a8af0c6a8a78e587141b9ab1c84766589e9..de299465937074a1067a6adfc208eaaa
|
||||
if (this.collisionShape.min(axis) < 0.0D || this.collisionShape.max(axis) > 1.0D) {
|
||||
this.largeCollisionShape = true;
|
||||
break;
|
||||
@@ -1431,7 +1435,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
@@ -1472,7 +1476,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
|
||||
for (i = 0; i < k; ++i) {
|
||||
Direction enumdirection1 = aenumdirection1[i];
|
||||
for (int j = 0; j < i; ++j) {
|
||||
Direction enumdirection = aenumdirection[j];
|
||||
- SupportType[] aenumblocksupport = SupportType.values();
|
||||
+ SupportType[] aenumblocksupport = SUPPORT_TYPE_VALUES; // Leaf - Cache blockstate cache array
|
||||
int l = aenumblocksupport.length;
|
||||
int k = aenumblocksupport.length;
|
||||
|
||||
for (int i1 = 0; i1 < l; ++i1) {
|
||||
for (int l = 0; l < k; ++l) {
|
||||
@@ -7,17 +7,21 @@ Original license: MIT
|
||||
Original project: https://github.com/thebrightspark/AsyncLocator
|
||||
|
||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
|
||||
index 11b7f15755dde766140c29bedca456c80d53293f..749d00449ac3f3c79bfc73a5517ea3a07675e447 100644
|
||||
index 217d1f908a36a5177ba3cbb80a33f73d4dab0fa0..da658e24ad6e10d6ce55cebf944871d3cbde7f4a 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
|
||||
@@ -80,7 +80,7 @@ public class TickThread extends Thread {
|
||||
this(run, name, ID_GENERATOR.incrementAndGet());
|
||||
@@ -80,6 +80,12 @@ public class TickThread extends Thread {
|
||||
this(null, run, name);
|
||||
}
|
||||
|
||||
- private TickThread(final Runnable run, final String name, final int id) {
|
||||
+ protected TickThread(final Runnable run, final String name, final int id) { // Leaf - private -> protected
|
||||
super(run, name);
|
||||
this.id = id;
|
||||
+ // Leaf start - Async locator
|
||||
+ public TickThread(final Runnable run, final String name, final int id) {
|
||||
+ this(null, run, name, id);
|
||||
+ }
|
||||
+ // Leaf end - Async locator
|
||||
+
|
||||
public TickThread(final ThreadGroup group, final Runnable run, final String name) {
|
||||
this(group, run, name, ID_GENERATOR.incrementAndGet());
|
||||
}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
||||
index 6676be8304e9415099ed423d3315180cafebd928..30b56382e9574004e344c1c8289d7dcbb177386b 100644
|
||||
@@ -37,10 +41,10 @@ index 6676be8304e9415099ed423d3315180cafebd928..30b56382e9574004e344c1c8289d7dcb
|
||||
}
|
||||
// Leaves start - skip photographer
|
||||
diff --git a/src/main/java/net/minecraft/server/commands/LocateCommand.java b/src/main/java/net/minecraft/server/commands/LocateCommand.java
|
||||
index 39f5deea47d8f573c3cfec5df431216ee806c32c..51994f272737f8754aac41dc0c55f43f45617519 100644
|
||||
index dcdde4cd7f15d34eabba4b3802971db20e6ae9d2..e33f31ae83edc4e04ad1f3fa3216b90219d902dc 100644
|
||||
--- a/src/main/java/net/minecraft/server/commands/LocateCommand.java
|
||||
+++ b/src/main/java/net/minecraft/server/commands/LocateCommand.java
|
||||
@@ -106,6 +106,37 @@ public class LocateCommand {
|
||||
@@ -105,6 +105,37 @@ public class LocateCommand {
|
||||
BlockPos blockPos = BlockPos.containing(source.getPosition());
|
||||
ServerLevel serverLevel = source.getLevel();
|
||||
Stopwatch stopwatch = Stopwatch.createStarted(Util.TICKER);
|
||||
@@ -79,10 +83,10 @@ index 39f5deea47d8f573c3cfec5df431216ee806c32c..51994f272737f8754aac41dc0c55f43f
|
||||
.getGenerator()
|
||||
.findNearestMapStructure(serverLevel, holderSet, blockPos, 100, false);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||
index ef0124ceb7cafd58c01c7f0b4b542f38a383ab88..061d020c08b722b92187ba9042ab4084ecd72b06 100644
|
||||
index c1842894f96a567707992d8ff938dbf689dd0df6..0792629152937b5107dbf444ce7f67e747f30c10 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||
@@ -466,6 +466,8 @@ public class Dolphin extends WaterAnimal {
|
||||
@@ -494,6 +494,8 @@ public class Dolphin extends AgeableWaterCreature {
|
||||
|
||||
private final Dolphin dolphin;
|
||||
private boolean stuck;
|
||||
@@ -91,7 +95,7 @@ index ef0124ceb7cafd58c01c7f0b4b542f38a383ab88..061d020c08b722b92187ba9042ab4084
|
||||
|
||||
DolphinSwimToTreasureGoal(Dolphin dolphin) {
|
||||
this.dolphin = dolphin;
|
||||
@@ -485,6 +487,11 @@ public class Dolphin extends WaterAnimal {
|
||||
@@ -513,6 +515,11 @@ public class Dolphin extends AgeableWaterCreature {
|
||||
|
||||
@Override
|
||||
public boolean canContinueToUse() {
|
||||
@@ -103,7 +107,7 @@ index ef0124ceb7cafd58c01c7f0b4b542f38a383ab88..061d020c08b722b92187ba9042ab4084
|
||||
BlockPos blockposition = this.dolphin.getTreasurePos();
|
||||
|
||||
return !BlockPos.containing((double) blockposition.getX(), this.dolphin.getY(), (double) blockposition.getZ()).closerToCenterThan(this.dolphin.position(), 4.0D) && !this.stuck && this.dolphin.getAirSupply() >= 100;
|
||||
@@ -498,6 +505,21 @@ public class Dolphin extends WaterAnimal {
|
||||
@@ -526,6 +533,21 @@ public class Dolphin extends AgeableWaterCreature {
|
||||
this.stuck = false;
|
||||
this.dolphin.getNavigation().stop();
|
||||
BlockPos blockposition = this.dolphin.blockPosition();
|
||||
@@ -125,7 +129,7 @@ index ef0124ceb7cafd58c01c7f0b4b542f38a383ab88..061d020c08b722b92187ba9042ab4084
|
||||
BlockPos blockposition1 = worldserver.findNearestMapStructure(StructureTags.DOLPHIN_LOCATED, blockposition, 50, false);
|
||||
|
||||
if (blockposition1 != null) {
|
||||
@@ -511,6 +533,12 @@ public class Dolphin extends WaterAnimal {
|
||||
@@ -539,6 +561,12 @@ public class Dolphin extends AgeableWaterCreature {
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
@@ -138,7 +142,7 @@ index ef0124ceb7cafd58c01c7f0b4b542f38a383ab88..061d020c08b722b92187ba9042ab4084
|
||||
BlockPos blockposition = this.dolphin.getTreasurePos();
|
||||
|
||||
if (BlockPos.containing((double) blockposition.getX(), this.dolphin.getY(), (double) blockposition.getZ()).closerToCenterThan(this.dolphin.position(), 4.0D) || this.stuck) {
|
||||
@@ -521,6 +549,11 @@ public class Dolphin extends WaterAnimal {
|
||||
@@ -549,6 +577,11 @@ public class Dolphin extends AgeableWaterCreature {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
@@ -151,10 +155,10 @@ index ef0124ceb7cafd58c01c7f0b4b542f38a383ab88..061d020c08b722b92187ba9042ab4084
|
||||
|
||||
if (this.dolphin.closeToNextPos() || this.dolphin.getNavigation().isDone()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java b/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java
|
||||
index fca3786d0a3f99a3e61e7a4b2251361276eff9d7..cb4ff1e98418c651ef21f04f3c74cac7065031ae 100644
|
||||
index fd1f5de7dc151dfd187d23e022b2c5435ed8accc..35037b0d7d243d614aa6945330ae7186a6f20af5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java
|
||||
@@ -27,6 +27,7 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
|
||||
@@ -30,6 +30,7 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
|
||||
public double tz;
|
||||
public int life;
|
||||
public boolean surviveAfterDeath;
|
||||
@@ -162,7 +166,7 @@ index fca3786d0a3f99a3e61e7a4b2251361276eff9d7..cb4ff1e98418c651ef21f04f3c74cac7
|
||||
|
||||
public EyeOfEnder(EntityType<? extends EyeOfEnder> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -114,6 +115,11 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
|
||||
@@ -121,6 +122,11 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
@@ -175,10 +179,10 @@ index fca3786d0a3f99a3e61e7a4b2251361276eff9d7..cb4ff1e98418c651ef21f04f3c74cac7
|
||||
double d0 = this.getX() + vec3d.x;
|
||||
double d1 = this.getY() + vec3d.y;
|
||||
diff --git a/src/main/java/net/minecraft/world/item/EnderEyeItem.java b/src/main/java/net/minecraft/world/item/EnderEyeItem.java
|
||||
index d8ce44a180f848f4c9c04967470c4359af979b2f..90abb83a6baa60bbcbedc7d818c3bc9f4317f04f 100644
|
||||
index c71a426c47e0ebc57ecb8c9c1d171737a084ccab..0edd6efc7a6dc7f62f07691fdd73fbb212c82173 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java
|
||||
@@ -113,20 +113,54 @@ public class EnderEyeItem extends Item {
|
||||
@@ -113,7 +113,14 @@ public class EnderEyeItem extends Item {
|
||||
user.startUsingItem(hand);
|
||||
if (world instanceof ServerLevel) {
|
||||
ServerLevel worldserver = (ServerLevel) world;
|
||||
@@ -192,7 +196,10 @@ index d8ce44a180f848f4c9c04967470c4359af979b2f..90abb83a6baa60bbcbedc7d818c3bc9f
|
||||
+ }
|
||||
+ // Leaf end - Async locator
|
||||
|
||||
if (blockposition != null) {
|
||||
if (blockposition == null) {
|
||||
return InteractionResult.CONSUME;
|
||||
@@ -121,8 +128,35 @@ public class EnderEyeItem extends Item {
|
||||
|
||||
EyeOfEnder entityendersignal = new EyeOfEnder(world, user.getX(), user.getY(0.5D), user.getZ());
|
||||
|
||||
+ // Leaf start - Async locator
|
||||
@@ -228,15 +235,7 @@ index d8ce44a180f848f4c9c04967470c4359af979b2f..90abb83a6baa60bbcbedc7d818c3bc9f
|
||||
world.gameEvent((Holder) GameEvent.PROJECTILE_SHOOT, entityendersignal.position(), GameEvent.Context.of((Entity) user));
|
||||
// CraftBukkit start
|
||||
if (!world.addFreshEntity(entityendersignal)) {
|
||||
return new InteractionResultHolder(InteractionResult.FAIL, itemstack);
|
||||
}
|
||||
// CraftBukkit end
|
||||
- if (user instanceof ServerPlayer) {
|
||||
+ if (!isAsyncLocatorEnabled && user instanceof ServerPlayer) { // Leaf - Async locator
|
||||
ServerPlayer entityplayer = (ServerPlayer) user;
|
||||
|
||||
CriteriaTriggers.USED_ENDER_EYE.trigger(entityplayer, blockposition);
|
||||
@@ -136,7 +170,11 @@ public class EnderEyeItem extends Item {
|
||||
@@ -139,7 +173,11 @@ public class EnderEyeItem extends Item {
|
||||
|
||||
world.playSound((Player) null, user.getX(), user.getY(), user.getZ(), SoundEvents.ENDER_EYE_LAUNCH, SoundSource.NEUTRAL, 1.0F, f);
|
||||
itemstack.consume(1, user);
|
||||
@@ -246,9 +245,9 @@ index d8ce44a180f848f4c9c04967470c4359af979b2f..90abb83a6baa60bbcbedc7d818c3bc9f
|
||||
+ user.awardStat(Stats.ITEM_USED.get(this));
|
||||
+ }
|
||||
+ // Leaf end - Async locator
|
||||
user.swing(hand, true);
|
||||
return InteractionResultHolder.success(itemstack);
|
||||
}
|
||||
|
||||
return InteractionResult.SUCCESS_SERVER;
|
||||
diff --git a/src/main/java/org/dreeam/leaf/async/locate/AsyncLocator.java b/src/main/java/org/dreeam/leaf/async/locate/AsyncLocator.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..fcede5af1f1352a8c8c089993040838d1e7c3042
|
||||
@@ -13,10 +13,10 @@ This offers a 10~15% performance improvement in average.
|
||||
In best situation, this can give an up to 50% improvement.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
|
||||
index 5a059e1ec232d82e8e891ae78fea962bec2f878e..7cb18a2191a4b520ee81230106045d18faa384ee 100644
|
||||
index 23494aebfa51e7181fb06d123dad429e68ebf922..a5e85005ba9a1d85084c8e54124df9e4227e5273 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
|
||||
@@ -12,16 +12,77 @@ import net.minecraft.world.entity.ai.memory.NearestVisibleLivingEntities;
|
||||
@@ -13,17 +13,78 @@ import net.minecraft.world.entity.ai.memory.NearestVisibleLivingEntities;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
|
||||
public class NearestLivingEntitySensor<T extends LivingEntity> extends Sensor<T> {
|
||||
@@ -26,7 +26,8 @@ index 5a059e1ec232d82e8e891ae78fea962bec2f878e..7cb18a2191a4b520ee81230106045d18
|
||||
+ // Leaf end - Smart sort entities in NearestLivingEntitySensor
|
||||
@Override
|
||||
protected void doTick(ServerLevel world, T entity) {
|
||||
AABB aABB = entity.getBoundingBox().inflate((double)this.radiusXZ(), (double)this.radiusY(), (double)this.radiusXZ());
|
||||
double d = entity.getAttributeValue(Attributes.FOLLOW_RANGE);
|
||||
AABB aABB = entity.getBoundingBox().inflate(d, d, d);
|
||||
List<LivingEntity> list = world.getEntitiesOfClass(LivingEntity.class, aABB, e -> e != entity && e.isAlive());
|
||||
- list.sort(Comparator.comparingDouble(entity::distanceToSqr));
|
||||
+ // Leaf start - Smart sort entities in NearestLivingEntitySensor
|
||||
@@ -35,10 +36,10 @@ index 5a059e1ec232d82e8e891ae78fea962bec2f878e..7cb18a2191a4b520ee81230106045d18
|
||||
+ // Leaf end - Smart sort entities in NearestLivingEntitySensor
|
||||
Brain<?> brain = entity.getBrain();
|
||||
- brain.setMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES, list);
|
||||
- brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, new NearestVisibleLivingEntities(entity, list));
|
||||
- brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, new NearestVisibleLivingEntities(world, entity, list));
|
||||
+ // Leaf start - Smart sort entities in NearestLivingEntitySensor
|
||||
+ brain.setMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES, sortedList);
|
||||
+ brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, new NearestVisibleLivingEntities(entity, sortedList));
|
||||
+ brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, new NearestVisibleLivingEntities(world, entity, sortedList));
|
||||
+ // Leaf end - Smart sort entities in NearestLivingEntitySensor
|
||||
}
|
||||
|
||||
@@ -94,6 +95,6 @@ index 5a059e1ec232d82e8e891ae78fea962bec2f878e..7cb18a2191a4b520ee81230106045d18
|
||||
+ }
|
||||
+ // Leaf end - Smart sort entities in NearestLivingEntitySensor
|
||||
+
|
||||
protected int radiusXZ() {
|
||||
return 16;
|
||||
}
|
||||
@Override
|
||||
public Set<MemoryModuleType<?>> requires() {
|
||||
return ImmutableSet.of(MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES);
|
||||
@@ -8,11 +8,11 @@ avoids multiple casting in Entity#distanceTo, using Math#sqrt directly instead o
|
||||
these methods more able to be inlined by the JIT compiler.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index c4965b7582edfdf97cac82c1472f8fcc1a880a6b..d55560a12be8846db7c0969f5e72f3d79bf0d9c4 100644
|
||||
index 4683482bf8a6b3e0bc7837d199dcba8ace43c6e1..c01851dda58fcee26516c512882b81f6bc19ccf9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2370,33 +2370,41 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.xRotO = this.getXRot();
|
||||
@@ -2311,33 +2311,41 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return new Vec3(this.xOld, this.yOld, this.zOld);
|
||||
}
|
||||
|
||||
- public float distanceTo(Entity entity) {
|
||||
@@ -69,7 +69,7 @@ index c4965b7582edfdf97cac82c1472f8fcc1a880a6b..d55560a12be8846db7c0969f5e72f3d7
|
||||
public void playerTouch(Player player) {}
|
||||
|
||||
diff --git a/src/main/java/org/dreeam/leaf/LeafBootstrap.java b/src/main/java/org/dreeam/leaf/LeafBootstrap.java
|
||||
index 0052062cdfcb7672bec177c3d3788f7b1a56d3e5..fbfcb237996674c26d2eff0075c1aa8a447ad2a4 100644
|
||||
index 316654051b80ac0fd62cf3b7a0e1b91010ec24b7..0ffa8fb14d02bccc44685ece8cb9d128bfaec405 100644
|
||||
--- a/src/main/java/org/dreeam/leaf/LeafBootstrap.java
|
||||
+++ b/src/main/java/org/dreeam/leaf/LeafBootstrap.java
|
||||
@@ -4,6 +4,7 @@ import io.papermc.paper.PaperBootstrap;
|
||||
@@ -9,10 +9,10 @@ Original project: https://github.com/starlis/empirecraft
|
||||
Also see Leaf's EMC-Default-don-t-use-blockstate-snapshots.patch
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
index 73c9f91457683e8e6bd8293b4393ccbd984eddb7..7b38835bdac33dce9ed7ca1c0b3d43fdc2224d0c 100644
|
||||
index eaa6ece956f90632831f0558924eaf18680a252b..8a20b0ef9ea684a4a5e79b42f11834e3fe78b4fd 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
@@ -398,7 +398,7 @@ public abstract class BlockEntity {
|
||||
@@ -399,7 +399,7 @@ public abstract class BlockEntity {
|
||||
// CraftBukkit start - add method
|
||||
public InventoryHolder getOwner() {
|
||||
// Paper start
|
||||
@@ -7,7 +7,7 @@ Original license: MIT
|
||||
Original project: https://github.com/starlis/empirecraft
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
index ac11f18690434922179b61ffcc3036dea025b0cb..72d30afa4c03aa82329f321a3a3ddd507cf94502 100644
|
||||
index 5cb69d0b822e11a99a96aef4f59986d083b079f4..e9d43d9c4ad7cc1e12880e671f42e32dda85f17b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -331,7 +331,7 @@ public class CraftBlock implements Block {
|
||||
@@ -20,10 +20,10 @@ index ac11f18690434922179b61ffcc3036dea025b0cb..72d30afa4c03aa82329f321a3a3ddd50
|
||||
|
||||
// Paper start
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
|
||||
index b7ff7af2513204b151340538d50a65c850bdb75f..836fe576a0250a3b002e91b8587935f3e83e5fd6 100644
|
||||
index 56453454cbd4b9e9270fc833f8ab38d5fa7a3763..99f9335e6e36bb97710b30135648c9dbf72d833b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
|
||||
@@ -236,7 +236,7 @@ public final class CraftBlockStates {
|
||||
@@ -238,7 +238,7 @@ public final class CraftBlockStates {
|
||||
|
||||
public static BlockState getBlockState(Block block) {
|
||||
// Paper start
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Cache tile entity position
|
||||
Check if there is a way to cache isRemoved without problem
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index ae693e08434d251ee57b89d606d3cbd51288d496..61d6f80af62fcc48c16def1905cc57c417fe90a4 100644
|
||||
index 06a969587f25748d4e29036e1b73ab8ff27fe12f..2d4650b8c6b2d51df7eb70b08b9a12caee6458a5 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -1002,13 +1002,16 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
@@ -1038,13 +1038,16 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
private class RebindableTickingBlockEntityWrapper implements TickingBlockEntity {
|
||||
|
||||
private TickingBlockEntity ticker;
|
||||
@@ -26,7 +26,7 @@ index ae693e08434d251ee57b89d606d3cbd51288d496..61d6f80af62fcc48c16def1905cc57c4
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1023,7 +1026,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
@@ -1059,7 +1062,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
|
||||
@Override
|
||||
public BlockPos getPos() {
|
||||
@@ -35,7 +35,7 @@ index ae693e08434d251ee57b89d606d3cbd51288d496..61d6f80af62fcc48c16def1905cc57c4
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1041,10 +1044,12 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
@@ -1077,10 +1080,12 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
private final T blockEntity;
|
||||
private final BlockEntityTicker<T> ticker;
|
||||
private boolean loggedInvalidBlockState;
|
||||
@@ -48,7 +48,7 @@ index ae693e08434d251ee57b89d606d3cbd51288d496..61d6f80af62fcc48c16def1905cc57c4
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1088,7 +1093,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
@@ -1126,7 +1131,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
|
||||
@Override
|
||||
public BlockPos getPos() {
|
||||
@@ -7,13 +7,14 @@ Original license: AGPL-3.0
|
||||
Original project: https://github.com/snackbag/TT20
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 9dce5c34f67799285ee395a9c5d0db5ee6319536..6b9b3d366343a0bef76036b2b150691787f93db6 100644
|
||||
index 244db7e0ae0eb785deb94558eff74714d979d3de..59d5b758471fc00b09ecf84dc1757f543866d480 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1627,6 +1627,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1668,6 +1668,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
this.server.spark.tickStart(); // Paper - spark
|
||||
new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper - Server Tick Events
|
||||
|
||||
+
|
||||
+ // Leaf start - Lag compensation tick hook
|
||||
+ if (org.dreeam.leaf.config.modules.misc.LagCompensation.enabled) {
|
||||
+ org.dreeam.leaf.misc.LagCompensation.TPSCalculator.onTick();
|
||||
@@ -24,10 +25,10 @@ index 9dce5c34f67799285ee395a9c5d0db5ee6319536..6b9b3d366343a0bef76036b2b1506917
|
||||
this.tickRateManager.tick();
|
||||
this.tickChildren(shouldKeepTicking);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/LavaFluid.java b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
||||
index 2d492d849ff73a738dfbcb16507feb89bf19a962..0e70f0b88d67c2da4094fd73998d1bddf835b724 100644
|
||||
index 6e643c1a7f7e71cfd20603facaf224985ee81716..442788dfd6a1b0ce2e28b494bda198ae1a2ec34c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
||||
@@ -180,7 +180,13 @@ public abstract class LavaFluid extends FlowingFluid {
|
||||
@@ -181,7 +181,13 @@ public abstract class LavaFluid extends FlowingFluid {
|
||||
|
||||
@Override
|
||||
public int getTickDelay(LevelReader world) {
|
||||
@@ -43,10 +44,10 @@ index 2d492d849ff73a738dfbcb16507feb89bf19a962..0e70f0b88d67c2da4094fd73998d1bdd
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||
index 9dcdb2f4001115db0c26fdbf86531dbe6098485d..53a28a4026c50a66e53241ffe660b4d72600db39 100644
|
||||
index 1e741f36b79585f33abe413beafe00cf5205d54f..be86cc0043fcfeaab36870830a39764594db199c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||
@@ -122,7 +122,13 @@ public abstract class WaterFluid extends FlowingFluid {
|
||||
@@ -123,7 +123,13 @@ public abstract class WaterFluid extends FlowingFluid {
|
||||
|
||||
@Override
|
||||
public int getTickDelay(LevelReader world) {
|
||||
@@ -12,10 +12,10 @@ As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
|
||||
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index a2b40565395921ad293068829355275b4655cf54..9de85972ba32fd2373f70f708aa1bfc6067e6e1c 100644
|
||||
index 004cecfe99d279a51c21d610833bbea62c8ff25f..2b8cc1cfeda50721c063429a7d31623dc93089ea 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2768,6 +2768,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -2866,6 +2866,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
protected void updateSwingTime() {
|
||||
@@ -23,11 +23,11 @@ index a2b40565395921ad293068829355275b4655cf54..9de85972ba32fd2373f70f708aa1bfc6
|
||||
int i = this.getCurrentSwingDuration();
|
||||
|
||||
if (this.swinging) {
|
||||
@@ -3746,6 +3747,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
private void updateFallFlying() {
|
||||
+ if (!this.isFallFlying()) return; // Leaf - Lithium - entity.fast_elytra_check
|
||||
boolean flag = this.getSharedFlag(7);
|
||||
|
||||
if (flag && !this.onGround() && !this.isPassenger() && !this.hasEffect(MobEffects.LEVITATION)) {
|
||||
@@ -3889,6 +3890,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
protected void updateFallFlying() {
|
||||
this.checkSlowFallDistance();
|
||||
if (!this.level().isClientSide) {
|
||||
+ if (!this.isFallFlying() && this.fallFlyTicks == 0) return; // Leaf - Lithium - entity.fast_elytra_check
|
||||
if (!this.canGlide()) {
|
||||
if (this.getSharedFlag(7) != false && !CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) // CraftBukkit
|
||||
this.setSharedFlag(7, false);
|
||||
@@ -11,10 +11,10 @@ As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
|
||||
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java
|
||||
index f15dd2ccb99ade10ac1e49b63e6f4080bd39b3c9..9e527f8ada7ab076e41b22e8ef6ba5986e3db21e 100644
|
||||
index 6548302d4983bf48cc6bc2b7f4833dc76b59fa5e..dde522cfe64674d9cfc8d26601cad61816a6eaf5 100644
|
||||
--- a/src/main/java/net/minecraft/core/Direction.java
|
||||
+++ b/src/main/java/net/minecraft/core/Direction.java
|
||||
@@ -204,7 +204,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa
|
||||
@@ -217,7 +217,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa
|
||||
}
|
||||
|
||||
public Direction getOpposite() {
|
||||
@@ -23,7 +23,7 @@ index f15dd2ccb99ade10ac1e49b63e6f4080bd39b3c9..9e527f8ada7ab076e41b22e8ef6ba598
|
||||
}
|
||||
|
||||
public Direction getClockWise(Direction.Axis axis) {
|
||||
@@ -366,7 +366,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa
|
||||
@@ -350,7 +350,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa
|
||||
}
|
||||
|
||||
public static Direction getRandom(RandomSource random) {
|
||||
@@ -31,12 +31,12 @@ index f15dd2ccb99ade10ac1e49b63e6f4080bd39b3c9..9e527f8ada7ab076e41b22e8ef6ba598
|
||||
+ return VALUES[random.nextInt(VALUES.length)]; // Leaf - Lithium - fast util
|
||||
}
|
||||
|
||||
public static Direction getNearest(double x, double y, double z) {
|
||||
public static Direction getApproximateNearest(double x, double y, double z) {
|
||||
diff --git a/src/main/java/net/minecraft/world/phys/AABB.java b/src/main/java/net/minecraft/world/phys/AABB.java
|
||||
index db78616676ba021ee0f03cfea932f2912f4ec987..8e161efc19de76b0624b15f1c5ad399d2b1fa52d 100644
|
||||
index e74866e5195a5eeae7666ad7be750edac5947094..1958656ee368513c96de6635dfe7c969407400ec 100644
|
||||
--- a/src/main/java/net/minecraft/world/phys/AABB.java
|
||||
+++ b/src/main/java/net/minecraft/world/phys/AABB.java
|
||||
@@ -17,6 +17,15 @@ public class AABB {
|
||||
@@ -18,6 +18,15 @@ public class AABB {
|
||||
public final double maxY;
|
||||
public final double maxZ;
|
||||
|
||||
@@ -52,7 +52,7 @@ index db78616676ba021ee0f03cfea932f2912f4ec987..8e161efc19de76b0624b15f1c5ad399d
|
||||
public AABB(double x1, double y1, double z1, double x2, double y2, double z2) {
|
||||
this.minX = Math.min(x1, x2);
|
||||
this.minY = Math.min(y1, y2);
|
||||
@@ -85,11 +94,33 @@ public class AABB {
|
||||
@@ -86,11 +95,33 @@ public class AABB {
|
||||
}
|
||||
|
||||
public double min(Direction.Axis axis) {
|
||||
@@ -10,7 +10,7 @@ As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
|
||||
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/util/Mth.java b/src/main/java/net/minecraft/util/Mth.java
|
||||
index cb8cde3c1b65329f92b7c78e529e128f5a408fd6..4d1576b9920c1a0826b03565fe660c33bc285ef6 100644
|
||||
index 34bfbbabe3dfbf033f4a4e22a049323213fb23f3..c79bf9ea9456ac01533e8aa0326eb2f231626a49 100644
|
||||
--- a/src/main/java/net/minecraft/util/Mth.java
|
||||
+++ b/src/main/java/net/minecraft/util/Mth.java
|
||||
@@ -29,7 +29,7 @@ public class Mth {
|
||||
@@ -8,10 +8,10 @@ As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
|
||||
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
|
||||
index a64e5997b94cc8173f0512d1e282355f14f098ec..1d0f67e10a061225dfe99cbd935c4fb5a4cbe22b 100644
|
||||
index 21ea63da99c5b3e2e1ab9cc1049c903bba6cf288..350a5d47cca11c0e49437a4b05029ba5c29b7ee5 100644
|
||||
--- a/src/main/java/net/minecraft/core/BlockPos.java
|
||||
+++ b/src/main/java/net/minecraft/core/BlockPos.java
|
||||
@@ -343,7 +343,19 @@ public class BlockPos extends Vec3i {
|
||||
@@ -344,7 +344,19 @@ public class BlockPos extends Vec3i {
|
||||
};
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
|
||||
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 981bb6faec42c8b4d6d02cf42eebd410da0047b5..a34ae9bfda0df2834565dc3ea1fb48f7f2efc099 100644
|
||||
index 859708f1ab4b9f1bd318ca08c73cb67b1c3fe010..c1a3dbefc8d0ef0c36b8cc40a4cfd3c1015d8509 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -116,9 +116,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
@@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
|
||||
Date: Tue, 27 Aug 2024 22:53:08 -0400
|
||||
Subject: [PATCH] Don't spawn if lastSpawnState is null
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index ef2d70c1bd21cff6a080205c38bbe8bf18cc80a4..8ccc6631367992e6cb64c41b2716e743074ff913 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -500,7 +500,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
|
||||
|
||||
if (true && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair)) { // Paper - rewrite chunk system
|
||||
chunk1.incrementInhabitedTime(j);
|
||||
- if (flagAndHasNaturalSpawn && (!org.dreeam.leaf.config.modules.async.AsyncMobSpawning.enabled || _pufferfish_spawnCountsReady.get()) && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair, true)) { // Spigot // Gale - MultiPaper - skip unnecessary mob spawning computations // Pufferfish
|
||||
+ if (flagAndHasNaturalSpawn && lastSpawnState != null && (!org.dreeam.leaf.config.modules.async.AsyncMobSpawning.enabled || _pufferfish_spawnCountsReady.get()) && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair, true)) { // Spigot // Gale - MultiPaper - skip unnecessary mob spawning computations // Pufferfish // Leaf - Don't spawn if lastSpawnState is null
|
||||
NaturalSpawner.spawnForChunk(this.level, chunk1, lastSpawnState, this.spawnFriendlies, this.spawnEnemies, flag1); // Pufferfish
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@ happen but the visual "refresh" of a world change is hidden. Depending on the de
|
||||
this can act as a "smooth teleport" to a world if the new world is very similar looking to the old one.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index edef689792b163e6a33921fe2e4b1af69715a2ee..28723ab8bd72ff0db5e21c68f44f0a8d96b37653 100644
|
||||
index a27b0a3895290f5abb3a8e07fb886530fdf28c75..94288122eccd23b145e19f0e82750b7d610ea49b 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1422,7 +1422,11 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
@@ -1681,7 +1681,11 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
|
||||
LevelData worlddata = worldserver.getLevelData();
|
||||
|
||||
@@ -25,20 +25,20 @@ index edef689792b163e6a33921fe2e4b1af69715a2ee..28723ab8bd72ff0db5e21c68f44f0a8d
|
||||
this.connection.send(new ClientboundChangeDifficultyPacket(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
PlayerList playerlist = this.server.getPlayerList();
|
||||
|
||||
@@ -1432,7 +1436,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
@@ -1691,7 +1695,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
// CraftBukkit end
|
||||
this.portalPos = io.papermc.paper.util.MCUtil.toBlockPosition(exit); // Purpur - Fix stuck in portals
|
||||
this.setServerLevel(worldserver);
|
||||
- this.connection.teleport(exit); // CraftBukkit - use internal teleport without event
|
||||
+ if (!org.dreeam.leaf.config.modules.gameplay.SmoothTeleport.enabled || previousLogicalHeight != currentLogicalHeight) this.connection.teleport(exit); // CraftBukkit - use internal teleport without event // Leaf
|
||||
- this.connection.internalTeleport(PositionMoveRotation.of(teleportTarget), teleportTarget.relatives()); // CraftBukkit - use internal teleport without event
|
||||
+ if (!org.dreeam.leaf.config.modules.gameplay.SmoothTeleport.enabled || previousLogicalHeight != currentLogicalHeight) this.connection.internalTeleport(PositionMoveRotation.of(teleportTarget), teleportTarget.relatives()); // CraftBukkit - use internal teleport without event // Leaf
|
||||
this.connection.resetPosition();
|
||||
worldserver.addDuringTeleport(this);
|
||||
this.triggerDimensionChangeTriggers(worldserver1);
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index f3b98a4a66cec8d6c9dc46479d573c2fb453837a..00b9d244898ffdc1584eb254643557776bf4a76f 100644
|
||||
index 2ccecc0a81c62d96978906aec2124563f3be7541..c6d57c6016b8e410bceddf19827ec43eb2a06229 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1057,10 +1057,10 @@ public abstract class PlayerList {
|
||||
@@ -1021,10 +1021,10 @@ public abstract class PlayerList {
|
||||
ServerLevel worldserver1 = entityplayer1.serverLevel();
|
||||
LevelData worlddata = worldserver1.getLevelData();
|
||||
|
||||
@@ -267,7 +267,7 @@ index 0000000000000000000000000000000000000000..ef206b9ebbd555a786dad37e1ab1bc48
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/core/component/PatchedDataComponentMap.java b/src/main/java/net/minecraft/core/component/PatchedDataComponentMap.java
|
||||
index 22da75d8197de29a150c9eade7994deecae53a10..aa8a5938984d6860deb67a36f85c83d96057d753 100644
|
||||
index ceee6345530c3bf91cce988af2da12f0798d8f4b..1289fecee1f05abfce09672ec406caf759943b5c 100644
|
||||
--- a/src/main/java/net/minecraft/core/component/PatchedDataComponentMap.java
|
||||
+++ b/src/main/java/net/minecraft/core/component/PatchedDataComponentMap.java
|
||||
@@ -14,10 +14,11 @@ import java.util.Map.Entry;
|
||||
@@ -283,7 +283,7 @@ index 22da75d8197de29a150c9eade7994deecae53a10..aa8a5938984d6860deb67a36f85c83d9
|
||||
|
||||
public PatchedDataComponentMap(DataComponentMap baseComponents) {
|
||||
this(baseComponents, Reference2ObjectMaps.emptyMap(), true);
|
||||
@@ -128,6 +129,9 @@ public final class PatchedDataComponentMap implements DataComponentMap {
|
||||
@@ -133,6 +134,9 @@ public final class PatchedDataComponentMap implements DataComponentMap {
|
||||
}
|
||||
|
||||
private void ensureMapOwnership() {
|
||||
@@ -293,7 +293,7 @@ index 22da75d8197de29a150c9eade7994deecae53a10..aa8a5938984d6860deb67a36f85c83d9
|
||||
if (this.copyOnWrite) {
|
||||
this.patch = new Reference2ObjectArrayMap<>(this.patch);
|
||||
this.copyOnWrite = false;
|
||||
@@ -210,6 +214,22 @@ public final class PatchedDataComponentMap implements DataComponentMap {
|
||||
@@ -215,6 +219,22 @@ public final class PatchedDataComponentMap implements DataComponentMap {
|
||||
return new PatchedDataComponentMap(this.prototype, this.patch, true);
|
||||
}
|
||||
|
||||
@@ -317,10 +317,10 @@ index 22da75d8197de29a150c9eade7994deecae53a10..aa8a5938984d6860deb67a36f85c83d9
|
||||
public boolean equals(Object object) {
|
||||
if (this == object) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 9de85972ba32fd2373f70f708aa1bfc6067e6e1c..47e031130ca30cbe3bb9917cb9a43612ec73b538 100644
|
||||
index 2b8cc1cfeda50721c063429a7d31623dc93089ea..ac19c28135debebf0e1055d47571dc068f10e30e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -157,7 +157,7 @@ import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
@@ -160,7 +160,7 @@ import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -329,7 +329,7 @@ index 9de85972ba32fd2373f70f708aa1bfc6067e6e1c..47e031130ca30cbe3bb9917cb9a43612
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static final String TAG_ACTIVE_EFFECTS = "active_effects";
|
||||
@@ -290,6 +290,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -301,6 +301,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
|
||||
protected boolean shouldBurnInDay = false; public boolean shouldBurnInDay() { return this.shouldBurnInDay; } public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; } // Purpur - API for any mob to burn daylight
|
||||
|
||||
@@ -340,7 +340,7 @@ index 9de85972ba32fd2373f70f708aa1bfc6067e6e1c..47e031130ca30cbe3bb9917cb9a43612
|
||||
@Override
|
||||
public float getBukkitYaw() {
|
||||
return this.getYHeadRot();
|
||||
@@ -442,7 +446,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -454,7 +458,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
Level world = this.level();
|
||||
|
||||
@@ -349,15 +349,15 @@ index 9de85972ba32fd2373f70f708aa1bfc6067e6e1c..47e031130ca30cbe3bb9917cb9a43612
|
||||
EnchantmentHelper.tickEffects(worldserver, this);
|
||||
}
|
||||
|
||||
@@ -735,6 +739,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -751,6 +755,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
boolean flag = itemstack1.isEmpty() && itemstack.isEmpty();
|
||||
|
||||
if (!flag && !ItemStack.isSameItemSameComponents(itemstack, itemstack1) && !this.firstTick) {
|
||||
+ this.onEquipmentReplaced(itemstack, itemstack1); // Leaf - Lithium equipment tracking
|
||||
Equipable equipable = Equipable.get(itemstack1);
|
||||
Equippable equippable = (Equippable) itemstack1.get(DataComponents.EQUIPPABLE);
|
||||
|
||||
if (!this.level().isClientSide() && !this.isSpectator()) {
|
||||
@@ -3382,6 +3387,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
if (!this.isSilent() && equippable != null && enumitemslot == equippable.slot() && !silent) { // CraftBukkit
|
||||
@@ -3517,6 +3522,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
Map<EquipmentSlot, ItemStack> map = this.collectEquipmentChanges();
|
||||
|
||||
if (map != null) {
|
||||
@@ -365,7 +365,7 @@ index 9de85972ba32fd2373f70f708aa1bfc6067e6e1c..47e031130ca30cbe3bb9917cb9a43612
|
||||
this.handleHandSwap(map);
|
||||
if (!map.isEmpty()) {
|
||||
this.handleEquipmentChanges(map);
|
||||
@@ -3392,6 +3398,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3527,6 +3533,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
@Nullable
|
||||
private Map<EquipmentSlot, ItemStack> collectEquipmentChanges() {
|
||||
@@ -374,11 +374,11 @@ index 9de85972ba32fd2373f70f708aa1bfc6067e6e1c..47e031130ca30cbe3bb9917cb9a43612
|
||||
+ if (!isArmorStandUpdateNoTick && !this.equipmentChanged) return null;
|
||||
+ // Leaf end - Lithium equipment tracking
|
||||
Map<EquipmentSlot, ItemStack> map = null;
|
||||
EquipmentSlot[] aenumitemslot = EquipmentSlot.VALUES; // Gale - JettPack - reduce array allocations
|
||||
int i = aenumitemslot.length;
|
||||
@@ -4848,6 +4858,79 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
flag = true;
|
||||
return flag;
|
||||
Iterator iterator = EquipmentSlot.VALUES.iterator();
|
||||
|
||||
@@ -4985,6 +4995,79 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
public int getLastHurtByPlayerTime() {
|
||||
return this.lastHurtByPlayerTime;
|
||||
}
|
||||
+ // Leaf start - Lithium entity equipment tracking
|
||||
+ @Override
|
||||
@@ -457,10 +457,10 @@ index 9de85972ba32fd2373f70f708aa1bfc6067e6e1c..47e031130ca30cbe3bb9917cb9a43612
|
||||
public static record Fallsounds(SoundEvent small, SoundEvent big) {
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 9d196c8a8a0dc49a54264471429b6ff6da8c2b06..2ba607df6ee0500a7ac51cefd076840ae35e4827 100644
|
||||
index 1e4729be4a245a811fd15ea1c02179b37defd67c..5814d9b6b0fc5346c24dd268ec147a67c5acbfdb 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -97,7 +97,7 @@ import org.bukkit.event.entity.EntityUnleashEvent;
|
||||
@@ -98,7 +98,7 @@ import org.bukkit.event.entity.EntityUnleashEvent;
|
||||
import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -469,7 +469,7 @@ index 9d196c8a8a0dc49a54264471429b6ff6da8c2b06..2ba607df6ee0500a7ac51cefd076840a
|
||||
|
||||
private static final EntityDataAccessor<Byte> DATA_MOB_FLAGS_ID = SynchedEntityData.defineId(Mob.class, EntityDataSerializers.BYTE);
|
||||
private static final int MOB_FLAG_NO_AI = 1;
|
||||
@@ -583,6 +583,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
@@ -577,6 +577,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
|
||||
@Override
|
||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||
@@ -477,7 +477,7 @@ index 9d196c8a8a0dc49a54264471429b6ff6da8c2b06..2ba607df6ee0500a7ac51cefd076840a
|
||||
super.readAdditionalSaveData(nbt);
|
||||
|
||||
// CraftBukkit start - If looting or persistence is false only use it if it was set after we started using it
|
||||
@@ -607,7 +608,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
@@ -601,7 +602,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
|
||||
for (i = 0; i < this.armorItems.size(); ++i) {
|
||||
nbttagcompound1 = nbttaglist.getCompound(i);
|
||||
@@ -490,7 +490,7 @@ index 9d196c8a8a0dc49a54264471429b6ff6da8c2b06..2ba607df6ee0500a7ac51cefd076840a
|
||||
}
|
||||
}
|
||||
|
||||
@@ -624,7 +629,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
@@ -618,7 +623,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
|
||||
for (i = 0; i < this.handItems.size(); ++i) {
|
||||
nbttagcompound1 = nbttaglist.getCompound(i);
|
||||
@@ -503,7 +503,7 @@ index 9d196c8a8a0dc49a54264471429b6ff6da8c2b06..2ba607df6ee0500a7ac51cefd076840a
|
||||
}
|
||||
}
|
||||
|
||||
@@ -661,6 +670,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
@@ -655,6 +664,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
this.ticksSinceLastInteraction = nbt.getInt("Purpur.ticksSinceLastInteraction");
|
||||
}
|
||||
// Purpur end
|
||||
@@ -515,7 +515,7 @@ index 9d196c8a8a0dc49a54264471429b6ff6da8c2b06..2ba607df6ee0500a7ac51cefd076840a
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1865,4 +1879,10 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
@@ -1870,4 +1884,10 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
}
|
||||
}
|
||||
// Purpur end
|
||||
@@ -527,10 +527,10 @@ index 9d196c8a8a0dc49a54264471429b6ff6da8c2b06..2ba607df6ee0500a7ac51cefd076840a
|
||||
+ // Leaf end - Lithium equipment tracking
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
index 3bb46ed871fd56bbbe52cfd2575f9e853e03cd73..7e3dedc1df905ec8da637915649f9a840cbb4ed4 100644
|
||||
index a3c284976b37e865c51ee91166c4046a3c4f3a16..b34522a57cf3ee5679481ead61ae52ac9a28f6f9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
@@ -52,7 +52,7 @@ import org.bukkit.entity.Player;
|
||||
@@ -54,7 +54,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -539,7 +539,7 @@ index 3bb46ed871fd56bbbe52cfd2575f9e853e03cd73..7e3dedc1df905ec8da637915649f9a84
|
||||
|
||||
public static final int WOBBLE_TIME = 5;
|
||||
private static final boolean ENABLE_ARMS = true;
|
||||
@@ -100,7 +100,7 @@ public class ArmorStand extends LivingEntity {
|
||||
@@ -112,7 +112,7 @@ public class ArmorStand extends LivingEntity {
|
||||
public boolean canTick = true;
|
||||
public boolean canTickSetByAPI = false;
|
||||
private boolean noTickPoseDirty = false;
|
||||
@@ -548,7 +548,7 @@ index 3bb46ed871fd56bbbe52cfd2575f9e853e03cd73..7e3dedc1df905ec8da637915649f9a84
|
||||
// Paper end - Allow ArmorStands not to tick
|
||||
public boolean canMovementTick = true; // Purpur
|
||||
|
||||
@@ -269,7 +269,11 @@ public class ArmorStand extends LivingEntity {
|
||||
@@ -274,7 +274,11 @@ public class ArmorStand extends LivingEntity {
|
||||
|
||||
for (i = 0; i < this.armorItems.size(); ++i) {
|
||||
nbttagcompound1 = nbttaglist.getCompound(i);
|
||||
@@ -561,7 +561,7 @@ index 3bb46ed871fd56bbbe52cfd2575f9e853e03cd73..7e3dedc1df905ec8da637915649f9a84
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,7 +282,11 @@ public class ArmorStand extends LivingEntity {
|
||||
@@ -283,7 +287,11 @@ public class ArmorStand extends LivingEntity {
|
||||
|
||||
for (i = 0; i < this.handItems.size(); ++i) {
|
||||
nbttagcompound1 = nbttaglist.getCompound(i);
|
||||
@@ -574,7 +574,7 @@ index 3bb46ed871fd56bbbe52cfd2575f9e853e03cd73..7e3dedc1df905ec8da637915649f9a84
|
||||
}
|
||||
}
|
||||
|
||||
@@ -640,7 +648,11 @@ public class ArmorStand extends LivingEntity {
|
||||
@@ -638,7 +646,11 @@ public class ArmorStand extends LivingEntity {
|
||||
itemstack = (ItemStack) this.handItems.get(i);
|
||||
if (!itemstack.isEmpty()) {
|
||||
this.drops.add(new DefaultDrop(itemstack, stack -> Block.popResource(this.level(), this.blockPosition().above(), stack))); // CraftBukkit - add to drops // Paper - Restore vanilla drops behavior; mirror so we can destroy it later - though this call site was safe & spawn drops correctly
|
||||
@@ -587,7 +587,7 @@ index 3bb46ed871fd56bbbe52cfd2575f9e853e03cd73..7e3dedc1df905ec8da637915649f9a84
|
||||
}
|
||||
}
|
||||
|
||||
@@ -648,7 +660,11 @@ public class ArmorStand extends LivingEntity {
|
||||
@@ -646,7 +658,11 @@ public class ArmorStand extends LivingEntity {
|
||||
itemstack = (ItemStack) this.armorItems.get(i);
|
||||
if (!itemstack.isEmpty()) {
|
||||
this.drops.add(new DefaultDrop(itemstack, stack -> Block.popResource(this.level(), this.blockPosition().above(), stack))); // CraftBukkit - add to drops // Paper - Restore vanilla drops behavior; mirror so we can destroy it later - though this call site was safe & spawn drops correctly
|
||||
@@ -600,7 +600,7 @@ index 3bb46ed871fd56bbbe52cfd2575f9e853e03cd73..7e3dedc1df905ec8da637915649f9a84
|
||||
}
|
||||
}
|
||||
return this.dropAllDeathLoot(world, damageSource); // CraftBukkit - moved from above // Paper
|
||||
@@ -695,10 +711,12 @@ public class ArmorStand extends LivingEntity {
|
||||
@@ -693,10 +709,12 @@ public class ArmorStand extends LivingEntity {
|
||||
this.updatePose();
|
||||
}
|
||||
|
||||
@@ -614,7 +614,7 @@ index 3bb46ed871fd56bbbe52cfd2575f9e853e03cd73..7e3dedc1df905ec8da637915649f9a84
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1034,4 +1052,10 @@ public class ArmorStand extends LivingEntity {
|
||||
@@ -1032,4 +1050,10 @@ public class ArmorStand extends LivingEntity {
|
||||
if (this.canMovementTick && this.canMove) super.aiStep();
|
||||
}
|
||||
// Purpur end
|
||||
@@ -626,19 +626,19 @@ index 3bb46ed871fd56bbbe52cfd2575f9e853e03cd73..7e3dedc1df905ec8da637915649f9a84
|
||||
+ // Leaf end - Lithium equipment tracking
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 933b7519da5330ea8acd05c337201f52cab12c3c..e5579b15f305fb216dadd8023c16178a342b4add 100644
|
||||
index 1029499ce8fb236a23beb9dae168b82039734e59..4a5d6767bf4ead62f3c533fa33f7ce98637cce31 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -120,7 +120,7 @@ import org.bukkit.event.player.PlayerItemDamageEvent;
|
||||
@@ -125,7 +125,7 @@ import org.bukkit.event.player.PlayerItemDamageEvent;
|
||||
import org.bukkit.event.world.StructureGrowEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
-public final class ItemStack implements DataComponentHolder {
|
||||
+public final class ItemStack implements DataComponentHolder, net.caffeinemc.mods.lithium.common.util.change_tracking.ChangePublisher<ItemStack>, net.caffeinemc.mods.lithium.common.util.change_tracking.ChangeSubscriber<PatchedDataComponentMap> { // Leaf - Lithium equipment tracking
|
||||
|
||||
public static final Codec<Holder<Item>> ITEM_NON_AIR_CODEC = BuiltInRegistries.ITEM.holderByNameCodec().validate((holder) -> {
|
||||
return holder.is((Holder) Items.AIR.builtInRegistryHolder()) ? DataResult.error(() -> {
|
||||
@@ -228,6 +228,11 @@ public final class ItemStack implements DataComponentHolder {
|
||||
public static final Codec<ItemStack> CODEC = Codec.lazyInitialized(() -> {
|
||||
return RecordCodecBuilder.<ItemStack>create((instance) -> { // CraftBukkit - decompile error
|
||||
@@ -227,6 +227,11 @@ public final class ItemStack implements DataComponentHolder {
|
||||
private PatchedDataComponentMap components;
|
||||
@Nullable
|
||||
private Entity entityRepresentation;
|
||||
@@ -650,7 +650,7 @@ index 933b7519da5330ea8acd05c337201f52cab12c3c..e5579b15f305fb216dadd8023c16178a
|
||||
|
||||
private static DataResult<ItemStack> validateStrict(ItemStack stack) {
|
||||
DataResult<Unit> dataresult = ItemStack.validateComponents(stack.getComponents());
|
||||
@@ -1368,6 +1373,21 @@ public final class ItemStack implements DataComponentHolder {
|
||||
@@ -1454,6 +1459,21 @@ public final class ItemStack implements DataComponentHolder {
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
@@ -672,9 +672,9 @@ index 933b7519da5330ea8acd05c337201f52cab12c3c..e5579b15f305fb216dadd8023c16178a
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
@@ -1423,4 +1443,87 @@ public final class ItemStack implements DataComponentHolder {
|
||||
public boolean canBeHurtBy(DamageSource source) {
|
||||
return !this.has(DataComponents.FIRE_RESISTANT) || !source.is(DamageTypeTags.IS_FIRE);
|
||||
@@ -1515,4 +1535,87 @@ public final class ItemStack implements DataComponentHolder {
|
||||
|
||||
return repairable != null && repairable.isValidRepairItem(ingredient);
|
||||
}
|
||||
+
|
||||
+ // Leaf start - Lithium equipment tracking
|
||||
@@ -8,10 +8,10 @@ replacing ArrayList with Fastutil ObjectArrayList
|
||||
brings about 40% performance improvement in benchmark.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 5f4e5b386047258948a0c8772d93bfa8be734ffc..c7d806f7e2ddef2226be1efbe794f0da4c331615 100644
|
||||
index c20ab80b92196c71664a945babaafce561f764ed..6aacd5254ecd4078459a51a2857ffb7caa111261 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -976,7 +976,7 @@ public final class CraftServer implements Server {
|
||||
@@ -991,7 +991,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public List<World> getWorlds() {
|
||||
@@ -13,10 +13,10 @@ Licensed under: MIT
|
||||
Co-authored-by: Taiyou06 <kaandindar21@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/ChunkPos.java b/src/main/java/net/minecraft/world/level/ChunkPos.java
|
||||
index fa58eeec2b652f0fa251eedf11cfabde5fd3198b..4976627098381f70b10c7370529bb5000bc5626f 100644
|
||||
index 0639e4565c3324d757dec1226adb4e99d841f2c0..78fdfa78ff6d2a5307a0a6959b051cd2dce442fe 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/ChunkPos.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/ChunkPos.java
|
||||
@@ -84,7 +84,12 @@ public class ChunkPos {
|
||||
@@ -110,7 +110,12 @@ public class ChunkPos {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
@@ -52,7 +52,7 @@ index ca93a97256350789ca56f910862c9d717ca7670b..3a1a5257e1a98cc1d520f407bb1f8c74
|
||||
|
||||
private static double getBeardContribution(int x, int y, int z, int yy) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||
index f7d0eb09640b8b8eeec9269eca867f53e05d023b..a21c77def8c27315b246e3cff4642951a0bf70b6 100644
|
||||
index bd0eaa7d5253fd4ea9f9a6f0c7bfcf11fbc675a7..1a514189eb0b43548b075a6cfb571431892ad674 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||
@@ -76,14 +76,13 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
|
||||
@@ -9,10 +9,10 @@ This patch didn't cahce SectionPos or BlockPos to chunkKey, since it needs to co
|
||||
TODO: Cache block pos and section pos, whether need?
|
||||
|
||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/misc/NearbyPlayers.java b/src/main/java/ca/spottedleaf/moonrise/common/misc/NearbyPlayers.java
|
||||
index 994456ea99d78aebe41398f72019d9f6842172ff..f4b4bcbd5347c3120d8a0272e078070c44b1aa66 100644
|
||||
index 7e440b4a46b040365df7317035e577d93e7d855d..b5d98bb35f95ca068f32ed3a8314ca272aa3b262 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/common/misc/NearbyPlayers.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/common/misc/NearbyPlayers.java
|
||||
@@ -95,7 +95,7 @@ public final class NearbyPlayers {
|
||||
@@ -127,7 +127,7 @@ public final class NearbyPlayers {
|
||||
}
|
||||
|
||||
public TrackedChunk getChunk(final ChunkPos pos) {
|
||||
@@ -21,12 +21,12 @@ index 994456ea99d78aebe41398f72019d9f6842172ff..f4b4bcbd5347c3120d8a0272e078070c
|
||||
}
|
||||
|
||||
public TrackedChunk getChunk(final BlockPos pos) {
|
||||
@@ -107,7 +107,7 @@ public final class NearbyPlayers {
|
||||
@@ -143,7 +143,7 @@ public final class NearbyPlayers {
|
||||
}
|
||||
|
||||
public ReferenceList<ServerPlayer> getPlayers(final ChunkPos pos, final NearbyMapType type) {
|
||||
- return this.directByChunk[type.ordinal()].get(CoordinateUtils.getChunkKey(pos)); // Moonrise - Add direct lookup by chunk for NearbyPlayers
|
||||
+ return this.directByChunk[type.ordinal()].get(pos.chunkKey); // Moonrise - Add direct lookup by chunk for NearbyPlayers // Leaf - Cache chunk key
|
||||
- return this.directByChunk[type.ordinal()].get(CoordinateUtils.getChunkKey(pos));
|
||||
+ return this.directByChunk[type.ordinal()].get(pos.chunkKey); // Leaf - Cache chunk key
|
||||
}
|
||||
|
||||
public ReferenceList<ServerPlayer> getPlayersByChunk(final int chunkX, final int chunkZ, final NearbyMapType type) {
|
||||
@@ -54,10 +54,10 @@ index 036c1a287db04c0191e5f84b027ea68d31447cbc..753c3e99e2f677ee1704b206a3196eb0
|
||||
|
||||
public static int getChunkX(final long chunkKey) {
|
||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java
|
||||
index 58d3d1a47e9f2423c467bb329c2d5f4b58a8b5ef..c4b054cee46076efdcadf4cbb16aca7f8d9c7037 100644
|
||||
index 91a6f57f35fc1553159cca138a0619e703b2b014..180fc6faee310c0157295e2f59c3a57507104227 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java
|
||||
@@ -485,7 +485,7 @@ public final class ChunkHolderManager {
|
||||
@@ -505,7 +505,7 @@ public final class ChunkHolderManager {
|
||||
|
||||
public <T> boolean addTicketAtLevel(final TicketType<T> type, final ChunkPos chunkPos, final int level,
|
||||
final T identifier) {
|
||||
@@ -66,7 +66,7 @@ index 58d3d1a47e9f2423c467bb329c2d5f4b58a8b5ef..c4b054cee46076efdcadf4cbb16aca7f
|
||||
}
|
||||
|
||||
public <T> boolean addTicketAtLevel(final TicketType<T> type, final int chunkX, final int chunkZ, final int level,
|
||||
@@ -583,7 +583,7 @@ public final class ChunkHolderManager {
|
||||
@@ -603,7 +603,7 @@ public final class ChunkHolderManager {
|
||||
}
|
||||
|
||||
public <T> boolean removeTicketAtLevel(final TicketType<T> type, final ChunkPos chunkPos, final int level, final T identifier) {
|
||||
@@ -75,7 +75,7 @@ index 58d3d1a47e9f2423c467bb329c2d5f4b58a8b5ef..c4b054cee46076efdcadf4cbb16aca7f
|
||||
}
|
||||
|
||||
public <T> boolean removeTicketAtLevel(final TicketType<T> type, final int chunkX, final int chunkZ, final int level, final T identifier) {
|
||||
@@ -1204,7 +1204,7 @@ public final class ChunkHolderManager {
|
||||
@@ -1223,7 +1223,7 @@ public final class ChunkHolderManager {
|
||||
}
|
||||
|
||||
public static <T> TicketOperation<T, T> addOp(final ChunkPos chunk, final TicketType<T> type, final int ticketLevel, final T identifier) {
|
||||
@@ -84,7 +84,7 @@ index 58d3d1a47e9f2423c467bb329c2d5f4b58a8b5ef..c4b054cee46076efdcadf4cbb16aca7f
|
||||
}
|
||||
|
||||
public static <T> TicketOperation<T, T> addOp(final int chunkX, final int chunkZ, final TicketType<T> type, final int ticketLevel, final T identifier) {
|
||||
@@ -1216,7 +1216,7 @@ public final class ChunkHolderManager {
|
||||
@@ -1235,7 +1235,7 @@ public final class ChunkHolderManager {
|
||||
}
|
||||
|
||||
public static <T> TicketOperation<T, T> removeOp(final ChunkPos chunk, final TicketType<T> type, final int ticketLevel, final T identifier) {
|
||||
@@ -94,23 +94,23 @@ index 58d3d1a47e9f2423c467bb329c2d5f4b58a8b5ef..c4b054cee46076efdcadf4cbb16aca7f
|
||||
|
||||
public static <T> TicketOperation<T, T> removeOp(final int chunkX, final int chunkZ, final TicketType<T> type, final int ticketLevel, final T identifier) {
|
||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java b/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java
|
||||
index c64ab41198a5e0c7cbcbe6452af11f82f5938862..c272a02b48e3672b738702b338c3237241b760fb 100644
|
||||
index 571db5f9bf94745a8afe2cd313e593fb15db5e37..108db549eeb4a33c9a9c0c19833766139f7625b4 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java
|
||||
@@ -817,7 +817,7 @@ public final class StarLightInterface {
|
||||
@@ -818,7 +818,7 @@ public final class StarLightInterface {
|
||||
}
|
||||
|
||||
public ServerChunkTasks queueChunkLightTask(final ChunkPos pos, final BooleanSupplier lightTask, final PrioritisedExecutor.Priority priority) {
|
||||
public ServerChunkTasks queueChunkLightTask(final ChunkPos pos, final BooleanSupplier lightTask, final Priority priority) {
|
||||
- final ServerChunkTasks ret = this.chunkTasks.compute(CoordinateUtils.getChunkKey(pos), (final long keyInMap, ServerChunkTasks valueInMap) -> {
|
||||
+ final ServerChunkTasks ret = this.chunkTasks.compute(pos.chunkKey, (final long keyInMap, ServerChunkTasks valueInMap) -> { // Leaf - Cache chunk key
|
||||
if (valueInMap == null) {
|
||||
valueInMap = new ServerChunkTasks(
|
||||
keyInMap, ServerLightQueue.this.lightInterface, ServerLightQueue.this, priority
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 6d8fb4fe9733bd1e83af7f8c148bdb54fa26a14b..b93823983183c4ae1467a6df4f0b1fcfe60c815c 100644
|
||||
index 4a92789d77313e165ab1252cd469e34a8b7eb575..9469f9edd9f94f7644dc28c9be2fb1b9843e84e1 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2475,7 +2475,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
@@ -2638,7 +2638,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
|
||||
public boolean isNaturalSpawningAllowed(ChunkPos pos) {
|
||||
// Paper start - rewrite chunk system
|
||||
@@ -120,10 +120,10 @@ index 6d8fb4fe9733bd1e83af7f8c148bdb54fa26a14b..b93823983183c4ae1467a6df4f0b1fcf
|
||||
// Paper end - rewrite chunk system
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/ChunkPos.java b/src/main/java/net/minecraft/world/level/ChunkPos.java
|
||||
index 4976627098381f70b10c7370529bb5000bc5626f..4e66ef1e77ad44027ded0084f160a5802d83c68d 100644
|
||||
index 78fdfa78ff6d2a5307a0a6959b051cd2dce442fe..1a20d1ed779caf5eba260d21cc0afdf7edff5bf6 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/ChunkPos.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/ChunkPos.java
|
||||
@@ -21,6 +21,7 @@ public class ChunkPos {
|
||||
@@ -47,6 +47,7 @@ public class ChunkPos {
|
||||
public final int x;
|
||||
public final int z;
|
||||
public final long longKey; // Paper
|
||||
@@ -131,7 +131,7 @@ index 4976627098381f70b10c7370529bb5000bc5626f..4e66ef1e77ad44027ded0084f160a580
|
||||
private static final int HASH_A = 1664525;
|
||||
private static final int HASH_C = 1013904223;
|
||||
private static final int HASH_Z_XOR = -559038737;
|
||||
@@ -29,18 +30,21 @@ public class ChunkPos {
|
||||
@@ -55,18 +56,21 @@ public class ChunkPos {
|
||||
this.x = x;
|
||||
this.z = z;
|
||||
this.longKey = asLong(this.x, this.z); // Paper
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Cache random tick block status
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
index 5b54d956486cec3c39824b15e37bf090798c5047..9e6779d305a6690be8ea756b77dcdfdf69f93087 100644
|
||||
index e4ae25c83ab9dd1aaa530a5456275ef63cdb8511..f19d9bba70957fc652c3222cadd247eb837c2a13 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
@@ -22,6 +22,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
@@ -14,17 +14,25 @@ index 5b54d956486cec3c39824b15e37bf090798c5047..9e6779d305a6690be8ea756b77dcdfdf
|
||||
private short tickingFluidCount;
|
||||
+ private boolean isRandomlyTickingBlocksStatus; // Leaf - Cache random tick block status
|
||||
public final PalettedContainer<BlockState> states;
|
||||
// CraftBukkit start - read/write
|
||||
private PalettedContainer<Holder<Biome>> biomes;
|
||||
@@ -166,6 +167,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
private PalettedContainer<Holder<Biome>> biomes; // CraftBukkit - read/write
|
||||
|
||||
@@ -55,6 +56,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
this.tickingFluidCount = section.tickingFluidCount;
|
||||
this.states = section.states.copy();
|
||||
this.biomes = section.biomes.copy();
|
||||
+ this.isRandomlyTickingBlocksStatus = this.tickingBlockCount > 0; // Leaf - Cache random tick block status
|
||||
}
|
||||
|
||||
this.updateBlockCallback(x, y, z, state, iblockdata1); // Moonrise - block counting optimisations
|
||||
public LevelChunkSection(PalettedContainer<BlockState> datapaletteblock, PalettedContainer<Holder<Biome>> palettedcontainerro) { // CraftBukkit - read/write
|
||||
@@ -165,6 +167,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
}
|
||||
|
||||
this.updateBlockCallback(x, y, z, state, iblockdata1); // Paper - block counting
|
||||
+ this.isRandomlyTickingBlocksStatus = this.tickingBlockCount > 0; // Leaf - Cache random tick block status
|
||||
|
||||
return iblockdata1;
|
||||
}
|
||||
@@ -179,7 +181,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
@@ -178,7 +181,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
}
|
||||
|
||||
public boolean isRandomlyTickingBlocks() {
|
||||
@@ -33,17 +41,17 @@ index 5b54d956486cec3c39824b15e37bf090798c5047..9e6779d305a6690be8ea756b77dcdfdf
|
||||
}
|
||||
|
||||
public boolean isRandomlyTickingFluids() {
|
||||
@@ -196,6 +198,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
@@ -193,6 +196,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
this.tickingFluidCount = (short)0;
|
||||
this.specialCollidingBlocks = (short)0;
|
||||
// Moonrise end - block counting optimisations
|
||||
this.tickingBlocks.clear();
|
||||
+ this.isRandomlyTickingBlocksStatus = false; // Leaf - Cache random tick block status
|
||||
|
||||
if (this.maybeHas((final BlockState state) -> !state.isAir())) {
|
||||
final PalettedContainer.Data<BlockState> data = this.states.data;
|
||||
@@ -232,6 +235,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
@@ -226,6 +230,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
this.nonEmptyBlockCount += (short)paletteCount;
|
||||
if (state.isRandomlyTicking()) {
|
||||
// Moonrise start - block counting optimisations
|
||||
this.tickingBlockCount += (short)paletteCount;
|
||||
+ this.isRandomlyTickingBlocksStatus = this.tickingBlockCount > 0; // Leaf - Cache random tick block status
|
||||
final short[] raw = coordinates.elements();
|
||||
65
patches/server/0136-Cache-canHoldAnyFluid-result.patch
Normal file
65
patches/server/0136-Cache-canHoldAnyFluid-result.patch
Normal file
@@ -0,0 +1,65 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
|
||||
Date: Tue, 26 Nov 2024 17:15:38 -0500
|
||||
Subject: [PATCH] Cache canHoldAnyFluid result
|
||||
|
||||
Cache the result of half of canHoldAnyFluid logic, since there is a state#is in this method,
|
||||
it uses map contains to do iteration to check whether a block has a specific block tag key,
|
||||
which the contains iteration call is very expensive if called everytime
|
||||
|
||||
In the test, it can improve ~30% performance in ~1577000 times of canHoldAnyFluid calls (~159ms -> ~111ms)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
index cabb4b79248725ea8f831d5f1b27902c3c9ea262..d97e98e4c4076694be465eb65e95cd1629b025ec 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
@@ -844,6 +844,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
private VoxelShape[] occlusionShapesByFace;
|
||||
private boolean propagatesSkylightDown;
|
||||
private int lightBlock;
|
||||
+ private boolean canHoldAnyFluidInternal; // Leaf - Cache canHoldAnyFluid result
|
||||
|
||||
// Paper start - rewrite chunk system
|
||||
private boolean isConditionallyFullOpaque;
|
||||
@@ -999,6 +1000,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
|
||||
this.propagatesSkylightDown = ((Block) this.owner).propagatesSkylightDown(this.asState());
|
||||
this.lightBlock = ((Block) this.owner).getLightBlock(this.asState());
|
||||
+ this.canHoldAnyFluidInternal = net.minecraft.world.level.material.FlowingFluid.canHoldAnyFluid(this.asState()); // Leaf - Cache canHoldAnyFluid result
|
||||
// Paper start - rewrite chunk system
|
||||
this.isConditionallyFullOpaque = this.canOcclude & this.useShapeForLightOcclusion;
|
||||
// Paper end - rewrite chunk system
|
||||
@@ -1058,6 +1060,12 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
return this.legacySolid;
|
||||
}
|
||||
|
||||
+ // Leaf start - Cache canHoldAnyFluid result
|
||||
+ public boolean canHoldAnyFluidInternal() {
|
||||
+ return canHoldAnyFluidInternal;
|
||||
+ }
|
||||
+ // Leaf end - Cache canHoldAnyFluid result
|
||||
+
|
||||
// Paper start - Protect Bedrock and End Portal/Frames from being destroyed
|
||||
public final boolean isDestroyable() {
|
||||
return getBlock().isDestroyable();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
index 408e7c61d87a0e6d8502bf1f5ca76fd728c5d10c..de761ea851d47e59538b4d0d3cec5624bf37b84a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
@@ -494,14 +494,14 @@ public abstract class FlowingFluid extends Fluid {
|
||||
return map;
|
||||
}
|
||||
|
||||
- private static boolean canHoldAnyFluid(BlockState state) {
|
||||
+ public static boolean canHoldAnyFluid(BlockState state) { // Leaf - Cache canHoldAnyFluid result - private -> public
|
||||
Block block = state.getBlock();
|
||||
|
||||
return block instanceof LiquidBlockContainer ? true : (state.blocksMotion() ? false : !(block instanceof DoorBlock) && !state.is(BlockTags.SIGNS) && !state.is(Blocks.LADDER) && !state.is(Blocks.SUGAR_CANE) && !state.is(Blocks.BUBBLE_COLUMN) && !state.is(Blocks.NETHER_PORTAL) && !state.is(Blocks.END_PORTAL) && !state.is(Blocks.END_GATEWAY) && !state.is(Blocks.STRUCTURE_VOID));
|
||||
}
|
||||
|
||||
private static boolean canHoldFluid(BlockGetter world, BlockPos pos, BlockState state, Fluid fluid) {
|
||||
- return FlowingFluid.canHoldAnyFluid(state) && FlowingFluid.canHoldSpecificFluid(world, pos, state, fluid);
|
||||
+ return /*FlowingFluid.canHoldAnyFluid(state)*/ state.canHoldAnyFluidInternal() && FlowingFluid.canHoldSpecificFluid(world, pos, state, fluid); // Leaf - Cache canHoldAnyFluid result
|
||||
}
|
||||
|
||||
private static boolean canHoldSpecificFluid(BlockGetter world, BlockPos pos, BlockState state, Fluid fluid) {
|
||||
@@ -1,95 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
|
||||
Date: Tue, 26 Nov 2024 17:15:38 -0500
|
||||
Subject: [PATCH] Simplify canHoldFluid condition logic
|
||||
|
||||
Cache the result of half of canHoldFluid logic, since there is a state#is in this method,
|
||||
it uses map contains to do iteration to check whether a block has a specific block tag key,
|
||||
which the contains iteration call is very expensive if called everytime
|
||||
Also, I simplified the condition logic in the original method to be more readable.
|
||||
It is actually useless since the result is cached, just makes it look better.
|
||||
|
||||
In the test, it can improve ~30% performance in ~1577000 times of canHoldFluid calls (~159ms -> ~111ms)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
index de299465937074a1067a6adfc208eaaa24bcae67..235ba8f5edc9e75d2b8e34ecd65df791aa7e4ff2 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
@@ -794,6 +794,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
protected BlockBehaviour.BlockStateBase.Cache cache;
|
||||
private FluidState fluidState;
|
||||
private boolean isRandomlyTicking;
|
||||
+ private boolean canHoldFluidInternal; // Leaf - Simplify canHoldFluid condition logic
|
||||
|
||||
// Paper start - rewrite chunk system
|
||||
private int opacityIfCached;
|
||||
@@ -929,6 +930,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
this.shapeExceedsCube = this.cache == null || this.cache.largeCollisionShape; // Paper - moved from actual method to here
|
||||
|
||||
this.legacySolid = this.calculateSolid();
|
||||
+ this.canHoldFluidInternal = org.dreeam.leaf.util.fluid.FluidUtil.canHoldFluidInternal(this.getBlock(), this.asState()); // Leaf - Simplify canHoldFluid condition logic
|
||||
// Paper start - rewrite chunk system
|
||||
this.isConditionallyFullOpaque = this.canOcclude & this.useShapeForLightOcclusion;
|
||||
this.opacityIfCached = this.cache == null || this.isConditionallyFullOpaque ? -1 : this.cache.lightBlock;
|
||||
@@ -990,6 +992,12 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
return this.legacySolid;
|
||||
}
|
||||
|
||||
+ // Leaf start - Simplify canHoldFluid condition logic
|
||||
+ public boolean canHoldFluidInternal() {
|
||||
+ return canHoldFluidInternal;
|
||||
+ }
|
||||
+ // Leaf end - Simplify canHoldFluid condition logic
|
||||
+
|
||||
// Paper start - Protect Bedrock and End Portal/Frames from being destroyed
|
||||
public final boolean isDestroyable() {
|
||||
return getBlock().isDestroyable();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
index bf9c228a19fe34221686f1d002feda7f40e8272c..e3b23cb01aa25afcef32ce87bb4aafa6e418f190 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
@@ -520,7 +520,7 @@ public abstract class FlowingFluid extends Fluid {
|
||||
if (block instanceof LiquidBlockContainer ifluidcontainer) {
|
||||
return ifluidcontainer.canPlaceLiquid((Player) null, world, pos, state, fluid);
|
||||
} else {
|
||||
- return !(block instanceof DoorBlock) && !state.is(BlockTags.SIGNS) && !state.is(Blocks.LADDER) && !state.is(Blocks.SUGAR_CANE) && !state.is(Blocks.BUBBLE_COLUMN) ? (!state.is(Blocks.NETHER_PORTAL) && !state.is(Blocks.END_PORTAL) && !state.is(Blocks.END_GATEWAY) && !state.is(Blocks.STRUCTURE_VOID) ? !state.blocksMotion() : false) : false;
|
||||
+ return state.canHoldFluidInternal(); // Leaf - Simplify canHoldFluid condition logic
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/dreeam/leaf/util/fluid/FluidUtil.java b/src/main/java/org/dreeam/leaf/util/fluid/FluidUtil.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..de6744e5f11c394f4d64aab2bb94a81aa12432f2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/dreeam/leaf/util/fluid/FluidUtil.java
|
||||
@@ -0,0 +1,30 @@
|
||||
+package org.dreeam.leaf.util.fluid;
|
||||
+
|
||||
+import net.minecraft.tags.BlockTags;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+import net.minecraft.world.level.block.Blocks;
|
||||
+import net.minecraft.world.level.block.DoorBlock;
|
||||
+import net.minecraft.world.level.block.state.BlockState;
|
||||
+
|
||||
+public class FluidUtil {
|
||||
+
|
||||
+ public static boolean canHoldFluidInternal(Block block, BlockState state) {
|
||||
+ if (block instanceof DoorBlock ||
|
||||
+ state.is(BlockTags.SIGNS) ||
|
||||
+ block == Blocks.LADDER ||
|
||||
+ block == Blocks.SUGAR_CANE ||
|
||||
+ block == Blocks.BUBBLE_COLUMN) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (block == Blocks.NETHER_PORTAL ||
|
||||
+ block == Blocks.END_PORTAL ||
|
||||
+ block == Blocks.END_GATEWAY ||
|
||||
+ block == Blocks.STRUCTURE_VOID) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ // Same with !state.blocksMotion()
|
||||
+ return block == Blocks.COBWEB || block == Blocks.BAMBOO_SAPLING || !state.isSolid();
|
||||
+ }
|
||||
+}
|
||||
8
todos.md
Normal file
8
todos.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# TODOs
|
||||
|
||||
- [ ] Check Fix MC-65198 fix
|
||||
- [ ] refactor leaves protocol manager opt and pr it.
|
||||
- [ ] check multithreaded tracker, that moonrise change
|
||||
- [ ] Check and apply work patches
|
||||
- [ ] Backport Cache canHoldAnyFluid result to 1.21.1
|
||||
- [ ] tracking todos
|
||||
Reference in New Issue
Block a user