mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2026-01-03 14:22:26 +00:00
Fix Nova incompatibility
* Remove C2ME: Reduce Allocations in ver/1.21.1 branch * Revert int to short change for specialCollidingBlocks in moonrise optimization
This commit is contained in:
@@ -3,6 +3,8 @@ From: Taiyou06 <kaandindar21@gmail.com>
|
||||
Date: Thu, 7 Nov 2024 19:45:31 +0100
|
||||
Subject: [PATCH] C2ME: Reduce Allocations
|
||||
|
||||
Removed in Leaf 1.21.1, cause incompatibility with Nova (v0.17-alpha.39)
|
||||
|
||||
This patch is based on the following mixin:
|
||||
"com/ishland/c2me/opts/allocs/mixin/object_pooling_caching/MixinOreFeature.java"
|
||||
By: ishland <ishlandmc@yeah.net>
|
||||
@@ -282,10 +282,10 @@ index b02a0d9c71550d39aad08ed0932043531b661305..e2c7c9ed8bf4dc2eb10fbed59c518a2a
|
||||
// Paper end - block counting
|
||||
|
||||
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 33747ef8211066155cd70ce2818862cf3e79db53..5b54d956486cec3c39824b15e37bf090798c5047 100644
|
||||
index 33747ef8211066155cd70ce2818862cf3e79db53..855b49e819498951163bc814a05e8d3e18e6b338 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
@@ -28,23 +28,29 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
@@ -28,23 +28,30 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
public short fluidStateCount; // Gale - Airplane - reduce entity fluid lookups if no fluids
|
||||
|
||||
// Paper start - block counting
|
||||
@@ -303,7 +303,8 @@ index 33747ef8211066155cd70ce2818862cf3e79db53..5b54d956486cec3c39824b15e37bf090
|
||||
+ // Moonrise start - block counting optimisations
|
||||
+ private boolean isClient;
|
||||
+ private static final short CLIENT_FORCED_SPECIAL_COLLIDING_BLOCKS = (short) 9999;
|
||||
+ private short specialCollidingBlocks;
|
||||
+ //private short specialCollidingBlocks;
|
||||
+ private int specialCollidingBlocks; // Leaf - short -> int - Fix incompatibility with Nova
|
||||
+ private final ca.spottedleaf.moonrise.common.list.ShortList tickingBlocks = new ca.spottedleaf.moonrise.common.list.ShortList();
|
||||
+ // Moonrise end - block counting optimisations
|
||||
|
||||
@@ -322,7 +323,7 @@ index 33747ef8211066155cd70ce2818862cf3e79db53..5b54d956486cec3c39824b15e37bf090
|
||||
return this.tickingBlocks;
|
||||
}
|
||||
// Paper end - block counting
|
||||
@@ -84,6 +90,45 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
@@ -84,6 +91,45 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
return this.setBlockState(x, y, z, state, true);
|
||||
}
|
||||
|
||||
@@ -368,7 +369,7 @@ index 33747ef8211066155cd70ce2818862cf3e79db53..5b54d956486cec3c39824b15e37bf090
|
||||
public BlockState setBlockState(int x, int y, int z, BlockState state, boolean lock) {
|
||||
BlockState iblockdata1;
|
||||
|
||||
@@ -103,7 +148,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
@@ -103,7 +149,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,7 +378,7 @@ index 33747ef8211066155cd70ce2818862cf3e79db53..5b54d956486cec3c39824b15e37bf090
|
||||
--this.tickingFluidCount;
|
||||
--this.fluidStateCount; // Gale - Airplane - reduce entity fluid lookups if no fluids
|
||||
}
|
||||
@@ -115,26 +160,12 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
@@ -115,26 +161,12 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
}
|
||||
}
|
||||
|
||||
@@ -406,7 +407,7 @@ index 33747ef8211066155cd70ce2818862cf3e79db53..5b54d956486cec3c39824b15e37bf090
|
||||
|
||||
return iblockdata1;
|
||||
}
|
||||
@@ -158,10 +189,12 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
@@ -158,10 +190,12 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
public void recalcBlockCounts() {
|
||||
// Paper start - block counting
|
||||
// reset, then recalculate
|
||||
@@ -423,7 +424,7 @@ index 33747ef8211066155cd70ce2818862cf3e79db53..5b54d956486cec3c39824b15e37bf090
|
||||
this.tickingBlocks.clear();
|
||||
|
||||
if (this.maybeHas((final BlockState state) -> !state.isAir())) {
|
||||
@@ -170,18 +203,20 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
@@ -170,18 +204,20 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
final int paletteSize = palette.getSize();
|
||||
final net.minecraft.util.BitStorage storage = data.storage();
|
||||
|
||||
@@ -449,7 +450,7 @@ index 33747ef8211066155cd70ce2818862cf3e79db53..5b54d956486cec3c39824b15e37bf090
|
||||
final int paletteCount = coordinates.size();
|
||||
|
||||
final BlockState state = palette.valueFor(paletteIdx);
|
||||
@@ -191,25 +226,32 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
@@ -191,25 +227,32 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
}
|
||||
|
||||
if (ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.isSpecialCollidingBlock(state)) {
|
||||
@@ -489,7 +490,7 @@ index 33747ef8211066155cd70ce2818862cf3e79db53..5b54d956486cec3c39824b15e37bf090
|
||||
}
|
||||
this.fluidStateCount++; // Gale - Airplane - reduce entity fluid lookups if no fluids
|
||||
}
|
||||
@@ -233,7 +275,11 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
@@ -233,7 +276,11 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
|
||||
datapaletteblock.read(buf);
|
||||
this.biomes = datapaletteblock;
|
||||
|
||||
@@ -9,7 +9,7 @@ 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 a519447d916daa792023c64ed4fdef7fa7e0895a..f24f7c3adad0eb31aee059ce71e4e1ad122945ed 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
|
||||
@@ -35,7 +35,7 @@ index edef689792b163e6a33921fe2e4b1af69715a2ee..28723ab8bd72ff0db5e21c68f44f0a8d
|
||||
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 e9f24152a881372c68af3b7b473c4d6f1a35bbb4..d38bec8861b434a8b6cc09b0b40a5c9b9c003425 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 {
|
||||
@@ -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 855b49e819498951163bc814a05e8d3e18e6b338..ce97ec2af013af052734814404b4f5fd8c9d66ed 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_
|
||||
@@ -16,7 +16,7 @@ index 5b54d956486cec3c39824b15e37bf090798c5047..9e6779d305a6690be8ea756b77dcdfdf
|
||||
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_
|
||||
@@ -167,6 +168,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
}
|
||||
|
||||
this.updateBlockCallback(x, y, z, state, iblockdata1); // Moonrise - block counting optimisations
|
||||
@@ -24,7 +24,7 @@ index 5b54d956486cec3c39824b15e37bf090798c5047..9e6779d305a6690be8ea756b77dcdfdf
|
||||
|
||||
return iblockdata1;
|
||||
}
|
||||
@@ -179,7 +181,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
@@ -180,7 +182,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
}
|
||||
|
||||
public boolean isRandomlyTickingBlocks() {
|
||||
@@ -33,7 +33,7 @@ index 5b54d956486cec3c39824b15e37bf090798c5047..9e6779d305a6690be8ea756b77dcdfdf
|
||||
}
|
||||
|
||||
public boolean isRandomlyTickingFluids() {
|
||||
@@ -196,6 +198,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
@@ -197,6 +199,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
this.specialCollidingBlocks = (short) 0;
|
||||
// Moonrise end - block counting optimisations
|
||||
this.tickingBlocks.clear();
|
||||
@@ -41,7 +41,7 @@ index 5b54d956486cec3c39824b15e37bf090798c5047..9e6779d305a6690be8ea756b77dcdfdf
|
||||
|
||||
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_
|
||||
@@ -233,6 +236,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
if (state.isRandomlyTicking()) {
|
||||
// Moonrise start - block counting optimisations
|
||||
this.tickingBlockCount += (short) paletteCount;
|
||||
@@ -9,7 +9,7 @@ Original license: GPLv3
|
||||
Original project: https://github.com/PaperMC/Paper
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index e0962547709d6951cc98da94f028bd4d5b7b25dd..a474503e8cfc344f84f83426df5aeb6dac748b79 100644
|
||||
index 8349f8d83364e6b2bf51228b622d951e1354b376..1ac45ef0b84aac8d2dc9718a3fd615e07a44f155 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1918,7 +1918,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
Reference in New Issue
Block a user