mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-22 08:19:19 +00:00
switch from sources, split some patches
This commit is contained in:
@@ -18,10 +18,10 @@ index 394443d00e661715439be1e56dddc129947699a4..480ad57a6b7b74e6b83e9c6ceb69ea1f
|
||||
public CrashReport(String title, Throwable exception) {
|
||||
io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(exception); // Paper
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index ac0ed2e7261a0d698fafd5b314108ff38a169073..8f32168ff0371a9168bbf9b08b2154200f8131a0 100644
|
||||
index 306230339574bc35a309877033fa6012e4596f08..1362f3d2ef75d8b18ac2142194ff5b3f2104ac1e 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1183,6 +1183,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1176,6 +1176,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
protected void runServer() {
|
||||
try {
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Configuration
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index debea77d5777b90c6b17b225e27e6b3c72370175..f5761420749110ca8811533c3fb5d80c8b025c67 100644
|
||||
index 670553243d26e2faab8a21f099a846d4d1df7927..9a36ad8112cc4a4d5c4fefcd3b4bf3c48d9d40ee 100644
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -193,6 +193,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -23,9 +23,9 @@ index debea77d5777b90c6b17b225e27e6b3c72370175..f5761420749110ca8811533c3fb5d80c
|
||||
+ // DivineMC end - Configuration
|
||||
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
|
||||
|
||||
// DivineMC start - Pufferfish SIMD
|
||||
this.setPvpAllowed(properties.pvp);
|
||||
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
|
||||
index 801c4e8e01590beeb3633275f58d436d87ad746e..5ffaae02967dbc079619d35c2b8e3f7763b75d38 100644
|
||||
index dccfd0f30111316c9c82004358c2a7051cbd5cdb..1ad419b4a2ad4610a0a8d18b26665a7ec0ccc960 100644
|
||||
--- a/net/minecraft/world/level/Level.java
|
||||
+++ b/net/minecraft/world/level/Level.java
|
||||
@@ -161,6 +161,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
|
||||
|
||||
@@ -213,7 +213,7 @@ index 18071dcc69cc28471dddb7de94e803ec1e5fc2e4..aa25f5ebaf7d1b22825b962b02dcae02
|
||||
}
|
||||
}
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index 768e82c5cfd05fae2dd84fc6a37f5984c6ec4865..abfecaf4467092f7baa02e0f5bbfd23d087f2aa3 100644
|
||||
index 1362f3d2ef75d8b18ac2142194ff5b3f2104ac1e..ace14db7bfd154b8a9b27af4a6c57630a3868ac0 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -114,19 +114,8 @@ import net.minecraft.util.TimeUtil;
|
||||
@@ -250,7 +250,7 @@ index 768e82c5cfd05fae2dd84fc6a37f5984c6ec4865..abfecaf4467092f7baa02e0f5bbfd23d
|
||||
private ServerConnectionListener connection;
|
||||
public final ChunkProgressListenerFactory progressListenerFactory;
|
||||
@Nullable
|
||||
@@ -1000,9 +982,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -993,9 +975,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
shutdownThread = Thread.currentThread(); // Paper - Improved watchdog support
|
||||
org.spigotmc.WatchdogThread.doStop(); // Paper - Improved watchdog support
|
||||
// CraftBukkit end
|
||||
@@ -260,7 +260,7 @@ index 768e82c5cfd05fae2dd84fc6a37f5984c6ec4865..abfecaf4467092f7baa02e0f5bbfd23d
|
||||
|
||||
LOGGER.info("Stopping server");
|
||||
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
|
||||
@@ -1274,50 +1253,38 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1267,50 +1246,38 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
// Spigot end
|
||||
|
||||
boolean flag = l == 0L;
|
||||
@@ -336,7 +336,7 @@ index 768e82c5cfd05fae2dd84fc6a37f5984c6ec4865..abfecaf4467092f7baa02e0f5bbfd23d
|
||||
this.isReady = true;
|
||||
JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis);
|
||||
}
|
||||
@@ -1489,7 +1456,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1482,7 +1449,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@Override
|
||||
public void doRunTask(TickTask task) {
|
||||
@@ -344,7 +344,7 @@ index 768e82c5cfd05fae2dd84fc6a37f5984c6ec4865..abfecaf4467092f7baa02e0f5bbfd23d
|
||||
super.doRunTask(task);
|
||||
}
|
||||
|
||||
@@ -1579,12 +1545,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1572,12 +1538,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
this.ticksUntilAutosave--;
|
||||
// Paper start - Incremental chunk and player saving
|
||||
@@ -357,7 +357,7 @@ index 768e82c5cfd05fae2dd84fc6a37f5984c6ec4865..abfecaf4467092f7baa02e0f5bbfd23d
|
||||
final boolean fullSave = autosavePeriod > 0 && this.tickCount % autosavePeriod == 0;
|
||||
try {
|
||||
this.isSaving = true;
|
||||
@@ -1599,10 +1563,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1592,10 +1556,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
} finally {
|
||||
this.isSaving = false;
|
||||
}
|
||||
@@ -368,7 +368,7 @@ index 768e82c5cfd05fae2dd84fc6a37f5984c6ec4865..abfecaf4467092f7baa02e0f5bbfd23d
|
||||
this.runAllTasks(); // Paper - move runAllTasks() into full server tick (previously for timings)
|
||||
this.server.spark.executeMainThreadTasks(); // Paper - spark
|
||||
// Paper start - Server Tick Events
|
||||
@@ -1611,7 +1573,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1604,7 +1566,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent();
|
||||
// Paper end - Server Tick Events
|
||||
this.server.spark.tickEnd(((double)(endTime - lastTick) / 1000000D)); // Paper - spark
|
||||
@@ -376,7 +376,7 @@ index 768e82c5cfd05fae2dd84fc6a37f5984c6ec4865..abfecaf4467092f7baa02e0f5bbfd23d
|
||||
long l = Util.getNanos() - nanos;
|
||||
int i1 = this.tickCount % 100;
|
||||
this.aggregatedTickTimesNanos = this.aggregatedTickTimesNanos - this.tickTimesNanos[i1];
|
||||
@@ -1624,16 +1585,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1617,16 +1578,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.tickTimes60s.add(this.tickCount, l);
|
||||
// Paper end - Add tick times API and /mspt command
|
||||
this.logTickMethodTime(nanos);
|
||||
@@ -393,7 +393,7 @@ index 768e82c5cfd05fae2dd84fc6a37f5984c6ec4865..abfecaf4467092f7baa02e0f5bbfd23d
|
||||
LOGGER.debug("Autosave finished");
|
||||
}
|
||||
|
||||
@@ -1701,7 +1658,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1694,7 +1651,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public final io.papermc.paper.threadedregions.EntityScheduler.EntitySchedulerTickList entitySchedulerTickList = new io.papermc.paper.threadedregions.EntityScheduler.EntitySchedulerTickList(); // Paper - optimise Folia entity scheduler
|
||||
|
||||
protected void tickChildren(BooleanSupplier hasTimeLeft) {
|
||||
@@ -401,7 +401,7 @@ index 768e82c5cfd05fae2dd84fc6a37f5984c6ec4865..abfecaf4467092f7baa02e0f5bbfd23d
|
||||
this.getPlayerList().getPlayers().forEach(serverPlayer1 -> serverPlayer1.connection.suspendFlushing());
|
||||
this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit
|
||||
// Paper start - optimise Folia entity scheduler
|
||||
@@ -1715,9 +1671,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1708,9 +1664,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
// Paper end - optimise Folia entity scheduler
|
||||
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper
|
||||
@@ -411,7 +411,7 @@ index 768e82c5cfd05fae2dd84fc6a37f5984c6ec4865..abfecaf4467092f7baa02e0f5bbfd23d
|
||||
|
||||
// CraftBukkit start
|
||||
// Run tasks that are waiting on processing
|
||||
@@ -1753,17 +1707,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1746,17 +1700,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
serverLevel.updateLagCompensationTick(); // Paper - lag compensation
|
||||
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = serverLevel.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers
|
||||
serverLevel.hasRidableMoveEvent = org.purpurmc.purpur.event.entity.RidableMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Purpur - Ridables
|
||||
@@ -429,7 +429,7 @@ index 768e82c5cfd05fae2dd84fc6a37f5984c6ec4865..abfecaf4467092f7baa02e0f5bbfd23d
|
||||
try {
|
||||
serverLevel.tick(hasTimeLeft);
|
||||
} catch (Throwable var7) {
|
||||
@@ -1772,34 +1721,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1765,34 +1714,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
throw new ReportedException(crashReport);
|
||||
}
|
||||
|
||||
@@ -464,7 +464,7 @@ index 768e82c5cfd05fae2dd84fc6a37f5984c6ec4865..abfecaf4467092f7baa02e0f5bbfd23d
|
||||
}
|
||||
|
||||
public void tickConnection() {
|
||||
@@ -1815,14 +1754,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1808,14 +1747,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
|
||||
public void forceTimeSynchronization() {
|
||||
@@ -479,7 +479,7 @@ index 768e82c5cfd05fae2dd84fc6a37f5984c6ec4865..abfecaf4467092f7baa02e0f5bbfd23d
|
||||
}
|
||||
|
||||
public boolean isLevelEnabled(Level level) {
|
||||
@@ -2638,55 +2572,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -2631,55 +2565,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -535,7 +535,7 @@ index 768e82c5cfd05fae2dd84fc6a37f5984c6ec4865..abfecaf4467092f7baa02e0f5bbfd23d
|
||||
public Path getWorldPath(LevelResource levelResource) {
|
||||
return this.storageSource.getLevelPath(levelResource);
|
||||
}
|
||||
@@ -2736,24 +2621,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -2729,24 +2614,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
return this.isSaving;
|
||||
}
|
||||
|
||||
@@ -560,7 +560,7 @@ index 768e82c5cfd05fae2dd84fc6a37f5984c6ec4865..abfecaf4467092f7baa02e0f5bbfd23d
|
||||
public int getMaxChainedNeighborUpdates() {
|
||||
return 1000000;
|
||||
}
|
||||
@@ -2863,55 +2730,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -2856,55 +2723,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public record ServerResourcePackInfo(UUID id, String url, String hash, boolean isRequired, @Nullable Component prompt) {
|
||||
}
|
||||
|
||||
@@ -1067,10 +1067,10 @@ index b10cb4a73df58a5fe64e88868733ba41616f59e4..9f9cbe6056f8a4eeca64c40872d7403b
|
||||
+ // DivineMC end - Completely remove Mojang profiler
|
||||
}
|
||||
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index de4d7908542128fe4e3b256482a624f0e6bea683..7ac82a49e3c64d1a41a2870c5cf9900812329a57 100644
|
||||
index 9a36ad8112cc4a4d5c4fefcd3b4bf3c48d9d40ee..7aefb6a81d5f7f5431f3d67a096a93b036bbbd1d 100644
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -815,12 +815,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -795,12 +795,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
return this.settings.getProperties().serverResourcePackInfo;
|
||||
}
|
||||
|
||||
@@ -1479,7 +1479,7 @@ index 3c7159d0981c948e71a5612ba4083accb5849ed4..5f2c27800f047f128857044493a6d932
|
||||
for (Entity entity : passengerEntity.getPassengers()) {
|
||||
this.tickPassenger(passengerEntity, entity, isActive); // Paper - EAR 2
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index 1a9b227b8b3bfda8da8d6dbf125b249cec50d230..a1b4720ef128ba5cbe1466a7a584d4fe501a71f8 100644
|
||||
index ac4e3a66c5979bbd65618eec0c8e0b744f397603..890c295d2318767081580e9aabddedd2535388cc 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -106,8 +106,6 @@ import net.minecraft.util.HashOps;
|
||||
@@ -4134,7 +4134,7 @@ index ce3e5ec505ac37c820436bcf7c7d6452ff015f70..f8b37b4ce54afd61a72e9d18ac323540
|
||||
}
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
||||
index 4f70b066cc4858a248d255db6d58c66afd441d84..9a000a4df5df6e36ae25e6d54bfe7cd725df51dd 100644
|
||||
index 8a7c533e3504e5a19cf374dcb12fe0e69931a002..a086c44afc5b3cb04641b4b9cfe28690f6ca2d7e 100644
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -69,8 +69,6 @@ import net.minecraft.tags.FluidTags;
|
||||
@@ -4163,7 +4163,7 @@ index 4f70b066cc4858a248d255db6d58c66afd441d84..9a000a4df5df6e36ae25e6d54bfe7cd7
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -3371,11 +3366,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
@@ -3364,11 +3359,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
f1 = this.getYRot();
|
||||
}
|
||||
|
||||
@@ -4175,7 +4175,7 @@ index 4f70b066cc4858a248d255db6d58c66afd441d84..9a000a4df5df6e36ae25e6d54bfe7cd7
|
||||
|
||||
// Paper start - stop large pitch and yaw changes from crashing the server
|
||||
this.yRotO += Math.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F;
|
||||
@@ -3387,7 +3378,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
@@ -3380,7 +3371,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F;
|
||||
// Paper end - stop large pitch and yaw changes from crashing the server
|
||||
|
||||
@@ -4183,7 +4183,7 @@ index 4f70b066cc4858a248d255db6d58c66afd441d84..9a000a4df5df6e36ae25e6d54bfe7cd7
|
||||
if (this.isFallFlying()) {
|
||||
this.fallFlyTicks++;
|
||||
} else {
|
||||
@@ -3563,21 +3553,15 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
@@ -3556,21 +3546,15 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
}
|
||||
|
||||
this.setDeltaMovement(d, d1, d2);
|
||||
@@ -4205,7 +4205,7 @@ index 4f70b066cc4858a248d255db6d58c66afd441d84..9a000a4df5df6e36ae25e6d54bfe7cd7
|
||||
if (this.jumping && this.isAffectedByFluids()) {
|
||||
double fluidHeight;
|
||||
if (this.isInLava()) {
|
||||
@@ -3606,8 +3590,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
@@ -3599,8 +3583,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
this.noJumpDelay = 0;
|
||||
}
|
||||
|
||||
@@ -4214,7 +4214,7 @@ index 4f70b066cc4858a248d255db6d58c66afd441d84..9a000a4df5df6e36ae25e6d54bfe7cd7
|
||||
if (this.isFallFlying()) {
|
||||
this.updateFallFlying();
|
||||
}
|
||||
@@ -3632,9 +3614,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
@@ -3625,9 +3607,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
this.calculateEntityAnimation(this instanceof FlyingAnimal);
|
||||
}
|
||||
|
||||
@@ -4224,7 +4224,7 @@ index 4f70b066cc4858a248d255db6d58c66afd441d84..9a000a4df5df6e36ae25e6d54bfe7cd7
|
||||
if ((!this.isInPowderSnow || !this.canFreeze()) && !this.freezeLocked) { // Paper - Freeze Tick Lock API
|
||||
this.setTicksFrozen(Math.max(0, this.getTicksFrozen() - 2));
|
||||
}
|
||||
@@ -3644,18 +3624,14 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
@@ -3637,18 +3617,14 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
if (this.tickCount % 40 == 0 && this.isFullyFrozen() && this.canFreeze()) {
|
||||
this.hurtServer(serverLevel, this.damageSources().freeze(), 1.0F);
|
||||
}
|
||||
@@ -4387,7 +4387,7 @@ index 859b859d29b637200cf7c9a0bd52d9f712413e3d..653c58c7637c46c8b46a5082f671324a
|
||||
|
||||
public Set<WrappedGoal> getAvailableGoals() {
|
||||
diff --git a/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
||||
index 3b29cc4e11efe6f27023f52cfde16fd118c310ad..c8e4ccb96a0f162c780066cf4f61b970b49b7703 100644
|
||||
index dd1a95111d965bcd7f53be9d4224dd213e4e0705..24dd92449f70144c79f25bf24942ebd666655ed2 100644
|
||||
--- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
||||
+++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
||||
@@ -10,8 +10,6 @@ import net.minecraft.core.Vec3i;
|
||||
@@ -5039,7 +5039,7 @@ index 1d3b16d3f60a394fe69e10ef1bb6052bb937070a..d0c4d63320fb5f58c43b38ebc333e9a7
|
||||
|
||||
if (this.fire) {
|
||||
diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index 8084b524dc0c10cb801b6d8beccbde89de9c55d2..53c77efe2f86c5dfb5f02fa0b1886e8cda2e3862 100644
|
||||
index 7425e8d6b352718f80e1e741329e28c5da80fcce..d11373d6a88f7b3baaf0e04d4f6e0d3837e2ba3b 100644
|
||||
--- a/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -24,8 +24,6 @@ import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData;
|
||||
@@ -5051,7 +5051,7 @@ index 8084b524dc0c10cb801b6d8beccbde89de9c55d2..53c77efe2f86c5dfb5f02fa0b1886e8c
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.Level;
|
||||
@@ -392,12 +390,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
@@ -385,12 +383,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
}
|
||||
|
||||
if (LightEngine.hasDifferentLightProperties(blockState, state)) {
|
||||
@@ -5064,7 +5064,7 @@ index 8084b524dc0c10cb801b6d8beccbde89de9c55d2..53c77efe2f86c5dfb5f02fa0b1886e8c
|
||||
}
|
||||
|
||||
boolean flag = !blockState.is(block);
|
||||
@@ -929,8 +923,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
@@ -922,8 +916,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
BlockPos blockPos = this.blockEntity.getBlockPos();
|
||||
if (LevelChunk.this.isTicking(blockPos)) {
|
||||
try {
|
||||
@@ -5073,7 +5073,7 @@ index 8084b524dc0c10cb801b6d8beccbde89de9c55d2..53c77efe2f86c5dfb5f02fa0b1886e8c
|
||||
BlockState blockState = LevelChunk.this.getBlockState(blockPos);
|
||||
if (this.blockEntity.getType().isValid(blockState)) {
|
||||
this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), blockState, this.blockEntity);
|
||||
@@ -944,8 +936,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
@@ -937,8 +929,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
}
|
||||
// Paper end - Remove the Block Entity if it's invalid
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Smooth teleport API
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index a1b4720ef128ba5cbe1466a7a584d4fe501a71f8..b75d2d2746c3e7b12f65b0bcb559cd7e0ce7ebf8 100644
|
||||
index 890c295d2318767081580e9aabddedd2535388cc..8a8d72fa46f4eff31e06e8b1756d286f7f1b07a6 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -430,6 +430,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -17,10 +17,10 @@ index a1b4720ef128ba5cbe1466a7a584d4fe501a71f8..b75d2d2746c3e7b12f65b0bcb559cd7e
|
||||
// Paper start - rewrite chunk system
|
||||
private ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader;
|
||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||
index c70b5ce2dc8cbcdea8715339a63e038f94849bfb..9362bfdf8f5495d237b1e74be4dd925db2452dc0 100644
|
||||
index 0a2d1a89722094f7e51c33a364b6999143add0a1..fb1b9f75cffeb15875e6690a0e030f8a4fd8b276 100644
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -748,11 +748,11 @@ public abstract class PlayerList {
|
||||
@@ -749,11 +749,11 @@ public abstract class PlayerList {
|
||||
byte b = (byte)(keepInventory ? 1 : 0);
|
||||
ServerLevel serverLevel = serverPlayer.level();
|
||||
LevelData levelData = serverLevel.getLevelData();
|
||||
@@ -34,7 +34,7 @@ index c70b5ce2dc8cbcdea8715339a63e038f94849bfb..9362bfdf8f5495d237b1e74be4dd925d
|
||||
serverPlayer.connection.send(new ClientboundSetDefaultSpawnPositionPacket(level.getSharedSpawnPos(), level.getSharedSpawnAngle()));
|
||||
serverPlayer.connection.send(new ClientboundChangeDifficultyPacket(levelData.getDifficulty(), levelData.isDifficultyLocked()));
|
||||
serverPlayer.connection
|
||||
@@ -839,6 +839,12 @@ public abstract class PlayerList {
|
||||
@@ -840,6 +840,12 @@ public abstract class PlayerList {
|
||||
return serverPlayer;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 01:49:27 +0300
|
||||
Subject: [PATCH] Parchment: Make FixLight use action bar
|
||||
|
||||
Original license: GPLv3
|
||||
Original project: https://github.com/ProjectEdenGG/Parchment
|
||||
|
||||
diff --git a/io/papermc/paper/command/subcommands/FixLightCommand.java b/io/papermc/paper/command/subcommands/FixLightCommand.java
|
||||
index 85950a1aa732ab8c01ad28bec9e0de140e1a172e..fbc38577599dd0e606e2d225ce98943ab49e74f7 100644
|
||||
--- a/io/papermc/paper/command/subcommands/FixLightCommand.java
|
||||
+++ b/io/papermc/paper/command/subcommands/FixLightCommand.java
|
||||
@@ -95,17 +_,22 @@
|
||||
@@ -95,17 +95,23 @@ public final class FixLightCommand implements PaperSubcommand {
|
||||
((StarLightLightingProvider)lightengine).starlight$serverRelightChunks(chunks,
|
||||
(final ChunkPos chunkPos) -> {
|
||||
++relitChunks[0];
|
||||
- sender.getBukkitEntity().sendMessage(text().color(DARK_AQUA).append(
|
||||
- text("Relit chunk ", BLUE), text(chunkPos.toString()),
|
||||
- text(", progress: ", BLUE), text(ONE_DECIMAL_PLACES.get().format(100.0 * (double) (relitChunks[0]) / (double) pending[0]) + "%")
|
||||
- ));
|
||||
+ // DivineMC start - Make FixLight use action bar
|
||||
+ // DivineMC start - Parchment: Make FixLight use action bar
|
||||
+ sender.getBukkitEntity().sendActionBar(text().color(DARK_AQUA).append(
|
||||
+ text("Relighting Chunks: ", DARK_AQUA), text(chunkPos.toString()),
|
||||
+ text(" " + relitChunks[0], net.kyori.adventure.text.format.NamedTextColor.YELLOW),
|
||||
+ text("/", DARK_AQUA),
|
||||
+ text(pending[0] + " ", net.kyori.adventure.text.format.NamedTextColor.YELLOW),
|
||||
+ text("(" + (int) (Math.round(100.0 * (double) (relitChunks[0]) / (double) pending[0])) + "%)", net.kyori.adventure.text.format.NamedTextColor.YELLOW)
|
||||
+ )); // DivineMC end - Make FixLight use action bar
|
||||
));
|
||||
+ // DivineMC end - Parchment: Make FixLight use action bar
|
||||
},
|
||||
(final int totalRelit) -> {
|
||||
final long end = System.nanoTime();
|
||||
@@ -23,10 +33,10 @@
|
||||
- text("Relit ", BLUE), text(totalRelit),
|
||||
- text(" chunks. Took ", BLUE), text(ONE_DECIMAL_PLACES.get().format(1.0e-6 * (end - start)) + "ms")
|
||||
- ));
|
||||
+ // DivineMC start - Make FixLight use action bar
|
||||
+ // DivineMC start - Parchment: Make FixLight use action bar
|
||||
+ text("Relit ", DARK_AQUA), text(totalRelit, net.kyori.adventure.text.format.NamedTextColor.YELLOW),
|
||||
+ text(" chunks. Took ", DARK_AQUA), text(ONE_DECIMAL_PLACES.get().format(1.0e-6 * (end - start)) + "ms", net.kyori.adventure.text.format.NamedTextColor.YELLOW)
|
||||
+ )); // DivineMC end - Make FixLight use action bar
|
||||
+ )); // DivineMC end - Parchment: Make FixLight use action bar
|
||||
if (done != null) {
|
||||
done.run();
|
||||
}
|
||||
@@ -1,7 +1,17 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 02:55:43 +0300
|
||||
Subject: [PATCH] Pufferfish: SIMD support
|
||||
|
||||
Original license: GPL v3
|
||||
Original project: https://github.com/pufferfish-gg/Pufferfish
|
||||
|
||||
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 7aefb6a81d5f7f5431f3d67a096a93b036bbbd1d..7ac82a49e3c64d1a41a2870c5cf9900812329a57 100644
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -195,6 +_,26 @@
|
||||
// Purpur end - Purpur config files
|
||||
@@ -204,6 +204,26 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
// DivineMC end - Configuration
|
||||
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
|
||||
|
||||
+ // DivineMC start - Pufferfish SIMD
|
||||
@@ -27,7 +27,7 @@ index 63fd7b45750430b565d599337d3112cbaa7e7550..4275a2e1e29c15cdda75c29c46825563
|
||||
|
||||
public static Direction getApproximateNearest(double x, double y, double z) {
|
||||
diff --git a/net/minecraft/world/phys/AABB.java b/net/minecraft/world/phys/AABB.java
|
||||
index f60c1ab58a2e9adfb01e9bd430b92cd1902e5dbe..37ad60f2be694c22bfef402c38c8206348bf36a5 100644
|
||||
index e53398996bbb278c6e06024d8ca945b364a44c10..13678a9c0f9056b4925e4de927ec3cbc01cb114e 100644
|
||||
--- a/net/minecraft/world/phys/AABB.java
|
||||
+++ b/net/minecraft/world/phys/AABB.java
|
||||
@@ -19,6 +19,15 @@ public class AABB {
|
||||
@@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 01:51:12 +0300
|
||||
Subject: [PATCH] lithium: entity.fast_hand_swing + entity.fast_elytra_check
|
||||
|
||||
This patch is based on the following mixins:
|
||||
* "net/caffeinemc/mods/lithium/mixin/entity/fast_elytra_check/LivingEntityMixin.java"
|
||||
* "net/caffeinemc/mods/lithium/mixin/entity/fast_hand_swing/LivingEntityMixin.java"
|
||||
By: 2No2Name <2No2Name@web.de>
|
||||
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/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
||||
index a086c44afc5b3cb04641b4b9cfe28690f6ca2d7e..ab2bfe5589547a5e1b7f26ff100609c4464b61c7 100644
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2757,6 +2757,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
}
|
||||
|
||||
protected void updateSwingTime() {
|
||||
+ if (!this.swinging && this.swingTime == 0) return; // DivineMC - lithium: entity.fast_hand_swing
|
||||
int currentSwingDuration = this.getCurrentSwingDuration();
|
||||
if (this.swinging) {
|
||||
this.swingTime++;
|
||||
@@ -3703,6 +3704,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
protected void updateFallFlying() {
|
||||
this.checkFallDistanceAccumulation();
|
||||
if (!this.level().isClientSide) {
|
||||
+ if (!this.isFallFlying() && this.fallFlyTicks == 0) return; // DivineMC - lithium: entity.fast_elytra_check
|
||||
if (!this.canGlide()) {
|
||||
if (this.getSharedFlag(7) != false && !CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) // CraftBukkit
|
||||
this.setSharedFlag(7, false);
|
||||
@@ -1,6 +1,17 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 01:52:18 +0300
|
||||
Subject: [PATCH] lithium: cached_iterate_outwards
|
||||
|
||||
By: 2No2Name <2No2Name@web.de>
|
||||
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/net/minecraft/core/BlockPos.java b/net/minecraft/core/BlockPos.java
|
||||
index 6518d3fff6daf331b24a7bf5b39fa1920b73711d..0dc73d76c2d86e05bedb3eb4f51d638c17390277 100644
|
||||
--- a/net/minecraft/core/BlockPos.java
|
||||
+++ b/net/minecraft/core/BlockPos.java
|
||||
@@ -347,7 +_,18 @@
|
||||
@@ -347,7 +347,18 @@ public class BlockPos extends Vec3i {
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 01:53:38 +0300
|
||||
Subject: [PATCH] C2ME: Reduce Allocations
|
||||
|
||||
This patch is based on the following mixin:
|
||||
"com/ishland/c2me/opts/allocs/mixin/object_pooling_caching/MixinOreFeature.java"
|
||||
By: ishland <ishlandmc@yeah.net>
|
||||
As part of: C2ME (https://github.com/RelativityMC/C2ME-fabric)
|
||||
Licensed under: MIT (https://opensource.org/licenses/MIT)
|
||||
|
||||
diff --git a/net/minecraft/world/level/levelgen/feature/OreFeature.java b/net/minecraft/world/level/levelgen/feature/OreFeature.java
|
||||
index c7b46efd4f08067e2c9c5c8b0e8b71a94a79823d..45d43707909685d2494f054d4b9e6451af6c2f72 100644
|
||||
--- a/net/minecraft/world/level/levelgen/feature/OreFeature.java
|
||||
+++ b/net/minecraft/world/level/levelgen/feature/OreFeature.java
|
||||
@@ -69,7 +69,7 @@ public class OreFeature extends Feature<OreConfiguration> {
|
||||
int height
|
||||
) {
|
||||
int i = 0;
|
||||
- BitSet bitSet = new BitSet(width * height * width);
|
||||
+ BitSet bitSet = org.bxteam.divinemc.util.cache.CachedOrNewBitsGetter.getCachedOrNewBitSet(width * height * width); // DivineMC - C2ME: Reduce Allocations
|
||||
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
|
||||
int i1 = config.size;
|
||||
double[] doubles = new double[i1 * 4];
|
||||
@@ -0,0 +1,68 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 01:55:37 +0300
|
||||
Subject: [PATCH] C2ME: Optimize world gen math
|
||||
|
||||
This patch is based on following mixins:
|
||||
* "com/ishland/c2me/opts/math/mixin/MixinChunkPos.java"
|
||||
* "com/ishland/c2me/opts/worldgen/vanilla/mixin/structure_weight_sampler/MixinStructureWeightSampler.java"
|
||||
By: ishland <ishlandmc@yeah.net>
|
||||
As part of: C2ME-fabric (https://github.com/RelativityMC/C2ME-fabric)
|
||||
Licensed under: MIT
|
||||
|
||||
diff --git a/net/minecraft/world/level/ChunkPos.java b/net/minecraft/world/level/ChunkPos.java
|
||||
index 55ce935a2fab7e32904d9ff599867269035d703f..7770e2aacaa7772a1710172f143452f076c6eef2 100644
|
||||
--- a/net/minecraft/world/level/ChunkPos.java
|
||||
+++ b/net/minecraft/world/level/ChunkPos.java
|
||||
@@ -110,7 +110,12 @@ public class ChunkPos {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
- return this == other || other instanceof ChunkPos chunkPos && this.x == chunkPos.x && this.z == chunkPos.z;
|
||||
+ // DivineMC start - C2ME: Optimize world gen math
|
||||
+ if (other == this) return true;
|
||||
+ if (other == null || other.getClass() != this.getClass()) return false;
|
||||
+ ChunkPos thatPos = (ChunkPos) other;
|
||||
+ return this.x == thatPos.x && this.z == thatPos.z;
|
||||
+ // DivineMC end - C2ME: Optimize world gen math
|
||||
}
|
||||
|
||||
public int getMiddleBlockX() {
|
||||
diff --git a/net/minecraft/world/level/levelgen/Beardifier.java b/net/minecraft/world/level/levelgen/Beardifier.java
|
||||
index 74d8202b5c9bb2a3ee832be70f95c0b5cbecb460..86c15d2d90e63d21cb83622a7b29e11151a4f64a 100644
|
||||
--- a/net/minecraft/world/level/levelgen/Beardifier.java
|
||||
+++ b/net/minecraft/world/level/levelgen/Beardifier.java
|
||||
@@ -131,8 +131,14 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker {
|
||||
}
|
||||
|
||||
private static double getBuryContribution(double x, double y, double z) {
|
||||
- double len = Mth.length(x, y, z);
|
||||
- return Mth.clampedMap(len, 0.0, 6.0, 1.0, 0.0);
|
||||
+ // DivineMC start - C2ME: Optimize world gen math
|
||||
+ double len = Math.sqrt(x * x + y * y + z * z);
|
||||
+ if (len > 6.0) {
|
||||
+ return 0.0;
|
||||
+ } else {
|
||||
+ return 1.0 - len / 6.0;
|
||||
+ }
|
||||
+ // DivineMC end - C2ME: Optimize world gen math
|
||||
}
|
||||
|
||||
private static double getBeardContribution(int x, int y, int z, int height) {
|
||||
diff --git a/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||
index 65728ef17e63d71833677fdcbd5bb90794b4822b..5716e80ba386f113d02f5d6a4848914d4bf9600f 100644
|
||||
--- a/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||
+++ b/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||
@@ -68,8 +68,10 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
|
||||
Aquifer.FluidStatus fluidStatus = new Aquifer.FluidStatus(-54, Blocks.LAVA.defaultBlockState());
|
||||
int seaLevel = settings.seaLevel();
|
||||
Aquifer.FluidStatus fluidStatus1 = new Aquifer.FluidStatus(seaLevel, settings.defaultFluid());
|
||||
- Aquifer.FluidStatus fluidStatus2 = new Aquifer.FluidStatus(DimensionType.MIN_Y * 2, Blocks.AIR.defaultBlockState());
|
||||
- return (x, y, z) -> y < Math.min(-54, seaLevel) ? fluidStatus : fluidStatus1;
|
||||
+ // DivineMC start - C2ME: Optimize world gen math
|
||||
+ final int min = Math.min(-54, seaLevel);
|
||||
+ return (x, y, z) -> y < min ? fluidStatus : fluidStatus1;
|
||||
+ // DivineMC end - C2ME: Optimize world gen math
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Re-Fix MC-117075
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
|
||||
index 6240f6f0799916f1c95505f3dfaeb00812abea70..6e8075618baf98fcc396f0b5e241a806805b3d94 100644
|
||||
index 9625213b7c1295b813071dbedea5366510c7072f..bf38e3bfcb0b96c4529d5e535893043512f52b02 100644
|
||||
--- a/net/minecraft/world/level/Level.java
|
||||
+++ b/net/minecraft/world/level/Level.java
|
||||
@@ -104,7 +104,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
|
||||
@@ -17,7 +17,7 @@ index 6240f6f0799916f1c95505f3dfaeb00812abea70..6e8075618baf98fcc396f0b5e241a806
|
||||
protected final NeighborUpdater neighborUpdater;
|
||||
private final List<TickingBlockEntity> pendingBlockEntityTickers = Lists.newArrayList();
|
||||
private boolean tickingBlockEntities;
|
||||
@@ -1504,13 +1504,11 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
|
||||
@@ -1510,13 +1510,11 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
|
||||
boolean runsNormally = this.tickRateManager().runsNormally();
|
||||
|
||||
int tickedEntities = 0; // Paper - rewrite chunk system
|
||||
@@ -32,7 +32,7 @@ index 6240f6f0799916f1c95505f3dfaeb00812abea70..6e8075618baf98fcc396f0b5e241a806
|
||||
} else if (runsNormally && this.shouldTickBlocksAt(tickingBlockEntity.getPos())) {
|
||||
tickingBlockEntity.tick();
|
||||
// Paper start - rewrite chunk system
|
||||
@@ -1520,7 +1518,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
|
||||
@@ -1526,7 +1524,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
|
||||
// Paper end - rewrite chunk system
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 01:58:51 +0300
|
||||
Subject: [PATCH] Fix MC-119417
|
||||
|
||||
Issue on Mojira: https://bugs.mojang.com/browse/MC/issues/MC-119417
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index 8a8d72fa46f4eff31e06e8b1756d286f7f1b07a6..b75d2d2746c3e7b12f65b0bcb559cd7e0ce7ebf8 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -2218,6 +2218,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, gameMode.getId()));
|
||||
if (gameMode == GameType.SPECTATOR) {
|
||||
this.removeEntitiesOnShoulder();
|
||||
+ this.stopSleeping(); // DivineMC - Fix MC-119417
|
||||
this.stopRiding();
|
||||
EnchantmentHelper.stopLocationBasedEffects(this);
|
||||
} else {
|
||||
@@ -0,0 +1,20 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 01:59:43 +0300
|
||||
Subject: [PATCH] Fix MC-7569
|
||||
|
||||
Issue on Mojira: https://bugs.mojang.com/browse/MC/issues/MC-7569
|
||||
|
||||
diff --git a/net/minecraft/server/rcon/RconConsoleSource.java b/net/minecraft/server/rcon/RconConsoleSource.java
|
||||
index 1fddeb10c5947c52840e55ca66c50dd4ad5425b9..f50d87c5c4c0c3daa38a70213b8a8af963fff312 100644
|
||||
--- a/net/minecraft/server/rcon/RconConsoleSource.java
|
||||
+++ b/net/minecraft/server/rcon/RconConsoleSource.java
|
||||
@@ -51,7 +51,7 @@ public class RconConsoleSource implements CommandSource {
|
||||
|
||||
@Override
|
||||
public void sendSystemMessage(Component component) {
|
||||
- this.buffer.append(component.getString());
|
||||
+ this.buffer.append(component.getString()).append(System.lineSeparator()); // DivineMC - Fix MC-7569
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 02:01:33 +0300
|
||||
Subject: [PATCH] Fix MC-110386
|
||||
|
||||
Issue on Mojira: https://bugs.mojang.com/browse/MC/issues/MC-110386
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java b/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java
|
||||
index a8ec1d5f4b0fb0ff26a234235b7d8d9c4b4a2a98..6251cfface8d4bedd58271ace3947a1631e61b66 100644
|
||||
--- a/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java
|
||||
@@ -114,6 +114,7 @@ public class HurtByTargetGoal extends TargetGoal {
|
||||
}
|
||||
|
||||
protected void alertOther(Mob mob, LivingEntity target) {
|
||||
+ if (mob == target) return; // DivineMC - Fix MC-110386
|
||||
mob.setTarget(target, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY); // CraftBukkit - reason
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,15 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 02:02:47 +0300
|
||||
Subject: [PATCH] Fix MC-200418
|
||||
|
||||
Issue on Mojira: https://bugs.mojang.com/browse/MC/issues/MC-200418
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/ZombieVillager.java b/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
index e218e5d5f146ec996a6f5ce7e76b1d6506ac1cb9..00af89717bf2459b315baf70a515a0e68267fb9f 100644
|
||||
--- a/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
+++ b/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
@@ -292,6 +_,12 @@
|
||||
@@ -292,6 +292,12 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
|
||||
if (!this.isSilent()) {
|
||||
level.levelEvent(null, 1027, this.blockPosition(), 0);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 02:03:37 +0300
|
||||
Subject: [PATCH] Fix MC-31819
|
||||
|
||||
Issue on Mojira: https://bugs.mojang.com/browse/MC/issues/MC-31819
|
||||
|
||||
diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java
|
||||
index 97b104679bb2b9e466caa10d7b022ee6d597e7e5..18b670a1e6e62c3b79281e529c89f35b16427c69 100644
|
||||
--- a/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1818,6 +1818,11 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
|
||||
public void causeFoodExhaustion(float exhaustion, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason reason) {
|
||||
+ // DivineMC start - Fix MC-31819
|
||||
+ if (this.level().getDifficulty() == Difficulty.PEACEFUL) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // DivineMC end - Fix MC-31819
|
||||
// CraftBukkit end
|
||||
if (!this.abilities.invulnerable) {
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -0,0 +1,26 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 02:04:33 +0300
|
||||
Subject: [PATCH] Fix MC-172801
|
||||
|
||||
Issue on Mojira: https://bugs.mojang.com/browse/MC/issues/MC-172801
|
||||
|
||||
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
||||
index ab2bfe5589547a5e1b7f26ff100609c4464b61c7..4149e7eb6f583d80ed179b190dcc02acf1144bef 100644
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3274,7 +3274,13 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
}
|
||||
|
||||
protected float getFlyingSpeed() {
|
||||
- return this.getControllingPassenger() instanceof net.minecraft.world.entity.player.Player ? this.getSpeed() * 0.1F : 0.02F;
|
||||
+ // DivineMC start - Fix MC-172801
|
||||
+ float flyingSpeed = 0.02F;
|
||||
+ if (this.getAttributes().hasAttribute(Attributes.FLYING_SPEED)) {
|
||||
+ flyingSpeed = (float) (this.getAttribute(Attributes.FLYING_SPEED).getValue() * 0.049999999254942D);
|
||||
+ }
|
||||
+ return this.getControllingPassenger() instanceof net.minecraft.world.entity.player.Player ? this.getSpeed() * 0.1F : flyingSpeed;
|
||||
+ // DivineMC end - Fix MC-172801
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
@@ -1,6 +1,15 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 02:08:04 +0300
|
||||
Subject: [PATCH] Fix MC-258859
|
||||
|
||||
Issue on Mojira: https://bugs.mojang.com/browse/MC/issues/MC-258859
|
||||
|
||||
diff --git a/net/minecraft/world/level/levelgen/SurfaceRules.java b/net/minecraft/world/level/levelgen/SurfaceRules.java
|
||||
index 0948c8db90605a15a043b5c5bc74edecd7f9db1b..32757c6847cf77862a2f1b38cc53e7166e6be492 100644
|
||||
--- a/net/minecraft/world/level/levelgen/SurfaceRules.java
|
||||
+++ b/net/minecraft/world/level/levelgen/SurfaceRules.java
|
||||
@@ -397,6 +_,22 @@
|
||||
@@ -397,6 +397,22 @@ public class SurfaceRules {
|
||||
|
||||
@Override
|
||||
protected boolean compute() {
|
||||
@@ -0,0 +1,38 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 02:10:59 +0300
|
||||
Subject: [PATCH] SparklyPaper: Clear dirty stats after copying
|
||||
|
||||
Original project: https://github.com/SparklyPower/SparklyPaper
|
||||
|
||||
diff --git a/net/minecraft/stats/ServerStatsCounter.java b/net/minecraft/stats/ServerStatsCounter.java
|
||||
index 16e06085ed3c0f6a0b35c730b63b75824f44a905..b2d8f5d146ec10d34a4e71cbfc975fb68e5a8d04 100644
|
||||
--- a/net/minecraft/stats/ServerStatsCounter.java
|
||||
+++ b/net/minecraft/stats/ServerStatsCounter.java
|
||||
@@ -98,12 +98,6 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
this.dirty.add(stat);
|
||||
}
|
||||
|
||||
- private Set<Stat<?>> getDirty() {
|
||||
- Set<Stat<?>> set = Sets.newHashSet(this.dirty);
|
||||
- this.dirty.clear();
|
||||
- return set;
|
||||
- }
|
||||
-
|
||||
public void parseLocal(DataFixer fixerUpper, String json) {
|
||||
try {
|
||||
JsonElement jsonElement = StrictJsonParser.parse(json);
|
||||
@@ -139,10 +133,12 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
public void sendStats(ServerPlayer player) {
|
||||
Object2IntMap<Stat<?>> map = new Object2IntOpenHashMap<>();
|
||||
|
||||
- for (Stat<?> stat : this.getDirty()) {
|
||||
+ for (Stat<?> stat : this.dirty) { // DivineMC - SparklyPaper: Skip dirty stats copy when requesting player stats
|
||||
map.put(stat, this.getValue(stat));
|
||||
}
|
||||
|
||||
+ this.dirty.clear(); // DivineMC - SparklyPaper: Clear dirty stats after copying
|
||||
+
|
||||
player.connection.send(new ClientboundAwardStatsPacket(map));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 02:23:03 +0300
|
||||
Subject: [PATCH] lithium: faster chunk serialization
|
||||
|
||||
This patch is based on the following mixins and classes:
|
||||
* "net/caffeinemc/mods/lithium/common/world/chunk/CompactingPackedIntegerArray.java"
|
||||
* "net/caffeinemc/mods/lithium/common/world/chunk/LithiumHashPalette.java"
|
||||
* "net/caffeinemc/mods/lithium/mixin/chunk/serialization/SimpleBitStorageMixin.java"
|
||||
* "net/caffeinemc/mods/lithium/mixin/chunk/serialization/PalettedContainerMixin.java"
|
||||
By: Angeline <jellysquid3@users.noreply.github.com>
|
||||
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/net/minecraft/util/BitStorage.java b/net/minecraft/util/BitStorage.java
|
||||
index 02502d50f0255f5bbcc0ecb965abb48cc1a112da..a0a0ec8747cf6477df8943d2268dece8e064cb33 100644
|
||||
--- a/net/minecraft/util/BitStorage.java
|
||||
+++ b/net/minecraft/util/BitStorage.java
|
||||
@@ -38,4 +38,6 @@ public interface BitStorage extends ca.spottedleaf.moonrise.patches.block_counti
|
||||
return ret;
|
||||
}
|
||||
// Paper end - block counting
|
||||
+
|
||||
+ <T> void compact(net.minecraft.world.level.chunk.Palette<T> srcPalette, net.minecraft.world.level.chunk.Palette<T> dstPalette, short[] out); // DivineMC - lithium: faster chunk serialization
|
||||
}
|
||||
diff --git a/net/minecraft/util/SimpleBitStorage.java b/net/minecraft/util/SimpleBitStorage.java
|
||||
index e6306a68c8652d4c5d22d5ecb1416f5f931f76ee..1d8125e23e34a929da6fb4e361eae3ccbaeabce9 100644
|
||||
--- a/net/minecraft/util/SimpleBitStorage.java
|
||||
+++ b/net/minecraft/util/SimpleBitStorage.java
|
||||
@@ -465,4 +465,44 @@ public class SimpleBitStorage implements BitStorage {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // DivineMC start - lithium: faster chunk serialization
|
||||
+ @Override
|
||||
+ public <T> void compact(net.minecraft.world.level.chunk.Palette<T> srcPalette, net.minecraft.world.level.chunk.Palette<T> dstPalette, short[] out) {
|
||||
+ if (this.size >= Short.MAX_VALUE) {
|
||||
+ throw new IllegalStateException("Array too large");
|
||||
+ }
|
||||
+
|
||||
+ if (this.size != out.length) {
|
||||
+ throw new IllegalStateException("Array size mismatch");
|
||||
+ }
|
||||
+
|
||||
+ short[] mappings = new short[(int) (this.mask + 1)];
|
||||
+
|
||||
+ int idx = 0;
|
||||
+
|
||||
+ for (long word : this.data) {
|
||||
+ long bits = word;
|
||||
+
|
||||
+ for (int elementIdx = 0; elementIdx < this.valuesPerLong; ++elementIdx) {
|
||||
+ int value = (int) (bits & this.mask);
|
||||
+ int remappedId = mappings[value];
|
||||
+
|
||||
+ if (remappedId == 0) {
|
||||
+ remappedId = dstPalette.idFor(srcPalette.valueFor(value)) + 1;
|
||||
+ mappings[value] = (short) remappedId;
|
||||
+ }
|
||||
+
|
||||
+ out[idx] = (short) (remappedId - 1);
|
||||
+ bits >>= this.bits;
|
||||
+
|
||||
+ ++idx;
|
||||
+
|
||||
+ if (idx >= this.size) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // DivineMC end - lithium: faster chunk serialization
|
||||
}
|
||||
diff --git a/net/minecraft/util/ZeroBitStorage.java b/net/minecraft/util/ZeroBitStorage.java
|
||||
index 09fd99c9cbd23b5f3c899bfb00c9b89651948ed8..6e264b311894f510112beb996190f5ff6943e5e8 100644
|
||||
--- a/net/minecraft/util/ZeroBitStorage.java
|
||||
+++ b/net/minecraft/util/ZeroBitStorage.java
|
||||
@@ -80,4 +80,6 @@ public class ZeroBitStorage implements BitStorage {
|
||||
return ret;
|
||||
}
|
||||
// Paper end - block counting
|
||||
+
|
||||
+ @Override public <T> void compact(net.minecraft.world.level.chunk.Palette<T> srcPalette, net.minecraft.world.level.chunk.Palette<T> dstPalette, short[] out) { } // DivineMC - lithium: faster chunk serialization
|
||||
}
|
||||
diff --git a/net/minecraft/world/level/chunk/PalettedContainer.java b/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
index baa006132b1fa3d73fd4a14f6bc747a3957d1a0c..be11a87ab1badca64219d74bc7a4f5d51b818a8c 100644
|
||||
--- a/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
+++ b/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
@@ -32,6 +32,23 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
public final PalettedContainer.Strategy strategy;
|
||||
//private final ThreadingDetector threadingDetector = new ThreadingDetector("PalettedContainer"); // Paper - unused
|
||||
|
||||
+ // DivineMC start - lithium: faster chunk serialization
|
||||
+ private static final ThreadLocal<short[]> CACHED_ARRAY_4096 = ThreadLocal.withInitial(() -> new short[4096]);
|
||||
+ private static final ThreadLocal<short[]> CACHED_ARRAY_64 = ThreadLocal.withInitial(() -> new short[64]);
|
||||
+
|
||||
+ private Optional<LongStream> asOptional(long[] data) {
|
||||
+ return Optional.of(Arrays.stream(data));
|
||||
+ }
|
||||
+
|
||||
+ private short[] getOrCreate(int size) {
|
||||
+ return switch (size) {
|
||||
+ case 64 -> CACHED_ARRAY_64.get();
|
||||
+ case 4096 -> CACHED_ARRAY_4096.get();
|
||||
+ default -> new short[size];
|
||||
+ };
|
||||
+ }
|
||||
+ // DivineMC end - lithium: faster chunk serialization
|
||||
+
|
||||
public void acquire() {
|
||||
// this.threadingDetector.checkAndLock(); // Paper - disable this - use proper synchronization
|
||||
}
|
||||
@@ -343,28 +360,49 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
public synchronized PalettedContainerRO.PackedData<T> pack(IdMap<T> registry, PalettedContainer.Strategy strategy) { // Paper - synchronize
|
||||
this.acquire();
|
||||
|
||||
- PalettedContainerRO.PackedData var12;
|
||||
+ // DivineMC start - lithium: faster chunk serialization
|
||||
+ Optional<LongStream> data = Optional.empty();
|
||||
+ List<T> elements = null;
|
||||
try {
|
||||
- HashMapPalette<T> hashMapPalette = new HashMapPalette<>(registry, this.data.storage.getBits(), this.dummyPaletteResize);
|
||||
- int size = strategy.size();
|
||||
- int[] ints = new int[size];
|
||||
- this.data.storage.unpack(ints);
|
||||
- swapPalette(ints, id -> hashMapPalette.idFor(this.data.palette.valueFor(id)));
|
||||
- int i = strategy.calculateBitsForSerialization(registry, hashMapPalette.getSize());
|
||||
- Optional<LongStream> optional;
|
||||
- if (i != 0) {
|
||||
- SimpleBitStorage simpleBitStorage = new SimpleBitStorage(i, size, ints);
|
||||
- optional = Optional.of(Arrays.stream(simpleBitStorage.getRaw()));
|
||||
- } else {
|
||||
- optional = Optional.empty();
|
||||
+ net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette<T> hashPalette = null;
|
||||
+
|
||||
+ final Palette<T> palette = this.data.palette();
|
||||
+ final BitStorage storage = this.data.storage();
|
||||
+ if (storage instanceof ZeroBitStorage || palette.getSize() == 1) {
|
||||
+ elements = List.of(palette.valueFor(0));
|
||||
+ } else if (palette instanceof net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette<T> lithiumHashPalette) {
|
||||
+ hashPalette = lithiumHashPalette;
|
||||
}
|
||||
|
||||
- var12 = new PalettedContainerRO.PackedData<>(hashMapPalette.getEntries(), optional);
|
||||
+ if (elements == null) {
|
||||
+ net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette<T> compactedPalette = new net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette<>(registry, storage.getBits(), this.dummyPaletteResize);
|
||||
+ short[] array = this.getOrCreate(strategy.size());
|
||||
+
|
||||
+ storage.compact(this.data.palette(), compactedPalette, array);
|
||||
+
|
||||
+ if (hashPalette != null && hashPalette.getSize() == compactedPalette.getSize() && storage.getBits() == strategy.calculateBitsForSerialization(registry, hashPalette.getSize())) { // paletteSize can de-sync from palette - see https://github.com/CaffeineMC/lithium-fabric/issues/279
|
||||
+ data = this.asOptional(storage.getRaw().clone());
|
||||
+ elements = hashPalette.getElements();
|
||||
+ } else {
|
||||
+ int bits = strategy.calculateBitsForSerialization(registry, compactedPalette.getSize());
|
||||
+ if (bits != 0) {
|
||||
+ SimpleBitStorage copy = new SimpleBitStorage(bits, array.length);
|
||||
+ for (int i = 0; i < array.length; ++i) {
|
||||
+ copy.set(i, array[i]);
|
||||
+ }
|
||||
+
|
||||
+ data = this.asOptional(copy.getRaw());
|
||||
+ }
|
||||
+
|
||||
+ elements = compactedPalette.getElements();
|
||||
+ }
|
||||
+ }
|
||||
} finally {
|
||||
this.release();
|
||||
}
|
||||
|
||||
- return var12;
|
||||
+ return new PalettedContainerRO.PackedData<>(elements, data);
|
||||
+ // DivineMC end - lithium: faster chunk serialization
|
||||
}
|
||||
|
||||
private static <T> void swapPalette(int[] bits, IntUnaryOperator operator) {
|
||||
@@ -404,13 +442,31 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
|
||||
@Override
|
||||
public void count(PalettedContainer.CountConsumer<T> countConsumer) {
|
||||
- if (this.data.palette.getSize() == 1) {
|
||||
- countConsumer.accept(this.data.palette.valueFor(0), this.data.storage.getSize());
|
||||
- } else {
|
||||
- Int2IntOpenHashMap map = new Int2IntOpenHashMap();
|
||||
- this.data.storage.getAll(id -> map.addTo(id, 1));
|
||||
- map.int2IntEntrySet().forEach(idEntry -> countConsumer.accept(this.data.palette.valueFor(idEntry.getIntKey()), idEntry.getIntValue()));
|
||||
+ // DivineMC start - lithium: faster chunk serialization
|
||||
+ int len = this.data.palette().getSize();
|
||||
+
|
||||
+ if (len > 4096) {
|
||||
+ if (this.data.palette.getSize() == 1) {
|
||||
+ countConsumer.accept(this.data.palette.valueFor(0), this.data.storage.getSize());
|
||||
+ } else {
|
||||
+ Int2IntOpenHashMap map = new Int2IntOpenHashMap();
|
||||
+ this.data.storage.getAll(id -> map.addTo(id, 1));
|
||||
+ map.int2IntEntrySet().forEach(idEntry -> countConsumer.accept(this.data.palette.valueFor(idEntry.getIntKey()), idEntry.getIntValue()));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ short[] counts = new short[len];
|
||||
+
|
||||
+ this.data.storage().getAll(i -> counts[i]++);
|
||||
+
|
||||
+ for (int i = 0; i < counts.length; i++) {
|
||||
+ T obj = this.data.palette().valueFor(i);
|
||||
+
|
||||
+ if (obj != null) {
|
||||
+ countConsumer.accept(obj, counts[i]);
|
||||
+ }
|
||||
}
|
||||
+ // DivineMC end - lithium: faster chunk serialization
|
||||
}
|
||||
|
||||
record Configuration<T>(Palette.Factory factory, int bits) {
|
||||
@@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 02:26:11 +0300
|
||||
Subject: [PATCH] lithium: skip useless secondary poi sensor
|
||||
|
||||
This patch is based on the following mixin:
|
||||
"net/caffeinemc/mods/lithium/mixin/ai/sensor/secondary_poi/SecondaryPoiSensorMixin.java"
|
||||
By: 2No2Name <2No2Name@web.de>
|
||||
As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
|
||||
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
||||
|
||||
Lithium description:
|
||||
|
||||
villagers that have no secondary POI (farmland) do not search for it
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java b/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
|
||||
index dc4a9ddb8479e9d0c4895b19d7d677cdd8ad3faa..c3911232667ae9e1f70397f6ff5e7608694248fa 100644
|
||||
--- a/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
|
||||
+++ b/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
|
||||
@@ -22,6 +22,12 @@ public class SecondaryPoiSensor extends Sensor<Villager> {
|
||||
|
||||
@Override
|
||||
protected void doTick(ServerLevel level, Villager entity) {
|
||||
+ // DivineMC start - lithium: skip useless secondary poi sensor
|
||||
+ if (org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.skipUselessSecondaryPoiSensor && entity.getVillagerData().profession().value().secondaryPoi().isEmpty()) {
|
||||
+ entity.getBrain().eraseMemory(MemoryModuleType.SECONDARY_JOB_SITE);
|
||||
+ return;
|
||||
+ }
|
||||
+ // DivineMC end - lithium: skip useless secondary poi sensor
|
||||
// Purpur start - Option for Villager Clerics to farm Nether Wart - make sure clerics don't wander to soul sand when the option is off
|
||||
Brain<?> brain = entity.getBrain();
|
||||
if (!level.purpurConfig.villagerClericsFarmWarts && entity.getVillagerData().profession().is(net.minecraft.world.entity.npc.VillagerProfession.CLERIC)) {
|
||||
@@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 02:30:53 +0300
|
||||
Subject: [PATCH] VMP: skip entity move if movement is zero
|
||||
|
||||
This patch is based on the following mixin:
|
||||
"com/ishland/vmp/mixins/entity/move_zero_velocity/MixinEntity.java"
|
||||
By: ishland <ishlandmc@yeah.net>
|
||||
As part of: VMP (https://github.com/RelativityMC/VMP-fabric)
|
||||
Licensed under: MIT (https://opensource.org/licenses/MIT)
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index f8b37b4ce54afd61a72e9d18ac323540431c655d..54307d5795d3cf36c3a39ff7fd21c92b46626c17 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -372,6 +372,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
public boolean isTemporarilyActive;
|
||||
public long activatedImmunityTick = Integer.MIN_VALUE;
|
||||
public @Nullable Boolean immuneToFire = null; // Purpur - Fire immune API
|
||||
+ private boolean boundingBoxChanged = false; // DivineMC - VMP: skip entity move if movement is zero
|
||||
|
||||
public void inactiveTick() {
|
||||
}
|
||||
@@ -1119,6 +1120,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
// Paper end - detailed watchdog information
|
||||
|
||||
public void move(MoverType type, Vec3 movement) {
|
||||
+ if (!this.boundingBoxChanged && movement.equals(Vec3.ZERO)) return; // DivineMC - VMP: skip entity move if movement is zero
|
||||
final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity
|
||||
// Paper start - detailed watchdog information
|
||||
ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread("Cannot move an entity off-main");
|
||||
@@ -4426,6 +4428,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
public final void setBoundingBox(AABB bb) {
|
||||
+ if (!this.bb.equals(bb)) this.boundingBoxChanged = true; // DivineMC - VMP: skip entity move if movement is zero
|
||||
// CraftBukkit start - block invalid bounding boxes
|
||||
double minX = bb.minX,
|
||||
minY = bb.minY,
|
||||
@@ -0,0 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 02:33:29 +0300
|
||||
Subject: [PATCH] VMP: store mob counts in an array
|
||||
|
||||
This patch is based on the following mixin:
|
||||
"com/ishland/vmp/mixins/general/spawn_density_cap/MixinSpawnDensityCapperDensityCap.java"
|
||||
By: ishland <ishlandmc@yeah.net>
|
||||
As part of: VMP (https://github.com/RelativityMC/VMP-fabric)
|
||||
Licensed under: MIT (https://opensource.org/licenses/MIT)
|
||||
|
||||
diff --git a/net/minecraft/world/level/LocalMobCapCalculator.java b/net/minecraft/world/level/LocalMobCapCalculator.java
|
||||
index 9641219c190261dea0db5f95f040a705ba0a3ff9..d9fe183dbf072f82afae63792967d6e7953d7151 100644
|
||||
--- a/net/minecraft/world/level/LocalMobCapCalculator.java
|
||||
+++ b/net/minecraft/world/level/LocalMobCapCalculator.java
|
||||
@@ -42,14 +42,14 @@ public class LocalMobCapCalculator {
|
||||
}
|
||||
|
||||
static class MobCounts {
|
||||
- private final Object2IntMap<MobCategory> counts = new Object2IntOpenHashMap<>(MobCategory.values().length);
|
||||
+ private final int[] counts = new int[MobCategory.values().length]; // DivineMC - VMP: store mob counts in an array
|
||||
|
||||
public void add(MobCategory category) {
|
||||
- this.counts.computeInt(category, (key, value) -> value == null ? 1 : value + 1);
|
||||
+ this.counts[category.ordinal()]++; // DivineMC - VMP: store mob counts in an array
|
||||
}
|
||||
|
||||
public boolean canSpawn(MobCategory category) {
|
||||
- return this.counts.getOrDefault(category, 0) < category.getMaxInstancesPerChunk();
|
||||
+ return this.counts[category.ordinal()] < category.getMaxInstancesPerChunk(); // DivineMC - VMP: store mob counts in an array
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 02:38:39 +0300
|
||||
Subject: [PATCH] C2ME: optimize noise generation
|
||||
|
||||
This patch is based on the following mixins:
|
||||
* "com/ishland/c2me/opts/math/mixin/MixinOctavePerlinNoiseSampler.java"
|
||||
* "com/ishland/c2me/opts/math/mixin/MixinPerlinNoiseSampler.java"
|
||||
By: ishland <ishlandmc@yeah.net>
|
||||
As part of: C2ME (https://github.com/RelativityMC/C2ME-fabric)
|
||||
Licensed under: MIT (https://opensource.org/licenses/MIT)
|
||||
|
||||
diff --git a/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java b/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java
|
||||
index 46e98a99442523614284150964ba528d0c91493f..55ae29a5e846bb2a6d6991ce071aefe6a8113ebb 100644
|
||||
--- a/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java
|
||||
+++ b/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java
|
||||
@@ -11,6 +11,27 @@ public final class ImprovedNoise {
|
||||
public final double yo;
|
||||
public final double zo;
|
||||
|
||||
+ // DivineMC start - C2ME: optimize noise generation
|
||||
+ private static final double[] FLAT_SIMPLEX_GRAD = new double[]{
|
||||
+ 1, 1, 0, 0,
|
||||
+ -1, 1, 0, 0,
|
||||
+ 1, -1, 0, 0,
|
||||
+ -1, -1, 0, 0,
|
||||
+ 1, 0, 1, 0,
|
||||
+ -1, 0, 1, 0,
|
||||
+ 1, 0, -1, 0,
|
||||
+ -1, 0, -1, 0,
|
||||
+ 0, 1, 1, 0,
|
||||
+ 0, -1, 1, 0,
|
||||
+ 0, 1, -1, 0,
|
||||
+ 0, -1, -1, 0,
|
||||
+ 1, 1, 0, 0,
|
||||
+ 0, -1, 1, 0,
|
||||
+ -1, 1, 0, 0,
|
||||
+ 0, -1, -1, 0,
|
||||
+ };
|
||||
+ // DivineMC end - C2ME: optimize noise generation
|
||||
+
|
||||
public ImprovedNoise(RandomSource random) {
|
||||
this.xo = random.nextDouble() * 256.0;
|
||||
this.yo = random.nextDouble() * 256.0;
|
||||
@@ -38,9 +59,11 @@ public final class ImprovedNoise {
|
||||
double d = x + this.xo;
|
||||
double d1 = y + this.yo;
|
||||
double d2 = z + this.zo;
|
||||
- int floor = Mth.floor(d);
|
||||
- int floor1 = Mth.floor(d1);
|
||||
- int floor2 = Mth.floor(d2);
|
||||
+ // DivineMC start - C2ME: optimize noise generation
|
||||
+ double floor = Math.floor(d);
|
||||
+ double floor1 = Math.floor(d1);
|
||||
+ double floor2 = Math.floor(d2);
|
||||
+ // DivineMC end - C2ME: optimize noise generation
|
||||
double d3 = d - floor;
|
||||
double d4 = d1 - floor1;
|
||||
double d5 = d2 - floor2;
|
||||
@@ -53,25 +76,27 @@ public final class ImprovedNoise {
|
||||
d6 = d4;
|
||||
}
|
||||
|
||||
- d7 = Mth.floor(d6 / yScale + 1.0E-7F) * yScale;
|
||||
+ d7 = Math.floor(d6 / yScale + 1.0E-7F) * yScale; // DivineMC - C2ME: optimize noise generation
|
||||
} else {
|
||||
d7 = 0.0;
|
||||
}
|
||||
|
||||
- return this.sampleAndLerp(floor, floor1, floor2, d3, d4 - d7, d5, d4);
|
||||
+ return this.sampleAndLerp((int) floor, (int) floor1, (int) floor2, d3, d4 - d7, d5, d4); // DivineMC - C2ME: optimize noise generation
|
||||
}
|
||||
|
||||
public double noiseWithDerivative(double x, double y, double z, double[] values) {
|
||||
double d = x + this.xo;
|
||||
double d1 = y + this.yo;
|
||||
double d2 = z + this.zo;
|
||||
- int floor = Mth.floor(d);
|
||||
- int floor1 = Mth.floor(d1);
|
||||
- int floor2 = Mth.floor(d2);
|
||||
+ // DivineMC start - C2ME: optimize noise generation
|
||||
+ double floor = Math.floor(d);
|
||||
+ double floor1 = Math.floor(d1);
|
||||
+ double floor2 = Math.floor(d2);
|
||||
+ // DivineMC end - C2ME: optimize noise generation
|
||||
double d3 = d - floor;
|
||||
double d4 = d1 - floor1;
|
||||
double d5 = d2 - floor2;
|
||||
- return this.sampleWithDerivative(floor, floor1, floor2, d3, d4, d5, values);
|
||||
+ return this.sampleWithDerivative((int) floor, (int) floor1, (int) floor2, d3, d4, d5, values); // DivineMC - C2ME: optimize noise generation
|
||||
}
|
||||
|
||||
private static double gradDot(int gradIndex, double xFactor, double yFactor, double zFactor) {
|
||||
@@ -83,24 +108,69 @@ public final class ImprovedNoise {
|
||||
}
|
||||
|
||||
private double sampleAndLerp(int gridX, int gridY, int gridZ, double deltaX, double weirdDeltaY, double deltaZ, double deltaY) {
|
||||
- int i = this.p(gridX);
|
||||
- int i1 = this.p(gridX + 1);
|
||||
- int i2 = this.p(i + gridY);
|
||||
- int i3 = this.p(i + gridY + 1);
|
||||
- int i4 = this.p(i1 + gridY);
|
||||
- int i5 = this.p(i1 + gridY + 1);
|
||||
- double d = gradDot(this.p(i2 + gridZ), deltaX, weirdDeltaY, deltaZ);
|
||||
- double d1 = gradDot(this.p(i4 + gridZ), deltaX - 1.0, weirdDeltaY, deltaZ);
|
||||
- double d2 = gradDot(this.p(i3 + gridZ), deltaX, weirdDeltaY - 1.0, deltaZ);
|
||||
- double d3 = gradDot(this.p(i5 + gridZ), deltaX - 1.0, weirdDeltaY - 1.0, deltaZ);
|
||||
- double d4 = gradDot(this.p(i2 + gridZ + 1), deltaX, weirdDeltaY, deltaZ - 1.0);
|
||||
- double d5 = gradDot(this.p(i4 + gridZ + 1), deltaX - 1.0, weirdDeltaY, deltaZ - 1.0);
|
||||
- double d6 = gradDot(this.p(i3 + gridZ + 1), deltaX, weirdDeltaY - 1.0, deltaZ - 1.0);
|
||||
- double d7 = gradDot(this.p(i5 + gridZ + 1), deltaX - 1.0, weirdDeltaY - 1.0, deltaZ - 1.0);
|
||||
- double d8 = Mth.smoothstep(deltaX);
|
||||
- double d9 = Mth.smoothstep(deltaY);
|
||||
- double d10 = Mth.smoothstep(deltaZ);
|
||||
- return Mth.lerp3(d8, d9, d10, d, d1, d2, d3, d4, d5, d6, d7);
|
||||
+ // DivineMC start - C2ME: optimize noise generation
|
||||
+ final int var0 = gridX & 0xFF;
|
||||
+ final int var1 = (gridX + 1) & 0xFF;
|
||||
+ final int var2 = this.p[var0] & 0xFF;
|
||||
+ final int var3 = this.p[var1] & 0xFF;
|
||||
+ final int var4 = (var2 + gridY) & 0xFF;
|
||||
+ final int var5 = (var3 + gridY) & 0xFF;
|
||||
+ final int var6 = (var2 + gridY + 1) & 0xFF;
|
||||
+ final int var7 = (var3 + gridY + 1) & 0xFF;
|
||||
+ final int var8 = this.p[var4] & 0xFF;
|
||||
+ final int var9 = this.p[var5] & 0xFF;
|
||||
+ final int var10 = this.p[var6] & 0xFF;
|
||||
+ final int var11 = this.p[var7] & 0xFF;
|
||||
+
|
||||
+ final int var12 = (var8 + gridZ) & 0xFF;
|
||||
+ final int var13 = (var9 + gridZ) & 0xFF;
|
||||
+ final int var14 = (var10 + gridZ) & 0xFF;
|
||||
+ final int var15 = (var11 + gridZ) & 0xFF;
|
||||
+ final int var16 = (var8 + gridZ + 1) & 0xFF;
|
||||
+ final int var17 = (var9 + gridZ + 1) & 0xFF;
|
||||
+ final int var18 = (var10 + gridZ + 1) & 0xFF;
|
||||
+ final int var19 = (var11 + gridZ + 1) & 0xFF;
|
||||
+ final int var20 = (this.p[var12] & 15) << 2;
|
||||
+ final int var21 = (this.p[var13] & 15) << 2;
|
||||
+ final int var22 = (this.p[var14] & 15) << 2;
|
||||
+ final int var23 = (this.p[var15] & 15) << 2;
|
||||
+ final int var24 = (this.p[var16] & 15) << 2;
|
||||
+ final int var25 = (this.p[var17] & 15) << 2;
|
||||
+ final int var26 = (this.p[var18] & 15) << 2;
|
||||
+ final int var27 = (this.p[var19] & 15) << 2;
|
||||
+ final double var60 = deltaX - 1.0;
|
||||
+ final double var61 = weirdDeltaY - 1.0;
|
||||
+ final double var62 = deltaZ - 1.0;
|
||||
+ final double var87 = FLAT_SIMPLEX_GRAD[(var20) | 0] * deltaX + FLAT_SIMPLEX_GRAD[(var20) | 1] * weirdDeltaY + FLAT_SIMPLEX_GRAD[(var20) | 2] * deltaZ;
|
||||
+ final double var88 = FLAT_SIMPLEX_GRAD[(var21) | 0] * var60 + FLAT_SIMPLEX_GRAD[(var21) | 1] * weirdDeltaY + FLAT_SIMPLEX_GRAD[(var21) | 2] * deltaZ;
|
||||
+ final double var89 = FLAT_SIMPLEX_GRAD[(var22) | 0] * deltaX + FLAT_SIMPLEX_GRAD[(var22) | 1] * var61 + FLAT_SIMPLEX_GRAD[(var22) | 2] * deltaZ;
|
||||
+ final double var90 = FLAT_SIMPLEX_GRAD[(var23) | 0] * var60 + FLAT_SIMPLEX_GRAD[(var23) | 1] * var61 + FLAT_SIMPLEX_GRAD[(var23) | 2] * deltaZ;
|
||||
+ final double var91 = FLAT_SIMPLEX_GRAD[(var24) | 0] * deltaX + FLAT_SIMPLEX_GRAD[(var24) | 1] * weirdDeltaY + FLAT_SIMPLEX_GRAD[(var24) | 2] * var62;
|
||||
+ final double var92 = FLAT_SIMPLEX_GRAD[(var25) | 0] * var60 + FLAT_SIMPLEX_GRAD[(var25) | 1] * weirdDeltaY + FLAT_SIMPLEX_GRAD[(var25) | 2] * var62;
|
||||
+ final double var93 = FLAT_SIMPLEX_GRAD[(var26) | 0] * deltaX + FLAT_SIMPLEX_GRAD[(var26) | 1] * var61 + FLAT_SIMPLEX_GRAD[(var26) | 2] * var62;
|
||||
+ final double var94 = FLAT_SIMPLEX_GRAD[(var27) | 0] * var60 + FLAT_SIMPLEX_GRAD[(var27) | 1] * var61 + FLAT_SIMPLEX_GRAD[(var27) | 2] * var62;
|
||||
+
|
||||
+ final double var95 = deltaX * 6.0 - 15.0;
|
||||
+ final double var96 = deltaY * 6.0 - 15.0;
|
||||
+ final double var97 = deltaZ * 6.0 - 15.0;
|
||||
+ final double var98 = deltaX * var95 + 10.0;
|
||||
+ final double var99 = deltaY * var96 + 10.0;
|
||||
+ final double var100 = deltaZ * var97 + 10.0;
|
||||
+ final double var101 = deltaX * deltaX * deltaX * var98;
|
||||
+ final double var102 = deltaY * deltaY * deltaY * var99;
|
||||
+ final double var103 = deltaZ * deltaZ * deltaZ * var100;
|
||||
+
|
||||
+ final double var113 = var87 + var101 * (var88 - var87);
|
||||
+ final double var114 = var93 + var101 * (var94 - var93);
|
||||
+ final double var115 = var91 + var101 * (var92 - var91);
|
||||
+ final double var116 = var89 + var101 * (var90 - var89);
|
||||
+ final double var117 = var114 - var115;
|
||||
+ final double var118 = var102 * (var116 - var113);
|
||||
+ final double var119 = var102 * var117;
|
||||
+ final double var120 = var113 + var118;
|
||||
+ final double var121 = var115 + var119;
|
||||
+ return var120 + (var103 * (var121 - var120));
|
||||
+ // DivineMC end - C2ME: optimize noise generation
|
||||
}
|
||||
|
||||
private double sampleWithDerivative(int gridX, int gridY, int gridZ, double deltaX, double deltaY, double deltaZ, double[] noiseValues) {
|
||||
diff --git a/net/minecraft/world/level/levelgen/synth/PerlinNoise.java b/net/minecraft/world/level/levelgen/synth/PerlinNoise.java
|
||||
index ffac5b7b1eb1364ab8442d7145a7b4ebde68ee10..667d464e61aea2aa7f7b7f1ed082daadc17f723b 100644
|
||||
--- a/net/minecraft/world/level/levelgen/synth/PerlinNoise.java
|
||||
+++ b/net/minecraft/world/level/levelgen/synth/PerlinNoise.java
|
||||
@@ -26,6 +26,10 @@ public class PerlinNoise {
|
||||
public final double lowestFreqValueFactor;
|
||||
public final double lowestFreqInputFactor;
|
||||
private final double maxValue;
|
||||
+ // DivineMC start - C2ME: optimize noise generation
|
||||
+ private final int octaveSamplersCount;
|
||||
+ private final double [] amplitudesArray;
|
||||
+ // DivineMC end - C2ME: optimize noise generation
|
||||
|
||||
@Deprecated
|
||||
public static PerlinNoise createLegacyForBlendedNoise(RandomSource random, IntStream octaves) {
|
||||
@@ -127,6 +131,10 @@ public class PerlinNoise {
|
||||
this.lowestFreqInputFactor = Math.pow(2.0, -i);
|
||||
this.lowestFreqValueFactor = Math.pow(2.0, size - 1) / (Math.pow(2.0, size) - 1.0);
|
||||
this.maxValue = this.edgeValue(2.0);
|
||||
+ // DivineMC start - C2ME: optimize noise generation
|
||||
+ this.octaveSamplersCount = this.noiseLevels.length;
|
||||
+ this.amplitudesArray = this.amplitudes.toDoubleArray();
|
||||
+ // DivineMC end - C2ME: optimize noise generation
|
||||
}
|
||||
|
||||
protected double maxValue() {
|
||||
@@ -138,7 +146,27 @@ public class PerlinNoise {
|
||||
}
|
||||
|
||||
public double getValue(double x, double y, double z) {
|
||||
- return this.getValue(x, y, z, 0.0, 0.0, false);
|
||||
+ // DivineMC start - C2ME: optimize noise generation
|
||||
+ double d = 0.0;
|
||||
+ double e = this.lowestFreqInputFactor;
|
||||
+ double f = this.lowestFreqValueFactor;
|
||||
+
|
||||
+ for (int i = 0; i < this.octaveSamplersCount; ++i) {
|
||||
+ ImprovedNoise perlinNoiseSampler = this.noiseLevels[i];
|
||||
+ if (perlinNoiseSampler != null) {
|
||||
+ @SuppressWarnings("deprecation")
|
||||
+ double g = perlinNoiseSampler.noise(
|
||||
+ wrap(x * e), wrap(y * e), wrap(z * e), 0.0, 0.0
|
||||
+ );
|
||||
+ d += this.amplitudesArray[i] * g * f;
|
||||
+ }
|
||||
+
|
||||
+ e *= 2.0;
|
||||
+ f /= 2.0;
|
||||
+ }
|
||||
+
|
||||
+ return d;
|
||||
+ // DivineMC end - C2ME: optimize noise generation
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@@ -187,7 +215,7 @@ public class PerlinNoise {
|
||||
}
|
||||
|
||||
public static double wrap(double value) {
|
||||
- return value - Mth.lfloor(value / 3.3554432E7 + 0.5) * 3.3554432E7;
|
||||
+ return value - Math.floor(value / 3.3554432E7 + 0.5) * 3.3554432E7; // DivineMC - C2ME: optimize noise generation
|
||||
}
|
||||
|
||||
protected int firstOctave() {
|
||||
@@ -1,6 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 02:42:57 +0300
|
||||
Subject: [PATCH] Skip cloning advancement criteria
|
||||
|
||||
|
||||
diff --git a/net/minecraft/advancements/Advancement.java b/net/minecraft/advancements/Advancement.java
|
||||
index ac6a85ddf6eb326b3fd53341a4a5db7bd00b7ce2..52a285db9557b2e44d2dcae9fabdb0d78d3e7ec6 100644
|
||||
--- a/net/minecraft/advancements/Advancement.java
|
||||
+++ b/net/minecraft/advancements/Advancement.java
|
||||
@@ -61,7 +_,7 @@
|
||||
@@ -61,7 +61,7 @@ public record Advancement(
|
||||
AdvancementRequirements requirements,
|
||||
boolean sendsTelemetryEvent
|
||||
) {
|
||||
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 02:43:50 +0300
|
||||
Subject: [PATCH] Fix sprint glitch
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
||||
index 4149e7eb6f583d80ed179b190dcc02acf1144bef..9a000a4df5df6e36ae25e6d54bfe7cd725df51dd 100644
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1420,7 +1420,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
player.setRealHealth(health);
|
||||
}
|
||||
|
||||
- player.updateScaledHealth(false);
|
||||
+ this.entityData.set(LivingEntity.DATA_HEALTH_ID, player.getScaledHealth()); // DivineMC - Fix sprint glitch
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -1,18 +1,24 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 02:47:58 +0300
|
||||
Subject: [PATCH] Optimize block state lookup
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index d11373d6a88f7b3baaf0e04d4f6e0d3837e2ba3b..6d9274f0da9507d0152611d6b7785e0524dedb2d 100644
|
||||
--- a/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -272,11 +_,18 @@
|
||||
@@ -270,11 +270,18 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
public BlockState getBlockStateFinal(final int x, final int y, final int z) {
|
||||
// Copied and modified from below
|
||||
final int sectionIndex = this.getSectionIndex(y);
|
||||
- if (sectionIndex < 0 || sectionIndex >= this.sections.length
|
||||
- || this.sections[sectionIndex].nonEmptyBlockCount == 0) {
|
||||
- return Blocks.AIR.defaultBlockState();
|
||||
- }
|
||||
- return this.sections[sectionIndex].states.get((y & 15) << 8 | (z & 15) << 4 | x & 15);
|
||||
+ // DivineMC start - optimize block state lookup
|
||||
+ // DivineMC start - Optimize block state lookup
|
||||
+ if (sectionIndex < 0 || sectionIndex >= this.sections.length) {
|
||||
+ return Blocks.AIR.defaultBlockState();
|
||||
+ }
|
||||
return Blocks.AIR.defaultBlockState();
|
||||
}
|
||||
- return this.sections[sectionIndex].states.get((y & 15) << 8 | (z & 15) << 4 | x & 15);
|
||||
+
|
||||
+ final LevelChunkSection section = this.sections[sectionIndex];
|
||||
+ if (section.nonEmptyBlockCount == 0) {
|
||||
@@ -20,7 +26,7 @@
|
||||
+ }
|
||||
+
|
||||
+ return section.states.get((y & 15) << 8 | (z & 15) << 4 | (x & 15));
|
||||
+ // DivineMC end - optimize block state lookup
|
||||
+ // DivineMC end - Optimize block state lookup
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,6 +1,15 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 02:48:57 +0300
|
||||
Subject: [PATCH] Don't respond ping before start fully
|
||||
|
||||
This is rewritten Purpur patch, to make this configurable
|
||||
|
||||
diff --git a/net/minecraft/server/network/ServerStatusPacketListenerImpl.java b/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
|
||||
index 1b966dc52b067cd9d1fa9f500b692e3f75f1cc90..ff4857522fc9bd5cdd01e3d0161418eef88886fc 100644
|
||||
--- a/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
|
||||
@@ -37,7 +_,10 @@
|
||||
@@ -37,7 +37,10 @@ public class ServerStatusPacketListenerImpl implements ServerStatusPacketListene
|
||||
} else {
|
||||
this.hasRequestedStatus = true;
|
||||
// this.connection.send(new ClientboundStatusResponsePacket(this.status)); // Paper
|
||||
@@ -1,6 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 02:50:15 +0300
|
||||
Subject: [PATCH] Respawn players that were dead on server restart
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index ace14db7bfd154b8a9b27af4a6c57630a3868ac0..abfecaf4467092f7baa02e0f5bbfd23d087f2aa3 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -989,6 +_,13 @@
|
||||
@@ -971,6 +971,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
if (this.hasStopped) return;
|
||||
this.hasStopped = true;
|
||||
}
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Configurable MC-67
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index b4fc7ad2f353e8fbaf2179df2750c9a1c8ac9aba..55e82d490ed3489ff671ae8a49745571c4bfb993 100644
|
||||
index 54307d5795d3cf36c3a39ff7fd21c92b46626c17..39076c52a1ed15d1403d08851d53787a9055d6ee 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -4171,6 +4171,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -4199,6 +4199,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
public boolean canTeleport(Level fromLevel, Level toLevel) {
|
||||
@@ -0,0 +1,65 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 02:59:37 +0300
|
||||
Subject: [PATCH] Use Java's Math functions
|
||||
|
||||
|
||||
diff --git a/net/minecraft/util/Mth.java b/net/minecraft/util/Mth.java
|
||||
index e2602c6d817794616eb05a471077447804b835a1..c4d55514a44939c3e6006d9e23b6097b6360853e 100644
|
||||
--- a/net/minecraft/util/Mth.java
|
||||
+++ b/net/minecraft/util/Mth.java
|
||||
@@ -58,18 +58,15 @@ public class Mth {
|
||||
}
|
||||
|
||||
public static int floor(float value) {
|
||||
- int i = (int)value;
|
||||
- return value < i ? i - 1 : i;
|
||||
+ return (int) Math.floor(value); // DivineMC - Use Java's Math functions
|
||||
}
|
||||
|
||||
public static int floor(double value) {
|
||||
- int i = (int)value;
|
||||
- return value < i ? i - 1 : i;
|
||||
+ return (int) Math.floor(value); // DivineMC - Use Java's Math functions
|
||||
}
|
||||
|
||||
public static long lfloor(double value) {
|
||||
- long l = (long)value;
|
||||
- return value < l ? l - 1L : l;
|
||||
+ return (long) Math.floor(value); // DivineMC - Use Java's Math functions
|
||||
}
|
||||
|
||||
public static float abs(float value) {
|
||||
@@ -81,13 +78,11 @@ public class Mth {
|
||||
}
|
||||
|
||||
public static int ceil(float value) {
|
||||
- int i = (int)value;
|
||||
- return value > i ? i + 1 : i;
|
||||
+ return (int) Math.ceil(value); // DivineMC - Use Java's Math functions
|
||||
}
|
||||
|
||||
public static int ceil(double value) {
|
||||
- int i = (int)value;
|
||||
- return value > i ? i + 1 : i;
|
||||
+ return (int) Math.ceil(value); // DivineMC - Use Java's Math functions
|
||||
}
|
||||
|
||||
public static int clamp(int value, int min, int max) {
|
||||
@@ -123,15 +118,7 @@ public class Mth {
|
||||
}
|
||||
|
||||
public static double absMax(double x, double y) {
|
||||
- if (x < 0.0) {
|
||||
- x = -x;
|
||||
- }
|
||||
-
|
||||
- if (y < 0.0) {
|
||||
- y = -y;
|
||||
- }
|
||||
-
|
||||
- return Math.max(x, y);
|
||||
+ return Math.max(Math.abs(x), Math.abs(y)); // DivineMC - Use Java's Math functions
|
||||
}
|
||||
|
||||
public static int floorDiv(int dividend, int divisor) {
|
||||
@@ -1,6 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 03:03:04 +0300
|
||||
Subject: [PATCH] Disable leaf decay
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/level/block/LeavesBlock.java b/net/minecraft/world/level/block/LeavesBlock.java
|
||||
index 010e9814490ffaa153df5b7865da17e2a84c7e82..f43dbc0fc05f549521490595fe594c424b2e8a87 100644
|
||||
--- a/net/minecraft/world/level/block/LeavesBlock.java
|
||||
+++ b/net/minecraft/world/level/block/LeavesBlock.java
|
||||
@@ -70,12 +_,29 @@
|
||||
@@ -70,12 +70,29 @@ public abstract class LeavesBlock extends Block implements SimpleWaterloggedBloc
|
||||
}
|
||||
|
||||
protected boolean decaying(BlockState state) {
|
||||
@@ -11,7 +19,7 @@
|
||||
@Override
|
||||
protected void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
|
||||
- level.setBlock(pos, updateDistance(state, level, pos), 3);
|
||||
+ // DivineMC start - Make leaves not suffocate the server
|
||||
+ // DivineMC start - Disable leaf decay
|
||||
+ if (org.bxteam.divinemc.config.DivineConfig.FixesCategory.disableLeafDecay) return; // DivineMC - Disable leaf decay
|
||||
+ int newValue = 7;
|
||||
+ int oldValue = state.getValue(DISTANCE);
|
||||
@@ -28,7 +36,7 @@
|
||||
+ if (newValue != oldValue) {
|
||||
+ level.setBlock(pos, state.setValue(DISTANCE, newValue), 3);
|
||||
+ }
|
||||
+ // DivineMC end - Make leaves not suffocate the server
|
||||
+ // DivineMC end - Disable leaf decay
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sun, 6 Jul 2025 03:04:04 +0300
|
||||
Subject: [PATCH] Carpet-Fixes: Fix Slime Block Bounce Logic
|
||||
|
||||
This patch is based on the following mixins:
|
||||
* "carpetfixes/mixins/blockFixes/SlimeBlock_incorrectLogicMixin.java"
|
||||
By: fxmorin <28154542+fxmorin@users.noreply.github.com>
|
||||
As part of: carpet-fixes (https://github.com/fxmorin/carpet-fixes)
|
||||
Licensed under: MIT (https://opensource.org/licenses/MIT)
|
||||
|
||||
Patch description:
|
||||
Fixes incorrect logic in the slimeblock bounce code which prevents some entities from bouncing.
|
||||
This bug in the slime code is due to onGround reversing the velocity, the best way to fix this issue is by
|
||||
setting onGround to true, only once the Y velocity is smaller than -0.15
|
||||
|
||||
diff --git a/net/minecraft/world/level/block/SlimeBlock.java b/net/minecraft/world/level/block/SlimeBlock.java
|
||||
index f26c3100d0aad0227f016bfa4c86ac647e13485a..59c9e63e6d5634973cc4927eac479463cc486a4a 100644
|
||||
--- a/net/minecraft/world/level/block/SlimeBlock.java
|
||||
+++ b/net/minecraft/world/level/block/SlimeBlock.java
|
||||
@@ -42,6 +42,7 @@ public class SlimeBlock extends HalfTransparentBlock {
|
||||
Vec3 deltaMovement = entity.getDeltaMovement();
|
||||
if (deltaMovement.y < 0.0) {
|
||||
double d = entity instanceof LivingEntity ? 1.0 : 0.8;
|
||||
+ if (org.bxteam.divinemc.config.DivineConfig.FixesCategory.fixIncorrectBounceLogic) entity.setOnGround(deltaMovement.y > -0.15); // DivineMC - Carpet-Fixes: Fix Slime Block Bounce Logic
|
||||
entity.setDeltaMovement(deltaMovement.x, -deltaMovement.y * d, deltaMovement.z);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||
Date: Sat, 1 Feb 2025 16:05:57 +0300
|
||||
Subject: [PATCH] Optimize entity stupid brain
|
||||
Subject: [PATCH] Optimize entity brain
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/AgeableMob.java b/net/minecraft/world/entity/AgeableMob.java
|
||||
index 04875840085541ebfc7014868beec49bb7ab9976..bd7e8fa315ca67fcf03d34added45b649d7aaebb 100644
|
||||
index 04875840085541ebfc7014868beec49bb7ab9976..bbfb1de1a03c4208406feb803a2f378db9910556 100644
|
||||
--- a/net/minecraft/world/entity/AgeableMob.java
|
||||
+++ b/net/minecraft/world/entity/AgeableMob.java
|
||||
@@ -125,6 +125,16 @@ public abstract class AgeableMob extends PathfinderMob {
|
||||
public void onSyncedDataUpdated(EntityDataAccessor<?> key) {
|
||||
if (DATA_BABY_ID.equals(key)) {
|
||||
this.refreshDimensions();
|
||||
+ // DivineMC start - Optimize entity stupid brain
|
||||
+ // DivineMC start - Optimize entity brain
|
||||
+ if (isBaby()) {
|
||||
+ org.bxteam.divinemc.util.entity.SensorHelper.enableSensor(this, net.minecraft.world.entity.ai.sensing.SensorType.NEAREST_ADULT, true);
|
||||
+ } else {
|
||||
@@ -21,12 +21,12 @@ index 04875840085541ebfc7014868beec49bb7ab9976..bd7e8fa315ca67fcf03d34added45b64
|
||||
+ this.getBrain().setMemory(net.minecraft.world.entity.ai.memory.MemoryModuleType.NEAREST_VISIBLE_ADULT, java.util.Optional.empty());
|
||||
+ }
|
||||
+ }
|
||||
+ // DivineMC end - Optimize entity stupid brain
|
||||
+ // DivineMC end - Optimize entity brain
|
||||
}
|
||||
|
||||
super.onSyncedDataUpdated(key);
|
||||
diff --git a/net/minecraft/world/entity/ai/Brain.java b/net/minecraft/world/entity/ai/Brain.java
|
||||
index 99ced3cb7d3d4c7a80d890689d7585fa9acd17f6..572415b91152756a246eca242eeaca387289be7c 100644
|
||||
index 99ced3cb7d3d4c7a80d890689d7585fa9acd17f6..78bd18006fc2b9b59f044de9767e4e985deecd05 100644
|
||||
--- a/net/minecraft/world/entity/ai/Brain.java
|
||||
+++ b/net/minecraft/world/entity/ai/Brain.java
|
||||
@@ -45,16 +45,73 @@ public class Brain<E extends LivingEntity> {
|
||||
@@ -47,7 +47,7 @@ index 99ced3cb7d3d4c7a80d890689d7585fa9acd17f6..572415b91152756a246eca242eeaca38
|
||||
private final Set<Activity> activeActivities = Sets.newHashSet();
|
||||
private Activity defaultActivity = Activity.IDLE;
|
||||
private long lastScheduleUpdate = -9999L;
|
||||
+ // DivineMC start - Optimize entity stupid brain
|
||||
+ // DivineMC start - Optimize entity brain
|
||||
+ private java.util.ArrayList<net.minecraft.world.entity.ai.behavior.BehaviorControl<? super E>> possibleTasks;
|
||||
+ private org.bxteam.divinemc.util.collections.MaskedList<net.minecraft.world.entity.ai.behavior.BehaviorControl<? super E>> runningTasks;
|
||||
+
|
||||
@@ -103,7 +103,7 @@ index 99ced3cb7d3d4c7a80d890689d7585fa9acd17f6..572415b91152756a246eca242eeaca38
|
||||
+ }
|
||||
+ this.runningTasks = list;
|
||||
+ }
|
||||
+ // DivineMC end - Optimize entity stupid brain
|
||||
+ // DivineMC end - Optimize entity brain
|
||||
|
||||
public static <E extends LivingEntity> Brain.Provider<E> provider(
|
||||
Collection<? extends MemoryModuleType<?>> memoryTypes, Collection<? extends SensorType<? extends Sensor<? super E>>> sensorTypes
|
||||
@@ -111,12 +111,12 @@ index 99ced3cb7d3d4c7a80d890689d7585fa9acd17f6..572415b91152756a246eca242eeaca38
|
||||
for (Brain.MemoryValue<?> memoryValue : memoryValues) {
|
||||
memoryValue.setMemoryInternal(this);
|
||||
}
|
||||
+ // DivineMC start - Optimize entity stupid brain
|
||||
+ // DivineMC start - Optimize entity brain
|
||||
+ this.onTasksChanged();
|
||||
+ this.memories = new it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap<>(this.memories);
|
||||
+ this.sensors = new it.unimi.dsi.fastutil.objects.Reference2ReferenceLinkedOpenHashMap<>(this.sensors);
|
||||
+ this.activityRequirements = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(this.activityRequirements);
|
||||
+ // DivineMC end - Optimize entity stupid brain
|
||||
+ // DivineMC end - Optimize entity brain
|
||||
}
|
||||
|
||||
public <T> DataResult<T> serializeStart(DynamicOps<T> ops) {
|
||||
@@ -132,7 +132,7 @@ index 99ced3cb7d3d4c7a80d890689d7585fa9acd17f6..572415b91152756a246eca242eeaca38
|
||||
this.setMemoryInternal(memoryType, memory.map(ExpirableValue::of));
|
||||
}
|
||||
|
||||
+ // DivineMC start - Optimize entity stupid brain
|
||||
+ // DivineMC start - Optimize entity brain
|
||||
<U> void setMemoryInternal(MemoryModuleType<U> memoryType, Optional<? extends ExpirableValue<?>> memory) {
|
||||
+ if (memory.isPresent() && this.isEmptyCollection(memory.get().getValue())) {
|
||||
+ this.eraseMemory(memoryType);
|
||||
@@ -162,7 +162,7 @@ index 99ced3cb7d3d4c7a80d890689d7585fa9acd17f6..572415b91152756a246eca242eeaca38
|
||||
+ }
|
||||
+ return oldValue;
|
||||
+ }
|
||||
+ // DivineMC end - Optimize entity stupid brain
|
||||
+ // DivineMC end - Optimize entity brain
|
||||
+
|
||||
public <U> Optional<U> getMemory(MemoryModuleType<U> type) {
|
||||
Optional<? extends ExpirableValue<?>> optional = this.memories.get(type);
|
||||
@@ -184,7 +184,7 @@ index 99ced3cb7d3d4c7a80d890689d7585fa9acd17f6..572415b91152756a246eca242eeaca38
|
||||
- }
|
||||
-
|
||||
- return list;
|
||||
+ return this.getCurrentlyRunningTasks(); // DivineMC - Optimize entity stupid brain
|
||||
+ return this.getCurrentlyRunningTasks(); // DivineMC - Optimize entity brain
|
||||
}
|
||||
|
||||
public void useDefaultActivity() {
|
||||
@@ -192,7 +192,7 @@ index 99ced3cb7d3d4c7a80d890689d7585fa9acd17f6..572415b91152756a246eca242eeaca38
|
||||
this.activeActivities.clear();
|
||||
this.activeActivities.addAll(this.coreActivities);
|
||||
this.activeActivities.add(activity);
|
||||
+ this.onPossibleActivitiesChanged(); // DivineMC - Optimize entity stupid brain
|
||||
+ this.onPossibleActivitiesChanged(); // DivineMC - Optimize entity brain
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,13 +200,13 @@ index 99ced3cb7d3d4c7a80d890689d7585fa9acd17f6..572415b91152756a246eca242eeaca38
|
||||
.computeIfAbsent(activity, activity1 -> Sets.newLinkedHashSet())
|
||||
.add((BehaviorControl<? super E>)pair.getSecond());
|
||||
}
|
||||
+ this.onTasksChanged(); // DivineMC - Optimize entity stupid brain
|
||||
+ this.onTasksChanged(); // DivineMC - Optimize entity brain
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void removeAllBehaviors() {
|
||||
this.availableBehaviorsByPriority.clear();
|
||||
+ this.onTasksChanged(); // DivineMC - Optimize entity stupid brain
|
||||
+ this.onTasksChanged(); // DivineMC - Optimize entity brain
|
||||
}
|
||||
|
||||
public boolean isActive(Activity activity) {
|
||||
@@ -214,7 +214,7 @@ index 99ced3cb7d3d4c7a80d890689d7585fa9acd17f6..572415b91152756a246eca242eeaca38
|
||||
}
|
||||
}
|
||||
|
||||
+ brain.memoryModCount = this.memoryModCount + 1; // DivineMC - Optimize entity stupid brain
|
||||
+ brain.memoryModCount = this.memoryModCount + 1; // DivineMC - Optimize entity brain
|
||||
return brain;
|
||||
}
|
||||
|
||||
@@ -222,15 +222,15 @@ index 99ced3cb7d3d4c7a80d890689d7585fa9acd17f6..572415b91152756a246eca242eeaca38
|
||||
|
||||
for (BehaviorControl<? super E> behaviorControl : this.getRunningBehaviors()) {
|
||||
behaviorControl.doStop(level, owner, gameTime);
|
||||
+ // DivineMC start - Optimize entity stupid brain
|
||||
+ // DivineMC start - Optimize entity brain
|
||||
+ if (this.runningTasks != null) {
|
||||
+ this.runningTasks.setVisible(behaviorControl, false);
|
||||
+ }
|
||||
+ // DivineMC end - Optimize entity stupid brain
|
||||
+ // DivineMC end - Optimize entity brain
|
||||
}
|
||||
}
|
||||
|
||||
+ // DivineMC start - Optimize entity stupid brain
|
||||
+ // DivineMC start - Optimize entity brain
|
||||
private void startEachNonRunningBehavior(ServerLevel level, E entity) {
|
||||
- long gameTime = level.getGameTime();
|
||||
-
|
||||
@@ -253,33 +253,33 @@ index 99ced3cb7d3d4c7a80d890689d7585fa9acd17f6..572415b91152756a246eca242eeaca38
|
||||
}
|
||||
}
|
||||
}
|
||||
+ // DivineMC end - Optimize entity stupid brain
|
||||
+ // DivineMC end - Optimize entity brain
|
||||
|
||||
private void tickEachRunningBehavior(ServerLevel level, E entity) {
|
||||
long gameTime = level.getGameTime();
|
||||
|
||||
for (BehaviorControl<? super E> behaviorControl : this.getRunningBehaviors()) {
|
||||
behaviorControl.tickOrStop(level, entity, gameTime);
|
||||
+ // DivineMC start - Optimize entity stupid brain
|
||||
+ // DivineMC start - Optimize entity brain
|
||||
+ if (this.runningTasks != null && behaviorControl.getStatus() != Behavior.Status.RUNNING) {
|
||||
+ this.runningTasks.setVisible(behaviorControl, false);
|
||||
+ }
|
||||
+ // DivineMC end - Optimize entity stupid brain
|
||||
+ // DivineMC end - Optimize entity brain
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/behavior/Behavior.java b/net/minecraft/world/entity/ai/behavior/Behavior.java
|
||||
index 5b0cadd2544fb2a627822e645ff32fec2e9cfda9..253b9ad671cf0932bb17d468f8b91a15a86ff77a 100644
|
||||
index 5b0cadd2544fb2a627822e645ff32fec2e9cfda9..f367012ebcc4d06ac868bbc1733bee39ad2d67b1 100644
|
||||
--- a/net/minecraft/world/entity/ai/behavior/Behavior.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/Behavior.java
|
||||
@@ -14,6 +14,10 @@ public abstract class Behavior<E extends LivingEntity> implements BehaviorContro
|
||||
private long endTimestamp;
|
||||
private final int minDuration;
|
||||
private final int maxDuration;
|
||||
+ // DivineMC start - Optimize entity stupid brain
|
||||
+ // DivineMC start - Optimize entity brain
|
||||
+ private long cachedMemoryModCount = -1;
|
||||
+ private boolean cachedHasRequiredMemoryState;
|
||||
+ // DivineMC end - Optimize entity stupid brain
|
||||
+ // DivineMC end - Optimize entity brain
|
||||
private final String configKey; // Paper - configurable behavior tick rate and timings
|
||||
|
||||
public Behavior(Map<MemoryModuleType<?>, MemoryStatus> entryCondition) {
|
||||
@@ -288,7 +288,7 @@ index 5b0cadd2544fb2a627822e645ff32fec2e9cfda9..253b9ad671cf0932bb17d468f8b91a15
|
||||
this.minDuration = minDuration;
|
||||
this.maxDuration = maxDuration;
|
||||
- this.entryCondition = entryCondition;
|
||||
+ this.entryCondition = new it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap<>(entryCondition); // DivineMC - Optimize entity stupid brain - Use fastutil
|
||||
+ this.entryCondition = new it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap<>(entryCondition); // DivineMC - Optimize entity brain - Use fastutil
|
||||
// Paper start - configurable behavior tick rate and timings
|
||||
String key = io.papermc.paper.util.MappingEnvironment.reobf() ? io.papermc.paper.util.ObfHelper.INSTANCE.deobfClassName(this.getClass().getName()) : this.getClass().getName();
|
||||
int lastSeparator = key.lastIndexOf('.');
|
||||
@@ -302,7 +302,7 @@ index 5b0cadd2544fb2a627822e645ff32fec2e9cfda9..253b9ad671cf0932bb17d468f8b91a15
|
||||
- MemoryStatus memoryStatus = entry.getValue();
|
||||
- if (!owner.getBrain().checkMemory(memoryModuleType, memoryStatus)) {
|
||||
- return false;
|
||||
+ // DivineMC start - Optimize entity stupid brain
|
||||
+ // DivineMC start - Optimize entity brain
|
||||
+ public boolean hasRequiredMemories(E entity) {
|
||||
+ net.minecraft.world.entity.ai.Brain<?> brain = entity.getBrain();
|
||||
+ long modCount = brain.getMemoryModCount();
|
||||
@@ -322,24 +322,24 @@ index 5b0cadd2544fb2a627822e645ff32fec2e9cfda9..253b9ad671cf0932bb17d468f8b91a15
|
||||
- return true;
|
||||
+ return this.cachedHasRequiredMemoryState = true;
|
||||
}
|
||||
+ // DivineMC end - Optimize entity stupid brain
|
||||
+ // DivineMC end - Optimize entity brain
|
||||
|
||||
public static enum Status {
|
||||
STOPPED,
|
||||
diff --git a/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java b/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java
|
||||
index 977afa268838304abdb34be253ca36ac1c22e99f..55a20253d139bc997d2b5d0c0d928fe67df2da32 100644
|
||||
index 977afa268838304abdb34be253ca36ac1c22e99f..ff04ea295b70583137deb8babe5e75ebc755f697 100644
|
||||
--- a/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java
|
||||
@@ -119,6 +119,12 @@ public class LongJumpToRandomPos<E extends Mob> extends Behavior<E> {
|
||||
int x = blockPos.getX();
|
||||
int y = blockPos.getY();
|
||||
int z = blockPos.getZ();
|
||||
+ // DivineMC start - Optimize entity stupid brain
|
||||
+ // DivineMC start - Optimize entity brain
|
||||
+ if (this.maxLongJumpWidth < 128 && this.maxLongJumpHeight < 128) {
|
||||
+ this.jumpCandidates = org.bxteam.divinemc.util.collections.LongJumpChoiceList.forCenter(blockPos, (byte) this.maxLongJumpWidth, (byte) this.maxLongJumpHeight);
|
||||
+ return;
|
||||
+ }
|
||||
+ // DivineMC end - Optimize entity stupid brain
|
||||
+ // DivineMC end - Optimize entity brain
|
||||
this.jumpCandidates = BlockPos.betweenClosedStream(
|
||||
x - this.maxLongJumpWidth,
|
||||
y - this.maxLongJumpHeight,
|
||||
@@ -347,7 +347,7 @@ index 977afa268838304abdb34be253ca36ac1c22e99f..55a20253d139bc997d2b5d0c0d928fe6
|
||||
}
|
||||
}
|
||||
|
||||
+ // DivineMC start - Optimize entity stupid brain
|
||||
+ // DivineMC start - Optimize entity brain
|
||||
protected Optional<LongJumpToRandomPos.PossibleJump> getJumpCandidate(ServerLevel level) {
|
||||
- Optional<LongJumpToRandomPos.PossibleJump> randomItem = WeightedRandom.getRandomItem(
|
||||
- level.random, this.jumpCandidates, LongJumpToRandomPos.PossibleJump::weight
|
||||
@@ -403,20 +403,20 @@ index 24d1928445b5571e040a2b12d5c82e77a880d9bd..dac0a23aebf2dea1972c07d5c82079da
|
||||
private boolean isVillagerBaby(LivingEntity livingEntity) {
|
||||
return livingEntity.getType() == EntityType.VILLAGER && livingEntity.isBaby();
|
||||
diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
index 70b32e0d06f9b8b7999df5fdfd773c09394e23fb..36fcc913385afec8bb66c1664b902e4d6868f11d 100644
|
||||
index 70b32e0d06f9b8b7999df5fdfd773c09394e23fb..997cff138d5c99b1be9224cb3c96bdfeeb79915a 100644
|
||||
--- a/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
@@ -100,6 +100,13 @@ public class Goat extends Animal {
|
||||
this.getNavigation().setCanFloat(true);
|
||||
this.setPathfindingMalus(PathType.POWDER_SNOW, -1.0F);
|
||||
this.setPathfindingMalus(PathType.DANGER_POWDER_SNOW, -1.0F);
|
||||
+ // DivineMC start - Optimize entity stupid brain
|
||||
+ // DivineMC start - Optimize entity brain
|
||||
+ if (!this.getBrain().hasMemoryValue(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM)) {
|
||||
+ org.bxteam.divinemc.util.entity.SensorHelper.disableSensor(this, SensorType.NEAREST_ITEMS);
|
||||
+ } else if (net.minecraft.SharedConstants.IS_RUNNING_IN_IDE) {
|
||||
+ throw new IllegalStateException("Goat Entity has a nearest visible wanted item memory module! This patch(Optimize-Brain, Goat.java changes) should probably be removed permanently!");
|
||||
+ }
|
||||
+ // DivineMC end - Optimize entity stupid brain
|
||||
+ // DivineMC end - Optimize entity brain
|
||||
}
|
||||
|
||||
public ItemStack createHorn() {
|
||||
@@ -1,10 +0,0 @@
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -2224,6 +_,7 @@
|
||||
this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, gameMode.getId()));
|
||||
if (gameMode == GameType.SPECTATOR) {
|
||||
this.removeEntitiesOnShoulder();
|
||||
+ this.stopSleeping(); // DivineMC - Fix MC-119417
|
||||
this.stopRiding();
|
||||
EnchantmentHelper.stopLocationBasedEffects(this);
|
||||
} else {
|
||||
@@ -1,19 +0,0 @@
|
||||
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -754,8 +_,14 @@
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level());
|
||||
if (packet.getId() == this.awaitingTeleport) {
|
||||
if (this.awaitingPositionFromClient == null) {
|
||||
- ServerGamePacketListenerImpl.LOGGER.warn("Disconnected on accept teleport packet. Was not expecting position data from client at this time"); // Purpur - Add more logger output for invalid movement kicks
|
||||
- this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause
|
||||
+ // DivineMC start - Graceful teleport handling
|
||||
+ if (org.bxteam.divinemc.config.DivineConfig.NetworkCategory.gracefulTeleportHandling) {
|
||||
+ LOGGER.info("Was not expecting position data from client at this time, gracefully returning instead of disconnect.");
|
||||
+ } else {
|
||||
+ ServerGamePacketListenerImpl.LOGGER.warn("Disconnected on accept teleport packet. Was not expecting position data from client at this time"); // Purpur - Add more logger output for invalid movement kicks
|
||||
+ this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause
|
||||
+ }
|
||||
+ // DivineMC end - Graceful teleport handling
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -678,7 +_,6 @@
|
||||
}
|
||||
|
||||
public ServerPlayer respawn(ServerPlayer player, boolean keepInventory, Entity.RemovalReason reason, @Nullable org.bukkit.event.player.PlayerRespawnEvent.RespawnReason eventReason, @Nullable org.bukkit.Location location) {
|
||||
- player.stopRiding(); // CraftBukkit
|
||||
this.players.remove(player);
|
||||
this.playersByName.remove(player.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
|
||||
player.level().removePlayerImmediately(player, reason);
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/net/minecraft/server/rcon/RconConsoleSource.java
|
||||
+++ b/net/minecraft/server/rcon/RconConsoleSource.java
|
||||
@@ -51,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void sendSystemMessage(Component component) {
|
||||
- this.buffer.append(component.getString());
|
||||
+ this.buffer.append(component.getString()).append(System.lineSeparator()); // DivineMC - Fix MC-7569
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,28 +0,0 @@
|
||||
--- a/net/minecraft/stats/ServerStatsCounter.java
|
||||
+++ b/net/minecraft/stats/ServerStatsCounter.java
|
||||
@@ -98,12 +_,6 @@
|
||||
this.dirty.add(stat);
|
||||
}
|
||||
|
||||
- private Set<Stat<?>> getDirty() {
|
||||
- Set<Stat<?>> set = Sets.newHashSet(this.dirty);
|
||||
- this.dirty.clear();
|
||||
- return set;
|
||||
- }
|
||||
-
|
||||
public void parseLocal(DataFixer fixerUpper, String json) {
|
||||
try {
|
||||
JsonElement jsonElement = StrictJsonParser.parse(json);
|
||||
@@ -139,9 +_,11 @@
|
||||
public void sendStats(ServerPlayer player) {
|
||||
Object2IntMap<Stat<?>> map = new Object2IntOpenHashMap<>();
|
||||
|
||||
- for (Stat<?> stat : this.getDirty()) {
|
||||
+ for (Stat<?> stat : this.dirty) { // DivineMC - Skip dirty stats copy when requesting player stats
|
||||
map.put(stat, this.getValue(stat));
|
||||
}
|
||||
+
|
||||
+ this.dirty.clear(); // DivineMC - Skip dirty stats copy when requesting player stats
|
||||
|
||||
player.connection.send(new ClientboundAwardStatsPacket(map));
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1425,7 +_,7 @@
|
||||
player.setRealHealth(health);
|
||||
}
|
||||
|
||||
- player.updateScaledHealth(false);
|
||||
+ this.entityData.set(LivingEntity.DATA_HEALTH_ID, player.getScaledHealth()); // DivineMC - Fix sprint glitch
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -2762,6 +_,7 @@
|
||||
}
|
||||
|
||||
protected void updateSwingTime() {
|
||||
+ if (!this.swinging && this.swingTime == 0) return; // DivineMC - lithium: entity.fast_hand_swing
|
||||
int currentSwingDuration = this.getCurrentSwingDuration();
|
||||
if (this.swinging) {
|
||||
this.swingTime++;
|
||||
@@ -3278,7 +_,13 @@
|
||||
}
|
||||
|
||||
protected float getFlyingSpeed() {
|
||||
- return this.getControllingPassenger() instanceof net.minecraft.world.entity.player.Player ? this.getSpeed() * 0.1F : 0.02F;
|
||||
+ // DivineMC start - Fix MC-172801
|
||||
+ float flyingSpeed = 0.02F;
|
||||
+ if (this.getAttributes().hasAttribute(Attributes.FLYING_SPEED)) {
|
||||
+ flyingSpeed = (float) (this.getAttribute(Attributes.FLYING_SPEED).getValue() * 0.049999999254942D);
|
||||
+ }
|
||||
+ return this.getControllingPassenger() instanceof net.minecraft.world.entity.player.Player ? this.getSpeed() * 0.1F : flyingSpeed;
|
||||
+ // DivineMC end - Fix MC-172801
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
@@ -3727,6 +_,7 @@
|
||||
protected void updateFallFlying() {
|
||||
this.checkFallDistanceAccumulation();
|
||||
if (!this.level().isClientSide) {
|
||||
+ if (!this.isFallFlying() && this.fallFlyTicks == 0) return; // DivineMC - lithium: entity.fast_elytra_check
|
||||
if (!this.canGlide()) {
|
||||
if (this.getSharedFlag(7) != false && !CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) // CraftBukkit
|
||||
this.setSharedFlag(7, false);
|
||||
@@ -1,10 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java
|
||||
@@ -114,6 +_,7 @@
|
||||
}
|
||||
|
||||
protected void alertOther(Mob mob, LivingEntity target) {
|
||||
+ if (mob == target) return; // DivineMC - Fix MC-110386
|
||||
mob.setTarget(target, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY); // CraftBukkit - reason
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
|
||||
+++ b/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
|
||||
@@ -22,6 +_,12 @@
|
||||
|
||||
@Override
|
||||
protected void doTick(ServerLevel level, Villager entity) {
|
||||
+ // DivineMC start - skip useless secondary poi sensor
|
||||
+ if (org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.skipUselessSecondaryPoiSensor && entity.getVillagerData().profession().value().secondaryPoi().isEmpty()) {
|
||||
+ entity.getBrain().eraseMemory(MemoryModuleType.SECONDARY_JOB_SITE);
|
||||
+ return;
|
||||
+ }
|
||||
+ // DivineMC end - skip useless secondary poi sensor
|
||||
// Purpur start - Option for Villager Clerics to farm Nether Wart - make sure clerics don't wander to soul sand when the option is off
|
||||
Brain<?> brain = entity.getBrain();
|
||||
if (!level.purpurConfig.villagerClericsFarmWarts && entity.getVillagerData().profession().is(net.minecraft.world.entity.npc.VillagerProfession.CLERIC)) {
|
||||
@@ -1,14 +0,0 @@
|
||||
--- a/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1818,6 +_,11 @@
|
||||
}
|
||||
|
||||
public void causeFoodExhaustion(float exhaustion, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason reason) {
|
||||
+ // DivineMC start - Fix MC-31819
|
||||
+ if (this.level().getDifficulty() == Difficulty.PEACEFUL) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // DivineMC end - Fix MC-31819
|
||||
// CraftBukkit end
|
||||
if (!this.abilities.invulnerable) {
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -1,20 +0,0 @@
|
||||
--- a/net/minecraft/world/level/BaseCommandBlock.java
|
||||
+++ b/net/minecraft/world/level/BaseCommandBlock.java
|
||||
@@ -22,7 +_,7 @@
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public abstract class BaseCommandBlock implements CommandSource {
|
||||
- private static final SimpleDateFormat TIME_FORMAT = new SimpleDateFormat("HH:mm:ss");
|
||||
+ private static final ThreadLocal<SimpleDateFormat> TIME_FORMAT = ThreadLocal.withInitial(() -> new SimpleDateFormat("HH:mm:ss")); // DivineMC - Make it thread safe
|
||||
private static final Component DEFAULT_NAME = Component.literal("@");
|
||||
private static final int NO_LAST_EXECUTION = -1;
|
||||
private long lastExecution = -1L;
|
||||
@@ -156,7 +_,7 @@
|
||||
public void sendSystemMessage(Component component) {
|
||||
if (this.trackOutput) {
|
||||
org.spigotmc.AsyncCatcher.catchOp("sendSystemMessage to a command block"); // Paper - Don't broadcast messages to command blocks
|
||||
- this.lastOutput = Component.literal("[" + TIME_FORMAT.format(new Date()) + "] ").append(component);
|
||||
+ this.lastOutput = Component.literal("[" + TIME_FORMAT.get().format(new Date()) + "] ").append(component); // DivineMC - Make it thread safe
|
||||
this.onUpdated();
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
--- a/net/minecraft/world/level/block/Blocks.java
|
||||
+++ b/net/minecraft/world/level/block/Blocks.java
|
||||
@@ -6732,6 +_,7 @@
|
||||
.mapColor(MapColor.COLOR_ORANGE)
|
||||
.instrument(NoteBlockInstrument.BASEDRUM)
|
||||
.requiresCorrectToolForDrops()
|
||||
+ .sound(SoundType.COPPER) // DivineMC - Fix MC-223153
|
||||
.strength(5.0F, 6.0F)
|
||||
);
|
||||
public static final Block RAW_GOLD_BLOCK = register(
|
||||
@@ -1,10 +0,0 @@
|
||||
--- a/net/minecraft/world/level/block/SlimeBlock.java
|
||||
+++ b/net/minecraft/world/level/block/SlimeBlock.java
|
||||
@@ -42,6 +_,7 @@
|
||||
Vec3 deltaMovement = entity.getDeltaMovement();
|
||||
if (deltaMovement.y < 0.0) {
|
||||
double d = entity instanceof LivingEntity ? 1.0 : 0.8;
|
||||
+ if (org.bxteam.divinemc.config.DivineConfig.FixesCategory.fixIncorrectBounceLogic) entity.setOnGround(deltaMovement.y > -0.15); // DivineMC - Carpet-Fixes: Fix Slime Block Bounce Logic
|
||||
entity.setDeltaMovement(deltaMovement.x, -deltaMovement.y * d, deltaMovement.z);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
package net.caffeinemc.mods.lithium.common.world.chunk;
|
||||
|
||||
import it.unimi.dsi.fastutil.HashCommon;
|
||||
import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
|
||||
import net.minecraft.CrashReport;
|
||||
import net.minecraft.CrashReportCategory;
|
||||
import net.minecraft.ReportedException;
|
||||
import net.minecraft.core.IdMap;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.VarInt;
|
||||
import net.minecraft.world.level.chunk.MissingPaletteEntryException;
|
||||
import net.minecraft.world.level.chunk.Palette;
|
||||
import net.minecraft.world.level.chunk.PaletteResize;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import static it.unimi.dsi.fastutil.Hash.FAST_LOAD_FACTOR;
|
||||
|
||||
/**
|
||||
* Generally provides better performance over the vanilla {@link net.minecraft.world.level.chunk.HashMapPalette} when calling
|
||||
* {@link LithiumHashPalette#idFor(Object)} through using a faster backing map and reducing pointer chasing.
|
||||
*/
|
||||
public class LithiumHashPalette<T> implements Palette<T> {
|
||||
private static final int ABSENT_VALUE = -1;
|
||||
|
||||
private final IdMap<T> idList;
|
||||
private final PaletteResize<T> resizeHandler;
|
||||
private final int indexBits;
|
||||
|
||||
private final Reference2IntOpenHashMap<T> table;
|
||||
private T[] entries;
|
||||
private int size = 0;
|
||||
|
||||
private LithiumHashPalette(IdMap<T> idList, PaletteResize<T> resizeHandler, int indexBits, T[] entries, Reference2IntOpenHashMap<T> table, int size) {
|
||||
this.idList = idList;
|
||||
this.resizeHandler = resizeHandler;
|
||||
this.indexBits = indexBits;
|
||||
this.entries = entries;
|
||||
this.table = table;
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public LithiumHashPalette(IdMap<T> idList, int bits, PaletteResize<T> resizeHandler, List<T> list) {
|
||||
this(idList, bits, resizeHandler);
|
||||
|
||||
for (T t : list) {
|
||||
this.addEntry(t);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public LithiumHashPalette(IdMap<T> idList, int bits, PaletteResize<T> resizeHandler) {
|
||||
this.idList = idList;
|
||||
this.indexBits = bits;
|
||||
this.resizeHandler = resizeHandler;
|
||||
|
||||
int capacity = 1 << bits;
|
||||
|
||||
this.entries = (T[]) new Object[capacity];
|
||||
this.table = new Reference2IntOpenHashMap<>(capacity, FAST_LOAD_FACTOR);
|
||||
this.table.defaultReturnValue(ABSENT_VALUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int idFor(@NotNull T obj) {
|
||||
int id = this.table.getInt(obj);
|
||||
|
||||
if (id == ABSENT_VALUE) {
|
||||
id = this.computeEntry(obj);
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean maybeHas(@NotNull Predicate<T> predicate) {
|
||||
for (int i = 0; i < this.size; ++i) {
|
||||
if (predicate.test(this.entries[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private int computeEntry(T obj) {
|
||||
int id = this.addEntry(obj);
|
||||
|
||||
if (id >= 1 << this.indexBits) {
|
||||
if (this.resizeHandler == null) {
|
||||
throw new IllegalStateException("Cannot grow");
|
||||
} else {
|
||||
id = this.resizeHandler.onResize(this.indexBits + 1, obj);
|
||||
}
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
private int addEntry(T obj) {
|
||||
int nextId = this.size;
|
||||
|
||||
if (nextId >= this.entries.length) {
|
||||
this.resize(this.size);
|
||||
}
|
||||
|
||||
this.table.put(obj, nextId);
|
||||
this.entries[nextId] = obj;
|
||||
|
||||
this.size++;
|
||||
|
||||
return nextId;
|
||||
}
|
||||
|
||||
private void resize(int neededCapacity) {
|
||||
this.entries = Arrays.copyOf(this.entries, HashCommon.nextPowerOfTwo(neededCapacity + 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull T valueFor(int id) {
|
||||
T[] entries = this.entries;
|
||||
|
||||
T entry = null;
|
||||
if (id >= 0 && id < entries.length) {
|
||||
entry = entries[id];
|
||||
}
|
||||
|
||||
if (entry != null) {
|
||||
return entry;
|
||||
} else {
|
||||
throw this.missingPaletteEntryCrash(id);
|
||||
}
|
||||
}
|
||||
|
||||
private ReportedException missingPaletteEntryCrash(int id) {
|
||||
try {
|
||||
throw new MissingPaletteEntryException(id);
|
||||
} catch (MissingPaletteEntryException e) {
|
||||
CrashReport crashReport = CrashReport.forThrowable(e, "[Lithium] Getting Palette Entry");
|
||||
CrashReportCategory crashReportCategory = crashReport.addCategory("Chunk section");
|
||||
crashReportCategory.setDetail("IndexBits", this.indexBits);
|
||||
crashReportCategory.setDetail("Entries", this.entries.length + " Elements: " + Arrays.toString(this.entries));
|
||||
crashReportCategory.setDetail("Table", this.table.size() + " Elements: " + this.table);
|
||||
return new ReportedException(crashReport);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(FriendlyByteBuf buf) {
|
||||
this.clear();
|
||||
|
||||
int entryCount = buf.readVarInt();
|
||||
|
||||
for (int i = 0; i < entryCount; ++i) {
|
||||
this.addEntry(this.idList.byIdOrThrow(buf.readVarInt()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(FriendlyByteBuf buf) {
|
||||
int size = this.size;
|
||||
buf.writeVarInt(size);
|
||||
|
||||
for (int i = 0; i < size; ++i) {
|
||||
buf.writeVarInt(this.idList.getId(this.valueFor(i)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSerializedSize() {
|
||||
int size = VarInt.getByteSize(this.size);
|
||||
|
||||
for (int i = 0; i < this.size; ++i) {
|
||||
size += VarInt.getByteSize(this.idList.getId(this.valueFor(i)));
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Palette<T> copy(@NotNull PaletteResize<T> resizeHandler) {
|
||||
return new LithiumHashPalette<>(this.idList, resizeHandler, this.indexBits, this.entries.clone(), this.table.clone(), this.size);
|
||||
}
|
||||
|
||||
private void clear() {
|
||||
Arrays.fill(this.entries, null);
|
||||
this.table.clear();
|
||||
this.size = 0;
|
||||
}
|
||||
|
||||
public List<T> getElements() {
|
||||
T[] copy = Arrays.copyOf(this.entries, this.size);
|
||||
return Arrays.asList(copy);
|
||||
}
|
||||
|
||||
public static <A> Palette<A> create(int bits, IdMap<A> idList, PaletteResize<A> listener, List<A> list) {
|
||||
return new LithiumHashPalette<>(idList, bits, listener, list);
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ This patch adds regionized chunk ticking feature, by grouping adjacent chunks in
|
||||
|
||||
Original idea by Dueris, modified by NONPLAYT and heavily optimized by dan28000
|
||||
|
||||
TODO: switchable VT
|
||||
|
||||
diff --git a/net/minecraft/network/Connection.java b/net/minecraft/network/Connection.java
|
||||
index cdacbfa64bda461d4f24c2a85db9feae7766b597..07370cb7bc0bb5a8abfd0062df999ed24c936113 100644
|
||||
--- a/net/minecraft/network/Connection.java
|
||||
Reference in New Issue
Block a user