9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-19 14:59:25 +00:00

fix compile

This commit is contained in:
NONPLAYT
2025-10-11 17:08:32 +03:00
parent 7b9e2e61e4
commit a558946b75
27 changed files with 212 additions and 105 deletions

View File

@@ -17,6 +17,7 @@ public net.minecraft.world.entity.ai.sensing.Sensor timeToTick
public net.minecraft.world.entity.animal.armadillo.Armadillo scuteTime public net.minecraft.world.entity.animal.armadillo.Armadillo scuteTime
public net.minecraft.world.entity.animal.frog.Tadpole getTicksLeftUntilAdult()I public net.minecraft.world.entity.animal.frog.Tadpole getTicksLeftUntilAdult()I
public net.minecraft.world.entity.decoration.ArmorStand noTickEquipmentDirty public net.minecraft.world.entity.decoration.ArmorStand noTickEquipmentDirty
public net.minecraft.world.level.Level isClientSide
public net.minecraft.world.level.chunk.LevelChunk$RebindableTickingBlockEntityWrapper public net.minecraft.world.level.chunk.LevelChunk$RebindableTickingBlockEntityWrapper
public net.minecraft.world.level.chunk.LevelChunk$RebindableTickingBlockEntityWrapper rebind(Lnet/minecraft/world/level/block/entity/TickingBlockEntity;)V public net.minecraft.world.level.chunk.LevelChunk$RebindableTickingBlockEntityWrapper rebind(Lnet/minecraft/world/level/block/entity/TickingBlockEntity;)V
public net.minecraft.world.level.chunk.LevelChunk$RebindableTickingBlockEntityWrapper ticker public net.minecraft.world.level.chunk.LevelChunk$RebindableTickingBlockEntityWrapper ticker

View File

@@ -203,10 +203,10 @@ index 18071dcc69cc28471dddb7de94e803ec1e5fc2e4..aa25f5ebaf7d1b22825b962b02dcae02
} }
} }
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 5d761c36739981897fe165148e528ef6b0e80b8d..ac0122e9a54c4f6e41638c79a75542fe2db3c9a4 100644 index 5d761c36739981897fe165148e528ef6b0e80b8d..18c3599ceb7a1c9dc769af0ad4c3eff9e37e2a76 100644
--- a/net/minecraft/server/MinecraftServer.java --- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java
@@ -117,20 +117,8 @@ import net.minecraft.util.TimeUtil; @@ -117,20 +117,9 @@ import net.minecraft.util.TimeUtil;
import net.minecraft.util.debug.ServerDebugSubscribers; import net.minecraft.util.debug.ServerDebugSubscribers;
import net.minecraft.util.debugchart.SampleLogger; import net.minecraft.util.debugchart.SampleLogger;
import net.minecraft.util.debugchart.TpsDebugDimensions; import net.minecraft.util.debugchart.TpsDebugDimensions;
@@ -216,7 +216,7 @@ index 5d761c36739981897fe165148e528ef6b0e80b8d..ac0122e9a54c4f6e41638c79a75542fe
-import net.minecraft.util.profiling.ProfilerFiller; -import net.minecraft.util.profiling.ProfilerFiller;
-import net.minecraft.util.profiling.ResultField; -import net.minecraft.util.profiling.ResultField;
-import net.minecraft.util.profiling.SingleTickProfiler; -import net.minecraft.util.profiling.SingleTickProfiler;
-import net.minecraft.util.profiling.jfr.Environment; import net.minecraft.util.profiling.jfr.Environment;
import net.minecraft.util.profiling.jfr.JvmProfiler; import net.minecraft.util.profiling.jfr.JvmProfiler;
import net.minecraft.util.profiling.jfr.callback.ProfiledDuration; import net.minecraft.util.profiling.jfr.callback.ProfiledDuration;
-import net.minecraft.util.profiling.metrics.profiling.ActiveMetricsRecorder; -import net.minecraft.util.profiling.metrics.profiling.ActiveMetricsRecorder;
@@ -227,7 +227,7 @@ index 5d761c36739981897fe165148e528ef6b0e80b8d..ac0122e9a54c4f6e41638c79a75542fe
import net.minecraft.util.thread.ReentrantBlockableEventLoop; import net.minecraft.util.thread.ReentrantBlockableEventLoop;
import net.minecraft.world.Difficulty; import net.minecraft.world.Difficulty;
import net.minecraft.world.RandomSequences; import net.minecraft.world.RandomSequences;
@@ -203,13 +191,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -203,13 +192,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public LevelStorageSource.LevelStorageAccess storageSource; public LevelStorageSource.LevelStorageAccess storageSource;
public final PlayerDataStorage playerDataStorage; public final PlayerDataStorage playerDataStorage;
private final List<Runnable> tickables = Lists.newArrayList(); private final List<Runnable> tickables = Lists.newArrayList();
@@ -241,7 +241,17 @@ index 5d761c36739981897fe165148e528ef6b0e80b8d..ac0122e9a54c4f6e41638c79a75542fe
private ServerConnectionListener connection; private ServerConnectionListener connection;
// Paper - per world load listener - moved LevelLoadListener to ServerLevel // Paper - per world load listener - moved LevelLoadListener to ServerLevel
@Nullable @Nullable
@@ -1164,10 +1145,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -993,9 +975,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
org.spigotmc.WatchdogThread.doStop(); // Paper - Improved watchdog support
// CraftBukkit end
this.packetProcessor.close();
- if (this.metricsRecorder.isRecording()) {
- this.cancelRecordingMetrics();
- }
LOGGER.info("Stopping server");
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
@@ -1164,10 +1143,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// note: To avoid possibly spinning forever, only execute tasks that are roughly available at the beginning // note: To avoid possibly spinning forever, only execute tasks that are roughly available at the beginning
// of this call. Packet processing and chunk system tasks are possibly always being queued. // of this call. Packet processing and chunk system tasks are possibly always being queued.
@@ -252,7 +262,7 @@ index 5d761c36739981897fe165148e528ef6b0e80b8d..ac0122e9a54c4f6e41638c79a75542fe
// avoid calling MinecraftServer#pollTask - we just want to execute queued tasks // avoid calling MinecraftServer#pollTask - we just want to execute queued tasks
while (super.pollTask()) { while (super.pollTask()) {
// execute small amounts of other tasks just in case the number of tasks we are // execute small amounts of other tasks just in case the number of tasks we are
@@ -1176,38 +1153,23 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1176,38 +1151,23 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
((ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer)this).moonrise$executeMidTickTasks(); // Paper - rewrite chunk system ((ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer)this).moonrise$executeMidTickTasks(); // Paper - rewrite chunk system
this.packetProcessor.executeSinglePacket(); this.packetProcessor.executeSinglePacket();
} }
@@ -291,7 +301,7 @@ index 5d761c36739981897fe165148e528ef6b0e80b8d..ac0122e9a54c4f6e41638c79a75542fe
this.waitingForNextTick = true; this.waitingForNextTick = true;
// implement waitForTasks // implement waitForTasks
final boolean isLoggingEnabled = this.isTickTimeLoggingEnabled(); final boolean isLoggingEnabled = this.isTickTimeLoggingEnabled();
@@ -1252,7 +1214,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1252,7 +1212,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} finally { } finally {
this.waitingForNextTick = false; this.waitingForNextTick = false;
} }
@@ -299,7 +309,7 @@ index 5d761c36739981897fe165148e528ef6b0e80b8d..ac0122e9a54c4f6e41638c79a75542fe
} }
// Paper end - improve tick loop // Paper end - improve tick loop
@@ -1340,43 +1301,31 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1340,44 +1299,32 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper end - improve tick loop // Paper end - improve tick loop
boolean flag = l == 0L; boolean flag = l == 0L;
@@ -347,7 +357,7 @@ index 5d761c36739981897fe165148e528ef6b0e80b8d..ac0122e9a54c4f6e41638c79a75542fe
+ if (crash != null) { + if (crash != null) {
+ this.chunkSystemCrash = null; + this.chunkSystemCrash = null;
+ throw new RuntimeException("Chunk system crash propagated to tick()", crash); + throw new RuntimeException("Chunk system crash propagated to tick()", crash);
} + }
+ // Paper end - rewrite chunk system + // Paper end - rewrite chunk system
+ this.tickFrame.end(); + this.tickFrame.end();
+ this.recordEndOfTick(); // Paper - improve tick loop + this.recordEndOfTick(); // Paper - improve tick loop
@@ -358,13 +368,14 @@ index 5d761c36739981897fe165148e528ef6b0e80b8d..ac0122e9a54c4f6e41638c79a75542fe
+ this.finishMeasuringTaskExecutionTime(); + this.finishMeasuringTaskExecutionTime();
+ if (flag) { + if (flag) {
+ this.tickRateManager.endTickWork(); + this.tickRateManager.endTickWork();
+ } }
+
+ this.logFullTickTime();
+ this.logFullTickTime();
+
this.isReady = true; this.isReady = true;
JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis); JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis);
@@ -1485,7 +1434,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa }
@@ -1485,7 +1432,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
protected void waitUntilNextTick() { protected void waitUntilNextTick() {
@@ -372,7 +383,7 @@ index 5d761c36739981897fe165148e528ef6b0e80b8d..ac0122e9a54c4f6e41638c79a75542fe
// Paper - improve tick loop - moved to start of tick // Paper - improve tick loop - moved to start of tick
this.waitingForNextTick = true; this.waitingForNextTick = true;
@@ -1550,7 +1498,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1550,7 +1496,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@Override @Override
public void doRunTask(TickTask task) { public void doRunTask(TickTask task) {
@@ -380,7 +391,7 @@ index 5d761c36739981897fe165148e528ef6b0e80b8d..ac0122e9a54c4f6e41638c79a75542fe
super.doRunTask(task); super.doRunTask(task);
} }
@@ -1640,12 +1587,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1640,12 +1585,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.ticksUntilAutosave--; this.ticksUntilAutosave--;
// Paper start - Incremental chunk and player saving // Paper start - Incremental chunk and player saving
@@ -393,7 +404,7 @@ index 5d761c36739981897fe165148e528ef6b0e80b8d..ac0122e9a54c4f6e41638c79a75542fe
final boolean fullSave = autosavePeriod > 0 && this.tickCount % autosavePeriod == 0; final boolean fullSave = autosavePeriod > 0 && this.tickCount % autosavePeriod == 0;
try { try {
this.isSaving = true; this.isSaving = true;
@@ -1660,10 +1605,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1660,10 +1603,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} finally { } finally {
this.isSaving = false; this.isSaving = false;
} }
@@ -405,16 +416,15 @@ index 5d761c36739981897fe165148e528ef6b0e80b8d..ac0122e9a54c4f6e41638c79a75542fe
this.server.spark.executeMainThreadTasks(); // Paper - spark this.server.spark.executeMainThreadTasks(); // Paper - spark
// Paper start - Server Tick Events // Paper start - Server Tick Events
long endTime = System.nanoTime(); long endTime = System.nanoTime();
@@ -1671,7 +1615,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1671,7 +1613,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - this.currentTickStart) / 1000000D), remaining).callEvent(); new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - this.currentTickStart) / 1000000D), remaining).callEvent();
// Paper end - Server Tick Events // Paper end - Server Tick Events
this.server.spark.tickEnd(((double)(endTime - this.currentTickStart) / 1000000D)); // Paper - spark this.server.spark.tickEnd(((double)(endTime - this.currentTickStart) / 1000000D)); // Paper - spark
- profilerFiller.push("tallying"); - profilerFiller.push("tallying");
+ this.server.spark.tickEnd(((double)(endTime - lastTick) / 1000000D)); // Paper - spark
long l = Util.getNanos() - nanos; long l = Util.getNanos() - nanos;
int i1 = this.tickCount % 100; int i1 = this.tickCount % 100;
this.aggregatedTickTimesNanos = this.aggregatedTickTimesNanos - this.tickTimesNanos[i1]; this.aggregatedTickTimesNanos = this.aggregatedTickTimesNanos - this.tickTimesNanos[i1];
@@ -1679,16 +1623,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1679,16 +1620,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.tickTimesNanos[i1] = l; this.tickTimesNanos[i1] = l;
this.smoothedTickTimeMillis = this.smoothedTickTimeMillis * 0.8F + (float)l / (float)TimeUtil.NANOSECONDS_PER_MILLISECOND * 0.19999999F; this.smoothedTickTimeMillis = this.smoothedTickTimeMillis * 0.8F + (float)l / (float)TimeUtil.NANOSECONDS_PER_MILLISECOND * 0.19999999F;
this.logTickMethodTime(nanos); this.logTickMethodTime(nanos);
@@ -431,7 +441,7 @@ index 5d761c36739981897fe165148e528ef6b0e80b8d..ac0122e9a54c4f6e41638c79a75542fe
LOGGER.debug("Autosave finished"); LOGGER.debug("Autosave finished");
} }
@@ -1756,7 +1696,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1756,7 +1693,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 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) { protected void tickChildren(BooleanSupplier hasTimeLeft) {
@@ -439,7 +449,7 @@ index 5d761c36739981897fe165148e528ef6b0e80b8d..ac0122e9a54c4f6e41638c79a75542fe
this.getPlayerList().getPlayers().forEach(serverPlayer1 -> serverPlayer1.connection.suspendFlushing()); this.getPlayerList().getPlayers().forEach(serverPlayer1 -> serverPlayer1.connection.suspendFlushing());
this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit
// Paper start - optimise Folia entity scheduler // Paper start - optimise Folia entity scheduler
@@ -1771,9 +1710,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1771,9 +1707,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper end - optimise Folia entity scheduler // Paper end - optimise Folia entity scheduler
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.ADVENTURE_CLICK_MANAGER.handleQueue(this.tickCount); // Paper io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.ADVENTURE_CLICK_MANAGER.handleQueue(this.tickCount); // Paper
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.DIALOG_CLICK_MANAGER.handleQueue(this.tickCount); // Paper io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.DIALOG_CLICK_MANAGER.handleQueue(this.tickCount); // Paper
@@ -449,7 +459,7 @@ index 5d761c36739981897fe165148e528ef6b0e80b8d..ac0122e9a54c4f6e41638c79a75542fe
this.updateEffectiveRespawnData(); this.updateEffectiveRespawnData();
// CraftBukkit start // CraftBukkit start
@@ -1810,17 +1747,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1810,17 +1744,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
serverLevel.updateLagCompensationTick(); // Paper - lag compensation 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 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 serverLevel.hasRidableMoveEvent = org.purpurmc.purpur.event.entity.RidableMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Purpur - Ridables
@@ -467,7 +477,7 @@ index 5d761c36739981897fe165148e528ef6b0e80b8d..ac0122e9a54c4f6e41638c79a75542fe
try { try {
serverLevel.tick(hasTimeLeft); serverLevel.tick(hasTimeLeft);
} catch (Throwable var7) { } catch (Throwable var7) {
@@ -1829,37 +1761,25 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1829,37 +1758,25 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
throw new ReportedException(crashReport); throw new ReportedException(crashReport);
} }
@@ -505,7 +515,7 @@ index 5d761c36739981897fe165148e528ef6b0e80b8d..ac0122e9a54c4f6e41638c79a75542fe
} }
// Paper start - per world respawn data - read "server global" respawn data from overworld dimension reference // Paper start - per world respawn data - read "server global" respawn data from overworld dimension reference
@@ -1884,14 +1804,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1884,14 +1801,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
public void forceTimeSynchronization() { public void forceTimeSynchronization() {
@@ -520,7 +530,7 @@ index 5d761c36739981897fe165148e528ef6b0e80b8d..ac0122e9a54c4f6e41638c79a75542fe
} }
public boolean isAllowedToEnterPortal(Level level) { public boolean isAllowedToEnterPortal(Level level) {
@@ -2736,55 +2651,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2736,55 +2648,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
// CraftBukkit end // CraftBukkit end
@@ -576,7 +586,7 @@ index 5d761c36739981897fe165148e528ef6b0e80b8d..ac0122e9a54c4f6e41638c79a75542fe
public Path getWorldPath(LevelResource levelResource) { public Path getWorldPath(LevelResource levelResource) {
return this.storageSource.getLevelPath(levelResource); return this.storageSource.getLevelPath(levelResource);
} }
@@ -2834,24 +2700,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2834,24 +2697,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return this.isSaving; return this.isSaving;
} }
@@ -601,7 +611,7 @@ index 5d761c36739981897fe165148e528ef6b0e80b8d..ac0122e9a54c4f6e41638c79a75542fe
public int getMaxChainedNeighborUpdates() { public int getMaxChainedNeighborUpdates() {
return 1000000; return 1000000;
} }
@@ -2999,55 +2847,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2999,55 +2844,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public record ServerResourcePackInfo(UUID id, String url, String hash, boolean isRequired, @Nullable Component prompt) { public record ServerResourcePackInfo(UUID id, String url, String hash, boolean isRequired, @Nullable Component prompt) {
} }
@@ -2707,7 +2717,7 @@ index 07d7c4737635f671f33b8f73001d67928fc75782..f2c82217811712625df594667330a73f
LOGGER.info("Loaded {} recipes", object.values().size()); LOGGER.info("Loaded {} recipes", object.values().size());
} }
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index 0dc444a63224ef3409f4e7ac800213d5a794a810..5b50b86c735fa2ba1b5452aacda7db5e64012076 100644 index abde1d66d545a5aded66a908473aa52b3c7a9ce8..cd42348d3bd64aa8cabc337f57b56a7243887ef6 100644
--- a/net/minecraft/world/level/Level.java --- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java
@@ -36,7 +36,6 @@ import net.minecraft.util.AbortableIterationConsumer; @@ -36,7 +36,6 @@ import net.minecraft.util.AbortableIterationConsumer;

View File

@@ -178,7 +178,7 @@ index 9889485b15501c1adf1a73bb4603d3477860482d..2457247d2bc1c3e3b042a091c3a8290d
// Paper start - rewrite chunk system // Paper start - rewrite chunk system
private volatile ca.spottedleaf.moonrise.patches.starlight.light.SWMRNibbleArray[] blockNibbles; private volatile ca.spottedleaf.moonrise.patches.starlight.light.SWMRNibbleArray[] blockNibbles;
diff --git a/net/minecraft/world/level/chunk/storage/SerializableChunkData.java b/net/minecraft/world/level/chunk/storage/SerializableChunkData.java diff --git a/net/minecraft/world/level/chunk/storage/SerializableChunkData.java b/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
index 84840f50d1bcebc7b0bdb1d2f79b53fd6fc98abb..38cdc0f8ce03cfd99658177f609ba3a6590cf000 100644 index 84840f50d1bcebc7b0bdb1d2f79b53fd6fc98abb..0e320673fb1cb9d4e4b5537850c2ad317624075f 100644
--- a/net/minecraft/world/level/chunk/storage/SerializableChunkData.java --- a/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
+++ b/net/minecraft/world/level/chunk/storage/SerializableChunkData.java +++ b/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
@@ -93,6 +93,7 @@ public record SerializableChunkData( @@ -93,6 +93,7 @@ public record SerializableChunkData(
@@ -278,7 +278,7 @@ index 84840f50d1bcebc7b0bdb1d2f79b53fd6fc98abb..38cdc0f8ce03cfd99658177f609ba3a6
+ +
+ // Paper start - throttle failed spawn attempts - for plugin compatibility + // Paper start - throttle failed spawn attempts - for plugin compatibility
+ public SerializableChunkData( + public SerializableChunkData(
+ Registry<Biome> biomeRegistry, + PalettedContainerFactory containerFactory,
+ ChunkPos chunkPos, + ChunkPos chunkPos,
+ int minSectionY, + int minSectionY,
+ long lastUpdateTime, + long lastUpdateTime,
@@ -298,7 +298,7 @@ index 84840f50d1bcebc7b0bdb1d2f79b53fd6fc98abb..38cdc0f8ce03cfd99658177f609ba3a6
+ CompoundTag structureData, + CompoundTag structureData,
+ @Nullable net.minecraft.nbt.Tag persistentDataContainer // CraftBukkit - persistentDataContainer + @Nullable net.minecraft.nbt.Tag persistentDataContainer // CraftBukkit - persistentDataContainer
+ ) { + ) {
+ this(biomeRegistry, + this(containerFactory,
+ chunkPos, + chunkPos,
+ minSectionY, + minSectionY,
+ lastUpdateTime, + lastUpdateTime,

View File

@@ -10,7 +10,7 @@ As part of: ModernFix (https://github.com/embeddedt/ModernFix)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/net/minecraft/world/level/chunk/PalettedContainer.java b/net/minecraft/world/level/chunk/PalettedContainer.java diff --git a/net/minecraft/world/level/chunk/PalettedContainer.java b/net/minecraft/world/level/chunk/PalettedContainer.java
index f1cae4cab36546d5798d2b59ac59774d1c9838c0..731da3f35013d9916577a7f475d6a796dd201742 100644 index f1cae4cab36546d5798d2b59ac59774d1c9838c0..3baf84b3f636a3ea04945cb4c0f17acd7109bedb 100644
--- a/net/minecraft/world/level/chunk/PalettedContainer.java --- a/net/minecraft/world/level/chunk/PalettedContainer.java
+++ b/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/net/minecraft/world/level/chunk/PalettedContainer.java
@@ -283,6 +283,28 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer @@ -283,6 +283,28 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@@ -35,7 +35,7 @@ index f1cae4cab36546d5798d2b59ac59774d1c9838c0..731da3f35013d9916577a7f475d6a796
+ return; + return;
+ } + }
+ this.data = this.createOrReuseData(null, 0); + this.data = this.createOrReuseData(null, 0);
+ this.data.palette.idFor(value); + this.data.palette.idFor(value, this);
+ } + }
+ } + }
+ // DivineMC end - ModernFix: compact_bit_storage + // DivineMC end - ModernFix: compact_bit_storage

View File

@@ -99,7 +99,7 @@ index b5afc05924ae899e020c303c8b86398e1d4ab8a0..2a6fdec4faae3512060cbb21a2043129
+ // DivineMC end - Implement NoChatReports + // DivineMC end - Implement NoChatReports
} }
diff --git a/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java b/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java diff --git a/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java b/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java
index 1df628ac0b414511aaed6e09d78f884c4170f730..1543f730843c1736c4db9a6ebe30be9cc9fbe36a 100644 index 1df628ac0b414511aaed6e09d78f884c4170f730..aba42c2ea4f2dde395edbded3bc96e58d213908f 100644
--- a/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java --- a/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java
+++ b/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java +++ b/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java
@@ -26,6 +26,19 @@ public record ServerboundChatSessionUpdatePacket(RemoteChatSession.Data chatSess @@ -26,6 +26,19 @@ public record ServerboundChatSessionUpdatePacket(RemoteChatSession.Data chatSess
@@ -110,7 +110,7 @@ index 1df628ac0b414511aaed6e09d78f884c4170f730..1543f730843c1736c4db9a6ebe30be9c
+ if (org.bxteam.divinemc.config.DivineConfig.NetworkCategory.noChatReportsEnabled) { + if (org.bxteam.divinemc.config.DivineConfig.NetworkCategory.noChatReportsEnabled) {
+ var impl = (net.minecraft.server.network.ServerGamePacketListenerImpl) handler; + var impl = (net.minecraft.server.network.ServerGamePacketListenerImpl) handler;
+ +
+ if (!impl.getPlayer().getServer().isSingleplayerOwner(impl.getPlayer().getGameProfile())) { + if (!impl.getPlayer().level().getServer().isSingleplayerOwner(impl.getPlayer().nameAndId())) {
+ if (org.bxteam.divinemc.config.DivineConfig.NetworkCategory.noChatReportsDemandOnClient) { + if (org.bxteam.divinemc.config.DivineConfig.NetworkCategory.noChatReportsDemandOnClient) {
+ impl.disconnect(net.minecraft.network.chat.Component.literal(org.bxteam.divinemc.config.DivineConfig.NetworkCategory.noChatReportsDisconnectDemandOnClientMessage)); + impl.disconnect(net.minecraft.network.chat.Component.literal(org.bxteam.divinemc.config.DivineConfig.NetworkCategory.noChatReportsDisconnectDemandOnClientMessage));
+ } + }

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Lag compensation
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index ac0122e9a54c4f6e41638c79a75542fe2db3c9a4..558445fbaeddf33506dea7080b3a76e6aa87f21f 100644 index 18c3599ceb7a1c9dc769af0ad4c3eff9e37e2a76..89aa020832fb9894e057b0f2b1226eb48c8accd1 100644
--- a/net/minecraft/server/MinecraftServer.java --- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java
@@ -286,6 +286,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -287,6 +287,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation
public boolean lagging = false; // Purpur - Lagging threshold public boolean lagging = false; // Purpur - Lagging threshold
protected boolean upnp = false; // Purpur - UPnP Port Forwarding protected boolean upnp = false; // Purpur - UPnP Port Forwarding
@@ -16,7 +16,7 @@ index ac0122e9a54c4f6e41638c79a75542fe2db3c9a4..558445fbaeddf33506dea7080b3a76e6
// Paper start - improve tick loop // Paper start - improve tick loop
public final ca.spottedleaf.moonrise.common.time.TickData tickTimes1s = new ca.spottedleaf.moonrise.common.time.TickData(java.util.concurrent.TimeUnit.SECONDS.toNanos(1L)); public final ca.spottedleaf.moonrise.common.time.TickData tickTimes1s = new ca.spottedleaf.moonrise.common.time.TickData(java.util.concurrent.TimeUnit.SECONDS.toNanos(1L));
public final ca.spottedleaf.moonrise.common.time.TickData tickTimes5s = new ca.spottedleaf.moonrise.common.time.TickData(java.util.concurrent.TimeUnit.SECONDS.toNanos(5L)); public final ca.spottedleaf.moonrise.common.time.TickData tickTimes5s = new ca.spottedleaf.moonrise.common.time.TickData(java.util.concurrent.TimeUnit.SECONDS.toNanos(5L));
@@ -1576,6 +1577,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1574,6 +1575,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
this.server.spark.tickStart(); // Paper - spark this.server.spark.tickStart(); // Paper - spark
@@ -183,7 +183,7 @@ index 6702b7199e159b16ecd06c57d87c692d04dbf7dc..1cced6128ad4ea0a00e0c772c34431a8
BlocksAttacks blocksAttacks = stack.get(DataComponents.BLOCKS_ATTACKS); BlocksAttacks blocksAttacks = stack.get(DataComponents.BLOCKS_ATTACKS);
return blocksAttacks != null ? 72000 : 0; return blocksAttacks != null ? 72000 : 0;
diff --git a/net/minecraft/world/level/GameRules.java b/net/minecraft/world/level/GameRules.java diff --git a/net/minecraft/world/level/GameRules.java b/net/minecraft/world/level/GameRules.java
index 45132e6608b57a30b1b1228ef89879b58d4600ef..6b86e9606073f1666d06237185af81f09f8c73d2 100644 index 45132e6608b57a30b1b1228ef89879b58d4600ef..a3daac69a79551a4a6a6d215cab3ce6838b2b09e 100644
--- a/net/minecraft/world/level/GameRules.java --- a/net/minecraft/world/level/GameRules.java
+++ b/net/minecraft/world/level/GameRules.java +++ b/net/minecraft/world/level/GameRules.java
@@ -379,8 +379,31 @@ public class GameRules { @@ -379,8 +379,31 @@ public class GameRules {
@@ -198,15 +198,15 @@ index 45132e6608b57a30b1b1228ef89879b58d4600ef..6b86e9606073f1666d06237185af81f0
+ private final java.util.concurrent.atomic.AtomicReference<net.minecraft.server.level.ServerLevel> level = new java.util.concurrent.atomic.AtomicReference<>(); + private final java.util.concurrent.atomic.AtomicReference<net.minecraft.server.level.ServerLevel> level = new java.util.concurrent.atomic.AtomicReference<>();
+ +
+ private int lagCompensation(int original, GameRules.Key<GameRules.IntegerValue> rule) { + private int lagCompensation(int original, GameRules.Key<GameRules.IntegerValue> rule) {
+ ServerLevel level = getOrCacheLevel(); + net.minecraft.server.level.ServerLevel level = getOrCacheLevel();
+ if (!org.bxteam.divinemc.config.DivineConfig.MiscCategory.lagCompensationEnabled || !org.bxteam.divinemc.config.DivineConfig.MiscCategory.randomTickSpeedAcceleration) return original; + if (!org.bxteam.divinemc.config.DivineConfig.MiscCategory.lagCompensationEnabled || !org.bxteam.divinemc.config.DivineConfig.MiscCategory.randomTickSpeedAcceleration) return original;
+ if (!(rule == GameRules.RULE_RANDOMTICKING)) return original; + if (!(rule == GameRules.RULE_RANDOMTICKING)) return original;
+ return (int) (original * org.bxteam.divinemc.util.tps.TPSCalculator.MAX_TPS / (float) level.tpsCalculator.getMostAccurateTPS()); + return (int) (original * org.bxteam.divinemc.util.tps.TPSCalculator.MAX_TPS / (float) level.tpsCalculator.getMostAccurateTPS());
+ } + }
+ +
+ private ServerLevel getOrCacheLevel() { + private net.minecraft.server.level.ServerLevel getOrCacheLevel() {
+ if (level.get() == null) { + if (level.get() == null) {
+ for (final ServerLevel level : MinecraftServer.getServer().getAllLevels()) { + for (final net.minecraft.server.level.ServerLevel level : MinecraftServer.getServer().getAllLevels()) {
+ if (level.getGameRules() == this) { + if (level.getGameRules() == this) {
+ this.level.set(level); + this.level.set(level);
+ break; + break;

View File

@@ -18,10 +18,10 @@ index 9a7a40c1dcea57ba674d8431077d2477104a456f..8e41097f978800039e6e057c5bbcfcf0
new java.util.concurrent.LinkedBlockingQueue<>(), new java.util.concurrent.LinkedBlockingQueue<>(),
new com.google.common.util.concurrent.ThreadFactoryBuilder() new com.google.common.util.concurrent.ThreadFactoryBuilder()
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 558445fbaeddf33506dea7080b3a76e6aa87f21f..93a0bd04a325a0fbac2eb01f2db9f57801f2f8a9 100644 index 89aa020832fb9894e057b0f2b1226eb48c8accd1..4ba10f90711ac8b6813f86bcff9635716fdc6028 100644
--- a/net/minecraft/server/MinecraftServer.java --- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java
@@ -2717,8 +2717,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2714,8 +2714,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
} }

View File

@@ -677,9 +677,18 @@ index e3478244e430faa614f23c288019303bd6bb0e04..862a7d464e1045e543049523d771bf79
@Override @Override
protected float distance(Node first, Node second) { protected float distance(Node first, Node second) {
diff --git a/net/minecraft/world/level/pathfinder/Path.java b/net/minecraft/world/level/pathfinder/Path.java diff --git a/net/minecraft/world/level/pathfinder/Path.java b/net/minecraft/world/level/pathfinder/Path.java
index d8d086b54f07a855cf312b6f742802e267dfd034..42bf9d4d4a66c1de99ac1ad5b24210f17ec6c0ad 100644 index d8d086b54f07a855cf312b6f742802e267dfd034..bd02babf2a9bb4bd5585f408deeba0c70b721dd0 100644
--- a/net/minecraft/world/level/pathfinder/Path.java --- a/net/minecraft/world/level/pathfinder/Path.java
+++ b/net/minecraft/world/level/pathfinder/Path.java +++ b/net/minecraft/world/level/pathfinder/Path.java
@@ -11,7 +11,7 @@ import net.minecraft.util.VisibleForDebug;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.Vec3;
-public final class Path {
+public class Path {
public static final StreamCodec<FriendlyByteBuf, Path> STREAM_CODEC = StreamCodec.of((buffer, value) -> value.writeToStream(buffer), Path::createFromStream);
public final List<Node> nodes;
@Nullable
@@ -28,6 +28,17 @@ public final class Path { @@ -28,6 +28,17 @@ public final class Path {
this.reached = reached; this.reached = reached;
} }

View File

@@ -9,10 +9,10 @@ Original project: https://github.com/pufferfish-gg/Pufferfish
This patch reduces the main-thread impact of mob spawning by moving spawning work to other threads This patch reduces the main-thread impact of mob spawning by moving spawning work to other threads
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index a876c7c47788218a86cef53330b2c07f7008b0b0..b65e35cd5bf7f3af8826cb9e9e2696921a951a62 100644 index 4ba10f90711ac8b6813f86bcff9635716fdc6028..95e39a728b7505a273a6e9c927308ee8931ea756 100644
--- a/net/minecraft/server/MinecraftServer.java --- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java
@@ -287,6 +287,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -288,6 +288,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public boolean lagging = false; // Purpur - Lagging threshold public boolean lagging = false; // Purpur - Lagging threshold
protected boolean upnp = false; // Purpur - UPnP Port Forwarding protected boolean upnp = false; // Purpur - UPnP Port Forwarding
public final org.bxteam.divinemc.util.tps.TPSCalculator tpsCalculator = new org.bxteam.divinemc.util.tps.TPSCalculator(); // DivineMC - Lag compensation public final org.bxteam.divinemc.util.tps.TPSCalculator tpsCalculator = new org.bxteam.divinemc.util.tps.TPSCalculator(); // DivineMC - Lag compensation

View File

@@ -1150,7 +1150,7 @@ index ff0c2aa0cdf7a88f67e6438dbd17d9c2bc39107a..3c3615043ab87da45b7ea47bf2f632a9
@Override @Override
diff --git a/net/minecraft/world/level/levelgen/RandomState.java b/net/minecraft/world/level/levelgen/RandomState.java diff --git a/net/minecraft/world/level/levelgen/RandomState.java b/net/minecraft/world/level/levelgen/RandomState.java
index f1e089ecfffa40cd794c49db30fcedf138d3fee9..3d8bdd7e40c7457c0ad7729162b43cba2043b8b5 100644 index f1e089ecfffa40cd794c49db30fcedf138d3fee9..f0f28f433523e0ee9379af5b70cffe8f8c87da5d 100644
--- a/net/minecraft/world/level/levelgen/RandomState.java --- a/net/minecraft/world/level/levelgen/RandomState.java
+++ b/net/minecraft/world/level/levelgen/RandomState.java +++ b/net/minecraft/world/level/levelgen/RandomState.java
@@ -122,6 +122,41 @@ public final class RandomState { @@ -122,6 +122,41 @@ public final class RandomState {
@@ -1173,7 +1173,7 @@ index f1e089ecfffa40cd794c49db30fcedf138d3fee9..3d8bdd7e40c7457c0ad7729162b43cba
+ com.ishland.c2me.opts.dfc.common.gen.BytecodeGen.compile(this.router.erosion(), tempCache), + com.ishland.c2me.opts.dfc.common.gen.BytecodeGen.compile(this.router.erosion(), tempCache),
+ com.ishland.c2me.opts.dfc.common.gen.BytecodeGen.compile(this.router.depth(), tempCache), + com.ishland.c2me.opts.dfc.common.gen.BytecodeGen.compile(this.router.depth(), tempCache),
+ com.ishland.c2me.opts.dfc.common.gen.BytecodeGen.compile(this.router.ridges(), tempCache), + com.ishland.c2me.opts.dfc.common.gen.BytecodeGen.compile(this.router.ridges(), tempCache),
+ com.ishland.c2me.opts.dfc.common.gen.BytecodeGen.compile(this.router.initialDensityWithoutJaggedness(), tempCache), + com.ishland.c2me.opts.dfc.common.gen.BytecodeGen.compile(this.router.preliminarySurfaceLevel(), tempCache),
+ com.ishland.c2me.opts.dfc.common.gen.BytecodeGen.compile(this.router.finalDensity(), tempCache), + com.ishland.c2me.opts.dfc.common.gen.BytecodeGen.compile(this.router.finalDensity(), tempCache),
+ com.ishland.c2me.opts.dfc.common.gen.BytecodeGen.compile(this.router.veinToggle(), tempCache), + com.ishland.c2me.opts.dfc.common.gen.BytecodeGen.compile(this.router.veinToggle(), tempCache),
+ com.ishland.c2me.opts.dfc.common.gen.BytecodeGen.compile(this.router.veinRidged(), tempCache), + com.ishland.c2me.opts.dfc.common.gen.BytecodeGen.compile(this.router.veinRidged(), tempCache),

View File

@@ -82,10 +82,10 @@ index 181fdb493f64442c659165c10e237ebc198fb6e2..43363235f3dc696973eee99548b1ae55
List<org.bukkit.block.BlockState> states = new java.util.ArrayList<>(level.capturedBlockStates.values()); List<org.bukkit.block.BlockState> states = new java.util.ArrayList<>(level.capturedBlockStates.values());
level.capturedBlockStates.clear(); level.capturedBlockStates.clear();
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index d311370b1ab05d63e0926e762fe5a938b25a42cb..495fbb4285f7da79e35118cae9212cb29b057d97 100644 index 95e39a728b7505a273a6e9c927308ee8931ea756..9e09e9823f53e60c819d43012905fa21d044e283 100644
--- a/net/minecraft/server/MinecraftServer.java --- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java
@@ -288,6 +288,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -289,6 +289,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
protected boolean upnp = false; // Purpur - UPnP Port Forwarding protected boolean upnp = false; // Purpur - UPnP Port Forwarding
public final org.bxteam.divinemc.util.tps.TPSCalculator tpsCalculator = new org.bxteam.divinemc.util.tps.TPSCalculator(); // DivineMC - Lag compensation public final org.bxteam.divinemc.util.tps.TPSCalculator tpsCalculator = new org.bxteam.divinemc.util.tps.TPSCalculator(); // DivineMC - Lag compensation
public gg.pufferfish.pufferfish.util.AsyncExecutor mobSpawnExecutor = new gg.pufferfish.pufferfish.util.AsyncExecutor("Mob Spawning"); // DivineMC - Pufferfish: Optimize mob spawning public gg.pufferfish.pufferfish.util.AsyncExecutor mobSpawnExecutor = new gg.pufferfish.pufferfish.util.AsyncExecutor("Mob Spawning"); // DivineMC - Pufferfish: Optimize mob spawning
@@ -93,7 +93,7 @@ index d311370b1ab05d63e0926e762fe5a938b25a42cb..495fbb4285f7da79e35118cae9212cb2
// Paper start - improve tick loop // Paper start - improve tick loop
public final ca.spottedleaf.moonrise.common.time.TickData tickTimes1s = new ca.spottedleaf.moonrise.common.time.TickData(java.util.concurrent.TimeUnit.SECONDS.toNanos(1L)); public final ca.spottedleaf.moonrise.common.time.TickData tickTimes1s = new ca.spottedleaf.moonrise.common.time.TickData(java.util.concurrent.TimeUnit.SECONDS.toNanos(1L));
public final ca.spottedleaf.moonrise.common.time.TickData tickTimes5s = new ca.spottedleaf.moonrise.common.time.TickData(java.util.concurrent.TimeUnit.SECONDS.toNanos(5L)); public final ca.spottedleaf.moonrise.common.time.TickData tickTimes5s = new ca.spottedleaf.moonrise.common.time.TickData(java.util.concurrent.TimeUnit.SECONDS.toNanos(5L));
@@ -373,24 +374,36 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -374,24 +375,36 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private long lastMidTickExecute; private long lastMidTickExecute;
private long lastMidTickExecuteFailure; private long lastMidTickExecuteFailure;
@@ -143,7 +143,7 @@ index d311370b1ab05d63e0926e762fe5a938b25a42cb..495fbb4285f7da79e35118cae9212cb2
} }
@Override @Override
@@ -1698,6 +1711,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1695,6 +1708,18 @@ 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 public final io.papermc.paper.threadedregions.EntityScheduler.EntitySchedulerTickList entitySchedulerTickList = new io.papermc.paper.threadedregions.EntityScheduler.EntitySchedulerTickList(); // Paper - optimise Folia entity scheduler
@@ -162,7 +162,7 @@ index d311370b1ab05d63e0926e762fe5a938b25a42cb..495fbb4285f7da79e35118cae9212cb2
protected void tickChildren(BooleanSupplier hasTimeLeft) { protected void tickChildren(BooleanSupplier hasTimeLeft) {
this.getPlayerList().getPlayers().forEach(serverPlayer1 -> serverPlayer1.connection.suspendFlushing()); this.getPlayerList().getPlayers().forEach(serverPlayer1 -> serverPlayer1.connection.suspendFlushing());
this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit
@@ -1744,28 +1769,43 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1741,28 +1766,43 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
this.isIteratingOverLevels = true; // Paper - Throw exception on world create while being ticked this.isIteratingOverLevels = true; // Paper - Throw exception on world create while being ticked
@@ -224,7 +224,7 @@ index d311370b1ab05d63e0926e762fe5a938b25a42cb..495fbb4285f7da79e35118cae9212cb2
this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
this.tickConnection(); this.tickConnection();
@@ -1853,6 +1893,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1850,6 +1890,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
Map<ResourceKey<Level>, ServerLevel> oldLevels = this.levels; Map<ResourceKey<Level>, ServerLevel> oldLevels = this.levels;
Map<ResourceKey<Level>, ServerLevel> newLevels = Maps.newLinkedHashMap(oldLevels); Map<ResourceKey<Level>, ServerLevel> newLevels = Maps.newLinkedHashMap(oldLevels);
newLevels.remove(level.dimension()); newLevels.remove(level.dimension());
@@ -958,7 +958,7 @@ index 358d69bdca0aa46d1952d3ef9bf9b65dc39a3338..d04167eccda1fe29abe7fc28cab0c837
serverLevel.capturedBlockStates.clear(); serverLevel.capturedBlockStates.clear();
org.bukkit.event.world.StructureGrowEvent structureEvent = null; org.bukkit.event.world.StructureGrowEvent structureEvent = null;
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index b94b946986258fed3c6d68d9972a657e176d08a4..250978ef6e09c8744065d143af38b99914bd25ec 100644 index c8f5462bfd4d0fd24dfb20116ad5eb3489484042..49c4d40e802f8adaba52d929ba013d3953704989 100644
--- a/net/minecraft/world/level/Level.java --- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java
@@ -166,6 +166,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -166,6 +166,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] MSPT Tracking for each world
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 495fbb4285f7da79e35118cae9212cb29b057d97..88296555274b67dc504c4765bc9bf049545ca19a 100644 index 9e09e9823f53e60c819d43012905fa21d044e283..e3fb85c466aca52bd4431aabbc13a4de58c2f474 100644
--- a/net/minecraft/server/MinecraftServer.java --- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java
@@ -1714,7 +1714,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1711,7 +1711,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// DivineMC start - Parallel world ticking // DivineMC start - Parallel world ticking
private void tickLevel(ServerLevel serverLevel, BooleanSupplier hasTimeLeft) { private void tickLevel(ServerLevel serverLevel, BooleanSupplier hasTimeLeft) {
try { try {

View File

@@ -20,10 +20,10 @@ index ae0eb872f59be23126a7d44056607058c81a0e81..e76530da9641acc482aa0f030c4dc267
if (var3 instanceof ReportedException reportedException && reportedException.getCause() instanceof OutOfMemoryError) { if (var3 instanceof ReportedException reportedException && reportedException.getCause() instanceof OutOfMemoryError) {
throw PacketUtils.makeReportedException(var3, this.packet, this.listener); throw PacketUtils.makeReportedException(var3, this.packet, this.listener);
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 88296555274b67dc504c4765bc9bf049545ca19a..3ea69f961797e390aabb697ad9a7f007e549d04d 100644 index e3fb85c466aca52bd4431aabbc13a4de58c2f474..db392b8596f1f0438894a9fa8246beeb69ce0fd6 100644
--- a/net/minecraft/server/MinecraftServer.java --- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java
@@ -1723,6 +1723,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1720,6 +1720,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
serverLevel.tickTimes10s.add(this.tickCount, j); serverLevel.tickTimes10s.add(this.tickCount, j);
serverLevel.tickTimes60s.add(this.tickCount, j); serverLevel.tickTimes60s.add(this.tickCount, j);
// DivineMC end - MSPT Tracking for each world // DivineMC end - MSPT Tracking for each world

View File

@@ -60,10 +60,10 @@ index 51c126735ace8fdde89ad97b5cab62f244212db0..23f6ed26b531ea570fdf2ae48c1e2710
+ public void moonrise$write(final org.bxteam.divinemc.region.IRegionFile regionFile) throws IOException; // DivineMC - Buffered Linear region format + public void moonrise$write(final org.bxteam.divinemc.region.IRegionFile regionFile) throws IOException; // DivineMC - Buffered Linear region format
} }
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 3ea69f961797e390aabb697ad9a7f007e549d04d..30fb5b93ebb4b5f21c64f6589c33496df5242b1d 100644 index db392b8596f1f0438894a9fa8246beeb69ce0fd6..83ccf00e3cff9dced3cc97abffd7881b0be5420e 100644
--- a/net/minecraft/server/MinecraftServer.java --- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java
@@ -933,10 +933,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -934,10 +934,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit end // CraftBukkit end
if (flush) { if (flush) {
for (ServerLevel serverLevel : this.getAllLevels()) { for (ServerLevel serverLevel : this.getAllLevels()) {
@@ -148,7 +148,7 @@ index ae0a893498d0bfe90c14508f15b431d4885e06ff..00656cf8634e06f7ce1067ef7ba44edf
} }
// Paper end - rewrite chunk system // Paper end - rewrite chunk system
diff --git a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java diff --git a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index 8215edb0dbb5a9de66d5107786c338d2fd02d5ea..954f1866176f28eb1bdee395130a60cfc7585c39 100644 index 8215edb0dbb5a9de66d5107786c338d2fd02d5ea..e92415ac17952831a14d048b12ee7b3e36c941d6 100644
--- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java --- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -19,7 +19,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise @@ -19,7 +19,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
@@ -323,7 +323,7 @@ index 8215edb0dbb5a9de66d5107786c338d2fd02d5ea..954f1866176f28eb1bdee395130a60cf
public void write(ChunkPos chunkPos, @Nullable CompoundTag chunkData) throws IOException { // Paper - rewrite chunk system - public public void write(ChunkPos chunkPos, @Nullable CompoundTag chunkData) throws IOException { // Paper - rewrite chunk system - public
if (!SharedConstants.DEBUG_DONT_SAVE_WORLD) { if (!SharedConstants.DEBUG_DONT_SAVE_WORLD) {
- RegionFile regionFile = this.getRegionFile(chunkPos, chunkData == null); // CraftBukkit // Paper - rewrite chunk system - RegionFile regionFile = this.getRegionFile(chunkPos, chunkData == null); // CraftBukkit // Paper - rewrite chunk system
+ org.bxteam.divinemc.region.IRegionFile = this.getRegionFile(chunkPos, chunkData == null); // CraftBukkit // Paper - rewrite chunk system // DivineMC - Buffered Linear region format + org.bxteam.divinemc.region.IRegionFile regionFile = this.getRegionFile(chunkPos, chunkData == null); // CraftBukkit // Paper - rewrite chunk system // DivineMC - Buffered Linear region format
// Paper start - rewrite chunk system // Paper start - rewrite chunk system
if (regionFile == null) { if (regionFile == null) {
// if the RegionFile doesn't exist, no point in deleting from it // if the RegionFile doesn't exist, no point in deleting from it

View File

@@ -35,10 +35,10 @@ index fb263fa1f30a7dfcb7ec2656abfb38e5fe88eac9..c3be4c2fd4a544967322a45d3b8c0fe7
}; };
} }
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 30fb5b93ebb4b5f21c64f6589c33496df5242b1d..60fb143765a9c8fa45b555b4b4c78232c7cf863c 100644 index 83ccf00e3cff9dced3cc97abffd7881b0be5420e..60e77f74124027cc73fd4366b77fdb54c68273e5 100644
--- a/net/minecraft/server/MinecraftServer.java --- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java
@@ -1827,6 +1827,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1824,6 +1824,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
GameTestTicker.SINGLETON.tick(); GameTestTicker.SINGLETON.tick();
} }

View File

@@ -6,7 +6,7 @@ Subject: [PATCH] SparklyPaper: Parallel world ticking
Original project: https://github.com/SparklyPower/SparklyPaper Original project: https://github.com/SparklyPower/SparklyPaper
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
index 69cdd304d255d52c9b7dc9b6a33ffdb630b79abe..a4adaba06c1bc4bb8029ccb128fde90ec2564525 100644 index 69cdd304d255d52c9b7dc9b6a33ffdb630b79abe..73475f21a65395ab3f888d04d4860acde8aeb09c 100644
--- a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java --- a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
+++ b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java +++ b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
@@ -14,6 +14,7 @@ import java.util.concurrent.atomic.AtomicInteger; @@ -14,6 +14,7 @@ import java.util.concurrent.atomic.AtomicInteger;
@@ -57,7 +57,7 @@ index 69cdd304d255d52c9b7dc9b6a33ffdb630b79abe..a4adaba06c1bc4bb8029ccb128fde90e
if (!isTickThreadFor(entity)) { if (!isTickThreadFor(entity)) {
final String ex = "Thread failed main thread check: " + final String ex = "Thread failed main thread check: " +
- reason + ", context=" + getThreadContext() + ", entity=" + EntityUtil.dumpEntity(entity); - reason + ", context=" + getThreadContext() + ", entity=" + EntityUtil.dumpEntity(entity);
+ reason + ", context=" + getThreadContext() + ", entity=" + EntityUtil.dumpEntity(entity) + " - " + getTickThreadInformation(entity.getServer()); // DivineMC - Parallel world ticking + reason + ", context=" + getThreadContext() + ", entity=" + EntityUtil.dumpEntity(entity) + " - " + getTickThreadInformation(entity.level().getServer()); // DivineMC - Parallel world ticking
LOGGER.error(ex, new Throwable()); LOGGER.error(ex, new Throwable());
throw new IllegalStateException(ex); throw new IllegalStateException(ex);
} }

View File

@@ -1,6 +1,7 @@
package com.ishland.c2me.opts.dfc.common.ast; package com.ishland.c2me.opts.dfc.common.ast;
import com.ishland.c2me.opts.dfc.common.ast.binary.AddNode; import com.ishland.c2me.opts.dfc.common.ast.binary.AddNode;
import com.ishland.c2me.opts.dfc.common.ast.binary.DivNode;
import com.ishland.c2me.opts.dfc.common.ast.binary.MaxNode; import com.ishland.c2me.opts.dfc.common.ast.binary.MaxNode;
import com.ishland.c2me.opts.dfc.common.ast.binary.MaxShortNode; import com.ishland.c2me.opts.dfc.common.ast.binary.MaxShortNode;
import com.ishland.c2me.opts.dfc.common.ast.binary.MinNode; import com.ishland.c2me.opts.dfc.common.ast.binary.MinNode;
@@ -75,6 +76,7 @@ public class McToAst {
case CUBE -> new CubeNode(toAst(f.input())); case CUBE -> new CubeNode(toAst(f.input()));
case HALF_NEGATIVE -> new NegMulNode(toAst(f.input()), 0.5); case HALF_NEGATIVE -> new NegMulNode(toAst(f.input()), 0.5);
case QUARTER_NEGATIVE -> new NegMulNode(toAst(f.input()), 0.25); case QUARTER_NEGATIVE -> new NegMulNode(toAst(f.input()), 0.25);
case INVERT -> new DivNode(new ConstantNode(1.0), toAst(f.input()));
case SQUEEZE -> new SqueezeNode(toAst(f.input())); case SQUEEZE -> new SqueezeNode(toAst(f.input()));
}; };
case DensityFunctions.RangeChoice f -> new RangeChoiceNode(toAst(f.input()), f.minInclusive(), f.maxExclusive(), toAst(f.whenInRange()), toAst(f.whenOutOfRange())); case DensityFunctions.RangeChoice f -> new RangeChoiceNode(toAst(f.input()), f.minInclusive(), f.maxExclusive(), toAst(f.whenInRange()), toAst(f.whenOutOfRange()));

View File

@@ -0,0 +1,53 @@
package com.ishland.c2me.opts.dfc.common.ast.binary;
import com.ishland.c2me.opts.dfc.common.ast.AstNode;
import com.ishland.c2me.opts.dfc.common.ast.EvalType;
import com.ishland.c2me.opts.dfc.common.gen.BytecodeGen;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.InstructionAdapter;
public class DivNode extends AbstractBinaryNode {
public DivNode(AstNode left, AstNode right) {
super(left, right);
}
@Override
protected AstNode newInstance(AstNode left, AstNode right) {
return new DivNode(left, right);
}
@Override
public double evalSingle(int x, int y, int z, EvalType type) {
return this.left.evalSingle(x, y, z, type) / this.right.evalSingle(x, y, z, type);
}
@Override
public void evalMulti(double[] res, int[] x, int[] y, int[] z, EvalType type) {
double[] res1 = new double[res.length];
this.left.evalMulti(res, x, y, z, type);
this.right.evalMulti(res1, x, y, z, type);
for (int i = 0; i < res1.length; i++) {
res[i] /= res1[i];
}
}
@Override
public void doBytecodeGenSingle(BytecodeGen.Context context, InstructionAdapter m, BytecodeGen.Context.LocalVarConsumer localVarConsumer) {
super.doBytecodeGenSingle(context, m, localVarConsumer);
m.div(Type.DOUBLE_TYPE);
m.areturn(Type.DOUBLE_TYPE);
}
@Override
protected void bytecodeGenMultiBody(InstructionAdapter m, int idx, int res1) {
m.load(1, InstructionAdapter.OBJECT_TYPE);
m.load(idx, Type.INT_TYPE);
m.dup2();
m.aload(Type.DOUBLE_TYPE);
m.load(res1, InstructionAdapter.OBJECT_TYPE);
m.load(idx, Type.INT_TYPE);
m.aload(Type.DOUBLE_TYPE);
m.div(Type.DOUBLE_TYPE);
m.astore(Type.DOUBLE_TYPE);
}
}

View File

@@ -1,5 +1,6 @@
package org.bxteam.divinemc.command.subcommands; package org.bxteam.divinemc.command.subcommands;
import ca.spottedleaf.moonrise.common.time.TickData;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.NamedTextColor;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
@@ -59,7 +60,7 @@ public final class MSPTCommand extends DivineSubCommandPermission {
} }
private void displayCompactStats(CommandSender sender, MinecraftServer server) { private void displayCompactStats(CommandSender sender, MinecraftServer server) {
List<Component> serverTimes = eval(server.tickTimes5s.getTimes()); List<Component> serverTimes = evalFromTickData(server.tickTimes5s, server.tickRateManager().nanosecondsPerTick());
sender.sendMessage(Component.text("Server: ", GOLD) sender.sendMessage(Component.text("Server: ", GOLD)
.append(joinComponents(serverTimes, SLASH))); .append(joinComponents(serverTimes, SLASH)));
@@ -68,7 +69,7 @@ public final class MSPTCommand extends DivineSubCommandPermission {
for (int i = 0; i < worlds.size(); i++) { for (int i = 0; i < worlds.size(); i++) {
ServerLevel level = worlds.get(i); ServerLevel level = worlds.get(i);
List<Component> worldTimes = eval(level.tickTimes5s.getTimes()); List<Component> worldTimes = evalFromTickData(level.getServer().tickTimes5s, server.tickRateManager().nanosecondsPerTick());
sender.sendMessage(Component.text(level.getWorld().getName() + ": ", GOLD) sender.sendMessage(Component.text(level.getWorld().getName() + ": ", GOLD)
.append(joinComponents(worldTimes, SLASH))); .append(joinComponents(worldTimes, SLASH)));
if (i < worlds.size() - 1) { if (i < worlds.size() - 1) {
@@ -81,9 +82,10 @@ public final class MSPTCommand extends DivineSubCommandPermission {
sender.sendMessage(Component.text("Server tick times ", GOLD) sender.sendMessage(Component.text("Server tick times ", GOLD)
.append(Component.text("(avg/min/max)", YELLOW))); .append(Component.text("(avg/min/max)", YELLOW)));
sendTickLine(sender, " 5s: ", eval(server.tickTimes5s.getTimes()), GOLD, SLASH); long tickInterval = server.tickRateManager().nanosecondsPerTick();
sendTickLine(sender, " 10s: ", eval(server.tickTimes10s.getTimes()), GOLD, SLASH); sendTickLine(sender, " 5s: ", evalFromTickData(server.tickTimes5s, tickInterval), GOLD, SLASH);
sendTickLine(sender, " 60s: ", eval(server.tickTimes60s.getTimes()), GOLD, SLASH); sendTickLine(sender, " 10s: ", evalFromTickData(server.tickTimes10s, tickInterval), GOLD, SLASH);
sendTickLine(sender, " 60s: ", evalFromTickData(server.tickTimes1m, tickInterval), GOLD, SLASH);
} }
private void displayWorldMSPT(CommandSender sender, MinecraftServer server) { private void displayWorldMSPT(CommandSender sender, MinecraftServer server) {
@@ -133,6 +135,26 @@ public final class MSPTCommand extends DivineSubCommandPermission {
return Arrays.asList(getColoredValue(avg), getColoredValue(min), getColoredValue(max)); return Arrays.asList(getColoredValue(avg), getColoredValue(min), getColoredValue(max));
} }
private static List<Component> evalFromTickData(ca.spottedleaf.moonrise.common.time.TickData tickData, long tickInterval) {
TickData.TickReportData report = tickData.generateTickReport(null, System.nanoTime(), tickInterval);
if (report == null) {
return Arrays.asList(
Component.text("N/A", GRAY),
Component.text("N/A", GRAY),
Component.text("N/A", GRAY)
);
}
TickData.SegmentData segmentAll = report.timePerTickData().segmentAll();
double avg = segmentAll.average() * 1.0E-6;
double min = segmentAll.least() * 1.0E-6;
double max = segmentAll.greatest() * 1.0E-6;
return Arrays.asList(getColoredValue(avg), getColoredValue(min), getColoredValue(max));
}
private static Component getColoredValue(double value) { private static Component getColoredValue(double value) {
NamedTextColor color = value >= 50 ? RED NamedTextColor color = value >= 50 ? RED
: value >= 40 ? YELLOW : value >= 40 ? YELLOW

View File

@@ -11,7 +11,6 @@ import org.bxteam.divinemc.config.annotations.Experimental;
import org.bxteam.divinemc.async.pathfinding.PathfindTaskRejectPolicy; import org.bxteam.divinemc.async.pathfinding.PathfindTaskRejectPolicy;
import org.bxteam.divinemc.region.EnumRegionFileExtension; import org.bxteam.divinemc.region.EnumRegionFileExtension;
import org.bxteam.divinemc.region.type.LinearRegionFile; import org.bxteam.divinemc.region.type.LinearRegionFile;
import org.bxteam.divinemc.async.AsyncJoinHandler;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.simpleyaml.configuration.comments.CommentType; import org.simpleyaml.configuration.comments.CommentType;
import org.simpleyaml.configuration.file.YamlFile; import org.simpleyaml.configuration.file.YamlFile;

View File

@@ -54,7 +54,7 @@ public class AppleSkinProtocol implements LeavesProtocol {
@ProtocolHandler.MinecraftRegister(onlyNamespace = true) @ProtocolHandler.MinecraftRegister(onlyNamespace = true)
public static void onPlayerSubscribed(@NotNull Context context, ResourceLocation id) { public static void onPlayerSubscribed(@NotNull Context context, ResourceLocation id) {
subscribedChannels.computeIfAbsent(context.profile().getId(), k -> new HashSet<>()).add(id.getPath()); subscribedChannels.computeIfAbsent(context.profile().id(), k -> new HashSet<>()).add(id.getPath());
} }
@ProtocolHandler.Ticker @ProtocolHandler.Ticker

View File

@@ -36,9 +36,8 @@ public enum CampfireProvider implements IServerExtensionProvider<ItemStack> {
} }
stack = stack.copy(); stack = stack.copy();
CustomData customData = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY) int time = campfire.cookingTime[i] - campfire.cookingProgress[i];
.update(NbtOps.INSTANCE, COOKING_TIME_CODEC, campfire.cookingTime[i] - campfire.cookingProgress[i]) CustomData customData = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY).update(tag -> tag.putInt("jade:cooking", time));
.getOrThrow();
stack.set(DataComponents.CUSTOM_DATA, customData); stack.set(DataComponents.CUSTOM_DATA, customData);
list.add(stack); list.add(stack);

View File

@@ -13,6 +13,8 @@ import org.leavesmc.leaves.protocol.jade.accessor.BlockAccessor;
import org.leavesmc.leaves.protocol.jade.provider.ItemStorageProvider; import org.leavesmc.leaves.protocol.jade.provider.ItemStorageProvider;
import org.leavesmc.leaves.protocol.jade.provider.StreamServerDataProvider; import org.leavesmc.leaves.protocol.jade.provider.StreamServerDataProvider;
import static net.minecraft.world.level.block.CampfireBlock.FACING;
public enum ChiseledBookshelfProvider implements StreamServerDataProvider<BlockAccessor, ItemStack> { public enum ChiseledBookshelfProvider implements StreamServerDataProvider<BlockAccessor, ItemStack> {
INSTANCE; INSTANCE;
@@ -20,7 +22,7 @@ public enum ChiseledBookshelfProvider implements StreamServerDataProvider<BlockA
@Override @Override
public @Nullable ItemStack streamData(@NotNull BlockAccessor accessor) { public @Nullable ItemStack streamData(@NotNull BlockAccessor accessor) {
int slot = ((ChiseledBookShelfBlock) accessor.getBlock()).getHitSlot(accessor.getHitResult(), accessor.getBlockState()).orElse(-1); int slot = ((ChiseledBookShelfBlock) accessor.getBlock()).getHitSlot(accessor.getHitResult(), accessor.getBlockState().getValue(FACING)).orElse(-1);
if (slot == -1) { if (slot == -1) {
return null; return null;
} }

View File

@@ -1,22 +1,27 @@
package org.leavesmc.leaves.protocol.jade.provider.entity; package org.leavesmc.leaves.protocol.jade.provider.entity;
import com.mojang.authlib.GameProfile;
import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.ComponentSerialization;
import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.codec.StreamCodec;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.Services;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.players.NameAndId;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityReference; import net.minecraft.world.entity.EntityReference;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.OwnableEntity; import net.minecraft.world.entity.OwnableEntity;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.leavesmc.leaves.protocol.jade.JadeProtocol; import org.leavesmc.leaves.protocol.jade.JadeProtocol;
import org.leavesmc.leaves.protocol.jade.accessor.EntityAccessor; import org.leavesmc.leaves.protocol.jade.accessor.EntityAccessor;
import org.leavesmc.leaves.protocol.jade.provider.StreamServerDataProvider; import org.leavesmc.leaves.protocol.jade.provider.StreamServerDataProvider;
import org.leavesmc.leaves.protocol.jade.util.CommonUtil;
import java.util.UUID; import java.util.UUID;
public enum AnimalOwnerProvider implements StreamServerDataProvider<EntityAccessor, String> { public enum AnimalOwnerProvider implements StreamServerDataProvider<EntityAccessor, Component> {
INSTANCE; INSTANCE;
private static final ResourceLocation MC_ANIMAL_OWNER = JadeProtocol.mc_id("animal_owner"); private static final ResourceLocation MC_ANIMAL_OWNER = JadeProtocol.mc_id("animal_owner");
@@ -32,17 +37,37 @@ public enum AnimalOwnerProvider implements StreamServerDataProvider<EntityAccess
} }
@Override @Override
public String streamData(@NotNull EntityAccessor accessor) { public Component streamData(@NotNull EntityAccessor accessor) {
return CommonUtil.getLastKnownUsername(getOwnerUUID(accessor.getEntity())); ServerLevel level = accessor.getLevel();
UUID uuid = getOwnerUUID(accessor.getEntity());
Entity entity = level.getEntity(uuid);
if (entity != null) {
return entity.getName();
}
String name = lookupPlayerName(uuid, level.getServer().services());
return name == null ? null : Component.literal(name);
}
@Nullable
public static String lookupPlayerName(@Nullable UUID uuid, Services services) {
if (uuid == null) {
return null;
}
String name = services.nameToIdCache().get(uuid).map(NameAndId::name).orElse(null);
if (name != null) {
return name;
}
GameProfile profile = services.profileResolver().fetchById(uuid).orElse(null);
return profile == null ? null : profile.name();
} }
@Override @Override
public @NotNull StreamCodec<RegistryFriendlyByteBuf, String> streamCodec() { public @NotNull StreamCodec<RegistryFriendlyByteBuf, Component> streamCodec() {
return ByteBufCodecs.STRING_UTF8.cast(); return ComponentSerialization.STREAM_CODEC;
} }
@Override @Override
public ResourceLocation getUid() { public ResourceLocation getUid() {
return MC_ANIMAL_OWNER; return MC_ANIMAL_OWNER;
} }
} }

View File

@@ -1,20 +1,15 @@
package org.leavesmc.leaves.protocol.jade.util; package org.leavesmc.leaves.protocol.jade.util;
import com.mojang.authlib.GameProfile;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.boss.EnderDragonPart; import net.minecraft.world.entity.boss.EnderDragonPart;
import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
import net.minecraft.world.level.block.entity.SkullBlockEntity;
import org.jetbrains.annotations.Nullable;
import org.leavesmc.leaves.LeavesLogger; import org.leavesmc.leaves.LeavesLogger;
import org.leavesmc.leaves.protocol.jade.accessor.Accessor; import org.leavesmc.leaves.protocol.jade.accessor.Accessor;
import org.leavesmc.leaves.protocol.jade.provider.IServerExtensionProvider; import org.leavesmc.leaves.protocol.jade.provider.IServerExtensionProvider;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.UUID;
public class CommonUtil { public class CommonUtil {
@@ -42,16 +37,6 @@ public class CommonUtil {
} }
@Nullable
public static String getLastKnownUsername(@Nullable UUID uuid) {
if (uuid == null) {
return null;
}
Optional<GameProfile> optional = SkullBlockEntity.fetchGameProfile(String.valueOf(uuid)).getNow(Optional.empty());
return optional.map(GameProfile::getName).orElse(null);
}
public static <T> Map.Entry<ResourceLocation, List<ViewGroup<T>>> getServerExtensionData( public static <T> Map.Entry<ResourceLocation, List<ViewGroup<T>>> getServerExtensionData(
Accessor<?> accessor, Accessor<?> accessor,
WrappedHierarchyLookup<IServerExtensionProvider<T>> lookup) { WrappedHierarchyLookup<IServerExtensionProvider<T>> lookup) {

View File

@@ -55,7 +55,7 @@ public class CommunicationManager implements LeavesProtocol {
final VersionHandshakeServer hi = new VersionHandshakeServer(newPlayer); final VersionHandshakeServer hi = new VersionHandshakeServer(newPlayer);
playerMap.put(newPlayer, player); playerMap.put(newPlayer, player);
final GameProfile profile = player.getGameProfile(); final GameProfile profile = player.getGameProfile();
SyncmaticaProtocol.getPlayerIdentifierProvider().updateName(profile.getId(), profile.getName()); SyncmaticaProtocol.getPlayerIdentifierProvider().updateName(profile.id(), profile.name());
startExchangeUnchecked(hi); startExchangeUnchecked(hi);
} }
@@ -149,7 +149,7 @@ public class CommunicationManager implements LeavesProtocol {
final UUID placementId = packetBuf.readUUID(); final UUID placementId = packetBuf.readUUID();
final ServerPlacement placement = SyncmaticaProtocol.getSyncmaticManager().getPlacement(placementId); final ServerPlacement placement = SyncmaticaProtocol.getSyncmaticManager().getPlacement(placementId);
if (placement != null) { if (placement != null) {
if (!getGameProfile(source).getId().equals(placement.getOwner().uuid)) { if (!getGameProfile(source).id().equals(placement.getOwner().uuid)) {
return; return;
} }

View File

@@ -22,7 +22,7 @@ public class PlayerIdentifierProvider {
} }
public PlayerIdentifier createOrGet(final @NotNull GameProfile gameProfile) { public PlayerIdentifier createOrGet(final @NotNull GameProfile gameProfile) {
return createOrGet(gameProfile.getId(), gameProfile.getName()); return createOrGet(gameProfile.id(), gameProfile.name());
} }
public PlayerIdentifier createOrGet(final UUID uuid, final String playerName) { public PlayerIdentifier createOrGet(final UUID uuid, final String playerName) {