mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-18 12:48:53 +01:00
Update DataConverter
This commit is contained in:
parent
e2dd1d514c
commit
7045b2ad2d
10 changed files with 237 additions and 64 deletions
|
@ -196,10 +196,10 @@ index 0000000000000000000000000000000000000000..a27d3d41109271834b6c37fa22d4b80d
|
|||
+}
|
||||
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/MCVersionRegistry.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/MCVersionRegistry.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9a5cdd68bf03c3e126601126f576ce57d4d1ac8c
|
||||
index 0000000000000000000000000000000000000000..344c8c4f3207b6c8b565e5ad6db2470a272b77c3
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/MCVersionRegistry.java
|
||||
@@ -0,0 +1,445 @@
|
||||
@@ -0,0 +1,447 @@
|
||||
+package ca.spottedleaf.dataconverter.minecraft;
|
||||
+
|
||||
+import ca.spottedleaf.dataconverter.converters.DataConverter;
|
||||
|
@ -455,8 +455,10 @@ index 0000000000000000000000000000000000000000..9a5cdd68bf03c3e126601126f576ce57
|
|||
+ 4175,
|
||||
+ 4176,
|
||||
+ 4180,
|
||||
+ 4181
|
||||
+ // All up to 1.21.4-pre2
|
||||
+ 4181,
|
||||
+ 4185,
|
||||
+ 4187
|
||||
+ // All up to 1.21.4
|
||||
+ };
|
||||
+ Arrays.sort(converterVersions);
|
||||
+
|
||||
|
@ -647,10 +649,10 @@ index 0000000000000000000000000000000000000000..9a5cdd68bf03c3e126601126f576ce57
|
|||
+}
|
||||
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/MCVersions.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/MCVersions.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5e345b961186325496d63057cbb4c9487f87bdf4
|
||||
index 0000000000000000000000000000000000000000..94da5d6d2f43dae07cfc6750b23689fd4a175d2a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/MCVersions.java
|
||||
@@ -0,0 +1,563 @@
|
||||
@@ -0,0 +1,568 @@
|
||||
+package ca.spottedleaf.dataconverter.minecraft;
|
||||
+
|
||||
+@SuppressWarnings("unused")
|
||||
|
@ -1211,6 +1213,11 @@ index 0000000000000000000000000000000000000000..5e345b961186325496d63057cbb4c948
|
|||
+ public static final int V24W46A = 4178;
|
||||
+ public static final int V1_21_4_PRE1 = 4179;
|
||||
+ public static final int V1_21_4_PRE2 = 4182;
|
||||
+ public static final int V1_21_4_PRE3 = 4183;
|
||||
+ public static final int V1_21_4_RC1 = 4184;
|
||||
+ public static final int V1_21_4_RC2 = 4186;
|
||||
+ public static final int V1_21_4_RC3 = 4188;
|
||||
+ public static final int V1_21_4 = 4189;
|
||||
+
|
||||
+ private MCVersions() {}
|
||||
+}
|
||||
|
@ -1425,6 +1432,57 @@ index 0000000000000000000000000000000000000000..1b871c78e77015d0216a0ecc61aa0568
|
|||
+
|
||||
+ private ConverterAbstractOldAttributesRename() {}
|
||||
+}
|
||||
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/attributes/ConverterEntityAttributesBaseValueUpdater.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/attributes/ConverterEntityAttributesBaseValueUpdater.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f64b7a1999f9f81ed752626f46803174a9889e9d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/attributes/ConverterEntityAttributesBaseValueUpdater.java
|
||||
@@ -0,0 +1,45 @@
|
||||
+package ca.spottedleaf.dataconverter.minecraft.converters.attributes;
|
||||
+
|
||||
+import ca.spottedleaf.dataconverter.converters.DataConverter;
|
||||
+import ca.spottedleaf.dataconverter.types.ListType;
|
||||
+import ca.spottedleaf.dataconverter.types.MapType;
|
||||
+import ca.spottedleaf.dataconverter.types.ObjectType;
|
||||
+import ca.spottedleaf.dataconverter.util.NamespaceUtil;
|
||||
+import java.util.function.DoubleUnaryOperator;
|
||||
+
|
||||
+public final class ConverterEntityAttributesBaseValueUpdater extends DataConverter<MapType<String>, MapType<String>> {
|
||||
+
|
||||
+ private final String targetId;
|
||||
+ private final DoubleUnaryOperator updater;
|
||||
+
|
||||
+ public ConverterEntityAttributesBaseValueUpdater(final int toVersion, final String targetId, final DoubleUnaryOperator updater) {
|
||||
+ this(toVersion, 0, targetId, updater);
|
||||
+ }
|
||||
+
|
||||
+ public ConverterEntityAttributesBaseValueUpdater(final int toVersion, final int versionStep, final String targetId,
|
||||
+ final DoubleUnaryOperator updater) {
|
||||
+ super(toVersion, versionStep);
|
||||
+ this.targetId = targetId;
|
||||
+ this.updater = updater;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public MapType<String> convert(final MapType<String> data, final long sourceVersion, final long toVersion) {
|
||||
+ final ListType modifiers = data.getList("attributes", ObjectType.MAP);
|
||||
+ if (modifiers == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ for (int i = 0, len = modifiers.size(); i < len; ++i) {
|
||||
+ final MapType<String> modifier = modifiers.getMap(i);
|
||||
+
|
||||
+ if (!this.targetId.equals(NamespaceUtil.correctNamespace(modifier.getString("id", "")))) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ modifier.setDouble("base", this.updater.applyAsDouble(modifier.getDouble("base", 0.0)));
|
||||
+ }
|
||||
+
|
||||
+ return null;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/blockname/ConverterAbstractBlockRename.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/converters/blockname/ConverterAbstractBlockRename.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7b47879a7c2e8c21fae43bf5247585c716d75565
|
||||
|
@ -9349,10 +9407,10 @@ index 0000000000000000000000000000000000000000..075574f33476882ddc6787e3b8bac864
|
|||
+}
|
||||
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/datatypes/MCTypeRegistry.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/datatypes/MCTypeRegistry.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ddc19b5f5e469327ed8374fda1ee5a7a91280782
|
||||
index 0000000000000000000000000000000000000000..d42bff4fec99eb0b19d132794f4e3306b6dddb0f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/datatypes/MCTypeRegistry.java
|
||||
@@ -0,0 +1,331 @@
|
||||
@@ -0,0 +1,335 @@
|
||||
+package ca.spottedleaf.dataconverter.minecraft.datatypes;
|
||||
+
|
||||
+import ca.spottedleaf.dataconverter.minecraft.versions.*;
|
||||
|
@ -9424,6 +9482,8 @@ index 0000000000000000000000000000000000000000..ddc19b5f5e469327ed8374fda1ee5a7a
|
|||
+ LOGGER.info("Finished initialising converters for DataConverter in " + oneDecimalFormat.format((double)(end - start) / 1.0E6) + "ms");
|
||||
+ }
|
||||
+
|
||||
+ public static void init() {}
|
||||
+
|
||||
+ private static void registerAll() {
|
||||
+ // General notes:
|
||||
+ // - Structure converters run before everything.
|
||||
|
@ -9680,6 +9740,8 @@ index 0000000000000000000000000000000000000000..ddc19b5f5e469327ed8374fda1ee5a7a
|
|||
+ V4176.register();
|
||||
+ V4180.register();
|
||||
+ V4181.register();
|
||||
+ V4185.register();
|
||||
+ V4187.register();
|
||||
+ }
|
||||
+
|
||||
+ private MCTypeRegistry() {}
|
||||
|
@ -24234,10 +24296,10 @@ index 0000000000000000000000000000000000000000..855c5a99951996ffe4eabb24a6932104
|
|||
+}
|
||||
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V4068.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V4068.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..3de9862f083e6a2a687b42eef36746aa846cc745
|
||||
index 0000000000000000000000000000000000000000..817682bb5830242eca25cc1939ed2bda9f1c460b
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V4068.java
|
||||
@@ -0,0 +1,64 @@
|
||||
@@ -0,0 +1,65 @@
|
||||
+package ca.spottedleaf.dataconverter.minecraft.versions;
|
||||
+
|
||||
+import ca.spottedleaf.dataconverter.converters.DataConverter;
|
||||
|
@ -24265,11 +24327,12 @@ index 0000000000000000000000000000000000000000..3de9862f083e6a2a687b42eef36746aa
|
|||
+
|
||||
+ final TypeUtil typeUtil = root.getTypeUtil();
|
||||
+
|
||||
+ final MapType<String> newLock = typeUtil.createEmptyMap();
|
||||
+ root.remove(srcPath);
|
||||
+ root.setMap(dstPath, newLock);
|
||||
+
|
||||
+ if (lockGeneric instanceof String lock) {
|
||||
+ if (lockGeneric instanceof String lock && !lock.isEmpty()) {
|
||||
+ final MapType<String> newLock = typeUtil.createEmptyMap();
|
||||
+ root.setMap(dstPath, newLock);
|
||||
+
|
||||
+ final MapType<String> lockComponents = typeUtil.createEmptyMap();
|
||||
+ newLock.setMap("components", lockComponents);
|
||||
+
|
||||
|
@ -24546,7 +24609,7 @@ index 0000000000000000000000000000000000000000..c8eb7ba000310d1165c63fb9eef37878
|
|||
+}
|
||||
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V4181.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V4181.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f31c79adeddc4c1b8a82d1b0f122cc1d64c24440
|
||||
index 0000000000000000000000000000000000000000..9119204ef25d78b04c5afc58965df56725ac7079
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V4181.java
|
||||
@@ -0,0 +1,36 @@
|
||||
|
@ -24570,9 +24633,9 @@ index 0000000000000000000000000000000000000000..f31c79adeddc4c1b8a82d1b0f122cc1d
|
|||
+ RenameHelper.renameSingle(data, "CookTimeTotal", "cooking_total_time");
|
||||
+ RenameHelper.renameSingle(data, "BurnTime", "lit_time_remaining");
|
||||
+
|
||||
+ final Object litTotalTime = data.getGeneric("lit_total_time");
|
||||
+ final Object litTotalTime = data.getGeneric("lit_time_remaining");
|
||||
+ if (litTotalTime != null) {
|
||||
+ data.setGeneric("lit_time_remaining", litTotalTime);
|
||||
+ data.setGeneric("lit_total_time", litTotalTime);
|
||||
+ }
|
||||
+
|
||||
+ return null;
|
||||
|
@ -24586,6 +24649,104 @@ index 0000000000000000000000000000000000000000..f31c79adeddc4c1b8a82d1b0f122cc1d
|
|||
+
|
||||
+ private V4181() {}
|
||||
+}
|
||||
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V4185.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V4185.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8b4041d3d3a4a001bf06eaedbddad1b297122b12
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V4185.java
|
||||
@@ -0,0 +1,17 @@
|
||||
+package ca.spottedleaf.dataconverter.minecraft.versions;
|
||||
+
|
||||
+import ca.spottedleaf.dataconverter.minecraft.MCVersions;
|
||||
+import ca.spottedleaf.dataconverter.minecraft.converters.chunk.ConverterAddBlendingData;
|
||||
+import ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry;
|
||||
+
|
||||
+public final class V4185 {
|
||||
+
|
||||
+ private static final int VERSION = MCVersions.V1_21_4_RC1 + 1;
|
||||
+
|
||||
+ public static void register() {
|
||||
+ // See V3088 for why this converter is duplicated in here, V3441, and V3088
|
||||
+ MCTypeRegistry.CHUNK.addStructureConverter(new ConverterAddBlendingData(VERSION));
|
||||
+ }
|
||||
+
|
||||
+ private V4185() {}
|
||||
+}
|
||||
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V4187.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V4187.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7d09c4218d0db8119d1681bf95900be830557fa3
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V4187.java
|
||||
@@ -0,0 +1,69 @@
|
||||
+package ca.spottedleaf.dataconverter.minecraft.versions;
|
||||
+
|
||||
+import ca.spottedleaf.dataconverter.minecraft.MCVersions;
|
||||
+import ca.spottedleaf.dataconverter.minecraft.converters.attributes.ConverterEntityAttributesBaseValueUpdater;
|
||||
+import ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry;
|
||||
+
|
||||
+public final class V4187 {
|
||||
+
|
||||
+ private static final int VERSION = MCVersions.V1_21_4_RC2 + 1;
|
||||
+
|
||||
+ public static void register() {
|
||||
+ MCTypeRegistry.ENTITY.addConverterForId(
|
||||
+ "minecraft:villager",
|
||||
+ new ConverterEntityAttributesBaseValueUpdater(
|
||||
+ VERSION, "minecraft:follow_range",
|
||||
+ (final double curr) -> {
|
||||
+ return curr == 48.0 ? 16.0 : curr;
|
||||
+ }
|
||||
+ )
|
||||
+ );
|
||||
+ MCTypeRegistry.ENTITY.addConverterForId(
|
||||
+ "minecraft:bee",
|
||||
+ new ConverterEntityAttributesBaseValueUpdater(
|
||||
+ VERSION, "minecraft:follow_range",
|
||||
+ (final double curr) -> {
|
||||
+ return curr == 48.0 ? 16.0 : curr;
|
||||
+ }
|
||||
+ )
|
||||
+ );
|
||||
+ MCTypeRegistry.ENTITY.addConverterForId(
|
||||
+ "minecraft:allay",
|
||||
+ new ConverterEntityAttributesBaseValueUpdater(
|
||||
+ VERSION, "minecraft:follow_range",
|
||||
+ (final double curr) -> {
|
||||
+ return curr == 48.0 ? 16.0 : curr;
|
||||
+ }
|
||||
+ )
|
||||
+ );
|
||||
+ MCTypeRegistry.ENTITY.addConverterForId(
|
||||
+ "minecraft:llama",
|
||||
+ new ConverterEntityAttributesBaseValueUpdater(
|
||||
+ VERSION, "minecraft:follow_range",
|
||||
+ (final double curr) -> {
|
||||
+ return curr == 48.0 ? 16.0 : curr;
|
||||
+ }
|
||||
+ )
|
||||
+ );
|
||||
+ MCTypeRegistry.ENTITY.addConverterForId(
|
||||
+ "minecraft:piglin_brute",
|
||||
+ new ConverterEntityAttributesBaseValueUpdater(
|
||||
+ VERSION, "minecraft:follow_range",
|
||||
+ (final double curr) -> {
|
||||
+ return curr == 16.0 ? 12.0 : curr;
|
||||
+ }
|
||||
+ )
|
||||
+ );
|
||||
+ MCTypeRegistry.ENTITY.addConverterForId(
|
||||
+ "minecraft:warden",
|
||||
+ new ConverterEntityAttributesBaseValueUpdater(
|
||||
+ VERSION, "minecraft:follow_range",
|
||||
+ (final double curr) -> {
|
||||
+ return curr == 16.0 ? 24.0 : curr;
|
||||
+ }
|
||||
+ )
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ private V4187() {}
|
||||
+}
|
||||
diff --git a/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V501.java b/src/main/java/ca/spottedleaf/dataconverter/minecraft/versions/V501.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a7a4d6446b7765ac485af82df660aafab05955bf
|
||||
|
@ -30459,6 +30620,18 @@ index 96aea6d8cb68dd033c31cbde9d73ee490f320501..c51d71dd24cd28c22cda83cc3128c414
|
|||
structureTemplate.load(BuiltInRegistries.BLOCK, compoundTag);
|
||||
return structureTemplate.save(new CompoundTag());
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 8d9ddcb1652526c21c4004c6b0e1c83bc33d3934..e6f9fab80b1c3402c96e7c118d0fde5957ee9845 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -330,6 +330,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
|
||||
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
|
||||
+ ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
Thread thread = new Thread(() -> {
|
||||
((MinecraftServer) atomicreference.get()).runServer();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
||||
index 7d5e2e6e96ea9017334dddade54a9dcb37518642..092f7b6bba4e1291f76c2c09155f33803e93eb04 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
||||
|
|
|
@ -23108,7 +23108,7 @@ index 731bdabd53fd4a3d17494f26781223097a5d6e16..42d46c7a7437bea5335a23cbee5708ac
|
|||
DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, worldLoader.get(), thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataFixers.getDataFixer(), services, LoggerChunkProgressListener::createFromGameruleRadius);
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 8d9ddcb1652526c21c4004c6b0e1c83bc33d3934..6de6f76e8385c50bd18ef9caaca68a79e1e797ca 100644
|
||||
index e6f9fab80b1c3402c96e7c118d0fde5957ee9845..98a7bcb7bf356c4a0894b7e12ccd676f5e4d2f5e 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -204,7 +204,7 @@ import org.bukkit.event.server.ServerLoadEvent;
|
||||
|
@ -23120,16 +23120,16 @@ index 8d9ddcb1652526c21c4004c6b0e1c83bc33d3934..6de6f76e8385c50bd18ef9caaca68a79
|
|||
|
||||
private static MinecraftServer SERVER; // Paper
|
||||
public static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -331,7 +331,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@@ -332,7 +332,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
|
||||
ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
- Thread thread = new Thread(() -> {
|
||||
+ Thread thread = new ca.spottedleaf.moonrise.common.util.TickThread(() -> { // Paper - rewrite chunk system
|
||||
((MinecraftServer) atomicreference.get()).runServer();
|
||||
}, "Server thread");
|
||||
|
||||
@@ -350,6 +350,77 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -351,6 +351,77 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
return s0;
|
||||
}
|
||||
|
||||
|
@ -23207,7 +23207,7 @@ index 8d9ddcb1652526c21c4004c6b0e1c83bc33d3934..6de6f76e8385c50bd18ef9caaca68a79
|
|||
public MinecraftServer(OptionSet options, WorldLoader.DataLoadContext worldLoader, Thread thread, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PackRepository resourcepackrepository, WorldStem worldstem, Proxy proxy, DataFixer datafixer, Services services, ChunkProgressListenerFactory worldloadlistenerfactory) {
|
||||
super("Server");
|
||||
SERVER = this; // Paper - better singleton
|
||||
@@ -670,7 +741,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -671,7 +742,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.forceDifficulty();
|
||||
for (ServerLevel worldserver : this.getAllLevels()) {
|
||||
this.prepareLevels(worldserver.getChunkSource().chunkMap.progressListener, worldserver);
|
||||
|
@ -23216,7 +23216,7 @@ index 8d9ddcb1652526c21c4004c6b0e1c83bc33d3934..6de6f76e8385c50bd18ef9caaca68a79
|
|||
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
|
||||
}
|
||||
|
||||
@@ -883,6 +954,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -884,6 +955,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public abstract boolean shouldRconBroadcast();
|
||||
|
||||
public boolean saveAllChunks(boolean suppressLogs, boolean flush, boolean force) {
|
||||
|
@ -23228,7 +23228,7 @@ index 8d9ddcb1652526c21c4004c6b0e1c83bc33d3934..6de6f76e8385c50bd18ef9caaca68a79
|
|||
boolean flag3 = false;
|
||||
|
||||
for (Iterator iterator = this.getAllLevels().iterator(); iterator.hasNext(); flag3 = true) {
|
||||
@@ -892,7 +968,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -893,7 +969,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
MinecraftServer.LOGGER.info("Saving chunks for level '{}'/{}", worldserver, worldserver.dimension().location());
|
||||
}
|
||||
|
||||
|
@ -23237,7 +23237,7 @@ index 8d9ddcb1652526c21c4004c6b0e1c83bc33d3934..6de6f76e8385c50bd18ef9caaca68a79
|
|||
}
|
||||
|
||||
// CraftBukkit start - moved to WorldServer.save
|
||||
@@ -992,7 +1068,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -993,7 +1069,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23246,7 +23246,7 @@ index 8d9ddcb1652526c21c4004c6b0e1c83bc33d3934..6de6f76e8385c50bd18ef9caaca68a79
|
|||
return worldserver1.getChunkSource().chunkMap.hasWork();
|
||||
})) {
|
||||
this.nextTickTimeNanos = Util.getNanos() + TimeUtil.NANOSECONDS_PER_MILLISECOND;
|
||||
@@ -1009,19 +1085,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1010,19 +1086,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.waitUntilNextTick();
|
||||
}
|
||||
|
||||
|
@ -23267,7 +23267,7 @@ index 8d9ddcb1652526c21c4004c6b0e1c83bc33d3934..6de6f76e8385c50bd18ef9caaca68a79
|
|||
|
||||
this.isSaving = false;
|
||||
this.resources.close();
|
||||
@@ -1041,6 +1105,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1042,6 +1106,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
// Spigot end
|
||||
|
||||
|
@ -23282,7 +23282,7 @@ index 8d9ddcb1652526c21c4004c6b0e1c83bc33d3934..6de6f76e8385c50bd18ef9caaca68a79
|
|||
}
|
||||
|
||||
public String getLocalIp() {
|
||||
@@ -1221,6 +1293,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1222,6 +1294,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.tickServer(flag ? () -> {
|
||||
return false;
|
||||
} : this::haveTime);
|
||||
|
@ -23296,7 +23296,7 @@ index 8d9ddcb1652526c21c4004c6b0e1c83bc33d3934..6de6f76e8385c50bd18ef9caaca68a79
|
|||
this.tickFrame.end();
|
||||
gameprofilerfiller.popPush("nextTickWait");
|
||||
this.mayHaveDelayedTasks = true;
|
||||
@@ -1425,6 +1504,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1426,6 +1505,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
private boolean pollTaskInternal() {
|
||||
if (super.pollTask()) {
|
||||
|
@ -23304,7 +23304,7 @@ index 8d9ddcb1652526c21c4004c6b0e1c83bc33d3934..6de6f76e8385c50bd18ef9caaca68a79
|
|||
return true;
|
||||
} else {
|
||||
boolean ret = false; // Paper - force execution of all worlds, do not just bias the first
|
||||
@@ -2689,6 +2769,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -2690,6 +2770,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ index 42d46c7a7437bea5335a23cbee5708ac57131474..300a044bb0f0e377133f24469cea1a96
|
|||
/* CraftBukkit start - Replace everything
|
||||
OptionParser optionparser = new OptionParser();
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 6de6f76e8385c50bd18ef9caaca68a79e1e797ca..8549292b4e96c7b09e2a9707f2d8a75b870ee35b 100644
|
||||
index 98a7bcb7bf356c4a0894b7e12ccd676f5e4d2f5e..ce764af55f82612d2a02e5f6b5d756f2c5f9ac9a 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -317,7 +317,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
@ -137,9 +137,9 @@ index 6de6f76e8385c50bd18ef9caaca68a79e1e797ca..8549292b4e96c7b09e2a9707f2d8a75b
|
|||
+ public volatile boolean abnormalExit = false; // Paper
|
||||
+
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
|
||||
ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
Thread thread = new ca.spottedleaf.moonrise.common.util.TickThread(() -> { // Paper - rewrite chunk system
|
||||
@@ -502,6 +505,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -503,6 +506,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
*/
|
||||
// Paper end
|
||||
|
@ -147,7 +147,7 @@ index 6de6f76e8385c50bd18ef9caaca68a79e1e797ca..8549292b4e96c7b09e2a9707f2d8a75b
|
|||
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
|
||||
// CraftBukkit end
|
||||
this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files
|
||||
@@ -1018,6 +1022,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1019,6 +1023,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
// CraftBukkit start
|
||||
private boolean hasStopped = false;
|
||||
private boolean hasLoggedStop = false; // Paper - Debugging
|
||||
|
@ -155,7 +155,7 @@ index 6de6f76e8385c50bd18ef9caaca68a79e1e797ca..8549292b4e96c7b09e2a9707f2d8a75b
|
|||
private final Object stopLock = new Object();
|
||||
public final boolean hasStopped() {
|
||||
synchronized (this.stopLock) {
|
||||
@@ -1033,6 +1038,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1034,6 +1039,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.hasStopped = true;
|
||||
}
|
||||
if (!hasLoggedStop && isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper - Debugging
|
||||
|
@ -166,7 +166,7 @@ index 6de6f76e8385c50bd18ef9caaca68a79e1e797ca..8549292b4e96c7b09e2a9707f2d8a75b
|
|||
// CraftBukkit end
|
||||
if (this.metricsRecorder.isRecording()) {
|
||||
this.cancelRecordingMetrics();
|
||||
@@ -1113,6 +1122,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1114,6 +1123,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
ca.spottedleaf.moonrise.common.util.MoonriseCommon.haltExecutors();
|
||||
}
|
||||
// Paper end - rewrite chunk system
|
||||
|
@ -182,7 +182,7 @@ index 6de6f76e8385c50bd18ef9caaca68a79e1e797ca..8549292b4e96c7b09e2a9707f2d8a75b
|
|||
}
|
||||
|
||||
public String getLocalIp() {
|
||||
@@ -1207,6 +1225,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1208,6 +1226,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
protected void runServer() {
|
||||
try {
|
||||
|
@ -190,7 +190,7 @@ index 6de6f76e8385c50bd18ef9caaca68a79e1e797ca..8549292b4e96c7b09e2a9707f2d8a75b
|
|||
if (!this.initServer()) {
|
||||
throw new IllegalStateException("Failed to initialize server");
|
||||
}
|
||||
@@ -1216,6 +1235,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1217,6 +1236,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.status = this.buildServerStatus();
|
||||
|
||||
// Spigot start
|
||||
|
@ -208,7 +208,7 @@ index 6de6f76e8385c50bd18ef9caaca68a79e1e797ca..8549292b4e96c7b09e2a9707f2d8a75b
|
|||
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
|
||||
Arrays.fill( this.recentTps, 20 );
|
||||
// Paper start - further improve server tick loop
|
||||
@@ -1336,6 +1366,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1337,6 +1367,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis);
|
||||
}
|
||||
} catch (Throwable throwable2) {
|
||||
|
@ -221,7 +221,7 @@ index 6de6f76e8385c50bd18ef9caaca68a79e1e797ca..8549292b4e96c7b09e2a9707f2d8a75b
|
|||
MinecraftServer.LOGGER.error("Encountered an unexpected exception", throwable2);
|
||||
CrashReport crashreport = MinecraftServer.constructOrExtractCrashReport(throwable2);
|
||||
|
||||
@@ -1360,15 +1396,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1361,15 +1397,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.services.profileCache().clearExecutor();
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@ index 6de6f76e8385c50bd18ef9caaca68a79e1e797ca..8549292b4e96c7b09e2a9707f2d8a75b
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1487,6 +1523,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1488,6 +1524,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@Override
|
||||
public TickTask wrapRunnable(Runnable runnable) {
|
||||
|
@ -254,7 +254,7 @@ index 6de6f76e8385c50bd18ef9caaca68a79e1e797ca..8549292b4e96c7b09e2a9707f2d8a75b
|
|||
return new TickTask(this.tickCount, runnable);
|
||||
}
|
||||
|
||||
@@ -2309,7 +2351,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -2310,7 +2352,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.resources.managers.updateStaticRegistryTags();
|
||||
this.resources.managers.getRecipeManager().finalizeRecipeLoading(this.worldData.enabledFeatures());
|
||||
this.potionBrewing = this.potionBrewing.reload(this.worldData.enabledFeatures()); // Paper - Custom Potion Mixes
|
||||
|
|
|
@ -279,10 +279,10 @@ index 6b8ed8a0baaf4a57d20e57cec3400af5561ddd79..48604e7f96adc9e226e034054c5e2bad
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 8549292b4e96c7b09e2a9707f2d8a75b870ee35b..aa0a693af442a791ad8e5ec5a9e11594e6b42419 100644
|
||||
index ce764af55f82612d2a02e5f6b5d756f2c5f9ac9a..c9548714429901d306f77e6dde888f57198f93b4 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -764,6 +764,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -765,6 +765,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
// Paper end - Configurable player collision
|
||||
|
||||
this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
|
||||
|
@ -291,7 +291,7 @@ index 8549292b4e96c7b09e2a9707f2d8a75b870ee35b..aa0a693af442a791ad8e5ec5a9e11594
|
|||
if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.pluginsEnabled(); // Paper - Remap plugins
|
||||
io.papermc.paper.command.brigadier.PaperCommands.INSTANCE.setValid(); // Paper - reset invalid state for event fire below
|
||||
io.papermc.paper.plugin.lifecycle.event.LifecycleEventRunner.INSTANCE.callReloadableRegistrarEvent(io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents.COMMANDS, io.papermc.paper.command.brigadier.PaperCommands.INSTANCE, org.bukkit.plugin.Plugin.class, io.papermc.paper.plugin.lifecycle.event.registrar.ReloadableRegistrarEvent.Cause.INITIAL); // Paper - call commands event for regular plugins
|
||||
@@ -1051,6 +1053,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1052,6 +1054,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
|
||||
// CraftBukkit start
|
||||
if (this.server != null) {
|
||||
|
@ -299,7 +299,7 @@ index 8549292b4e96c7b09e2a9707f2d8a75b870ee35b..aa0a693af442a791ad8e5ec5a9e11594
|
|||
this.server.disablePlugins();
|
||||
this.server.waitForAsyncTasksShutdown(); // Paper - Wait for Async Tasks during shutdown
|
||||
}
|
||||
@@ -1244,6 +1247,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1245,6 +1248,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
// tasks are default scheduled at -1 + delay, and first tick will tick at 1
|
||||
final long actualDoneTimeMs = System.currentTimeMillis() - org.bukkit.craftbukkit.Main.BOOT_TIME.toEpochMilli(); // Paper - Add total time
|
||||
LOGGER.info("Done ({})! For help, type \"help\"", String.format(java.util.Locale.ROOT, "%.3fs", actualDoneTimeMs / 1000.00D)); // Paper - Add total time
|
||||
|
@ -307,7 +307,7 @@ index 8549292b4e96c7b09e2a9707f2d8a75b870ee35b..aa0a693af442a791ad8e5ec5a9e11594
|
|||
org.spigotmc.WatchdogThread.tick();
|
||||
// Paper end - Improved Watchdog Support
|
||||
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
|
||||
@@ -1626,17 +1630,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1627,17 +1631,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
|
||||
if (this.emptyTicks >= j) {
|
||||
|
@ -329,7 +329,7 @@ index 8549292b4e96c7b09e2a9707f2d8a75b870ee35b..aa0a693af442a791ad8e5ec5a9e11594
|
|||
new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper - Server Tick Events
|
||||
++this.tickCount;
|
||||
this.tickRateManager.tick();
|
||||
@@ -1654,11 +1662,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1655,11 +1663,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||
|
||||
this.runAllTasks(); // Paper - move runAllTasks() into full server tick (previously for timings)
|
||||
|
|
|
@ -6,10 +6,10 @@ Subject: [PATCH] Incremental chunk and player saving
|
|||
Feature patch
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index aa0a693af442a791ad8e5ec5a9e11594e6b42419..0af2e1f951683023124f1733a6079e4eaa5deb48 100644
|
||||
index c9548714429901d306f77e6dde888f57198f93b4..798ae2cddef7e4bb50bb6f05c85073076dd070f8 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1007,7 +1007,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1008,7 +1008,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
try {
|
||||
this.isSaving = true;
|
||||
|
@ -18,7 +18,7 @@ index aa0a693af442a791ad8e5ec5a9e11594e6b42419..0af2e1f951683023124f1733a6079e4e
|
|||
flag3 = this.saveAllChunks(suppressLogs, flush, force);
|
||||
} finally {
|
||||
this.isSaving = false;
|
||||
@@ -1655,9 +1655,29 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1656,9 +1656,29 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
|
||||
--this.ticksUntilAutosave;
|
||||
|
|
|
@ -10,7 +10,7 @@ Areas affected by lag comepnsation:
|
|||
Feature patch
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 0af2e1f951683023124f1733a6079e4eaa5deb48..b5c5e9d9279e61e2476319e9ce8a829743d56267 100644
|
||||
index 798ae2cddef7e4bb50bb6f05c85073076dd070f8..c851133115328f0508f65a7b7d79326ff2106b1c 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -331,6 +331,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
@ -20,8 +20,8 @@ index 0af2e1f951683023124f1733a6079e4eaa5deb48..b5c5e9d9279e61e2476319e9ce8a8297
|
|||
+ public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation
|
||||
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
@@ -1841,6 +1842,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system
|
||||
@@ -1842,6 +1843,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent
|
||||
worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
|
||||
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers
|
||||
|
|
|
@ -11,10 +11,10 @@ sleep by default, which avoids the problem and makes it more obvious to check if
|
|||
enabled. We also unload chunks during sleep to prevent memory leaks caused by plugin chunk loads.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index b5c5e9d9279e61e2476319e9ce8a829743d56267..6a4f99c56f8f49f5087a582a8c77be2c261537bb 100644
|
||||
index c851133115328f0508f65a7b7d79326ff2106b1c..a2f274504a5ce13b491d4a5d77b3e26fcf7a85a6 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1638,6 +1638,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1639,6 +1639,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
|
||||
this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] API to check if the server is sleeping
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 6a4f99c56f8f49f5087a582a8c77be2c261537bb..78ec2c6d4546bc4eaedd64fa8340f5654876f65c 100644
|
||||
index a2f274504a5ce13b491d4a5d77b3e26fcf7a85a6..f07661d09f21b8691ef2e09a1e8ddce6ad53b473 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -3186,4 +3186,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -3187,4 +3187,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
}
|
||||
// Paper end - Add tick times API and /mspt command
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] API to allow/disallow tick sleeping
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 78ec2c6d4546bc4eaedd64fa8340f5654876f65c..c352c6717835d92cadc2bd131fba432714fe56e5 100644
|
||||
index f07661d09f21b8691ef2e09a1e8ddce6ad53b473..3ea668e3b33353d8a6353ebc4f18e7103b573353 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -332,6 +332,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
@ -15,8 +15,8 @@ index 78ec2c6d4546bc4eaedd64fa8340f5654876f65c..c352c6717835d92cadc2bd131fba4327
|
|||
+ private final Set<String> pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping
|
||||
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
@@ -1623,8 +1624,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system
|
||||
@@ -1624,8 +1625,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
long i = Util.getNanos();
|
||||
int j = this.pauseWhileEmptySeconds() * 20;
|
||||
|
||||
|
@ -27,7 +27,7 @@ index 78ec2c6d4546bc4eaedd64fa8340f5654876f65c..c352c6717835d92cadc2bd131fba4327
|
|||
++this.emptyTicks;
|
||||
} else {
|
||||
this.emptyTicks = 0;
|
||||
@@ -3191,5 +3193,22 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -3192,5 +3194,22 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public boolean isTickPaused() {
|
||||
return this.emptyTicks > 0 && this.emptyTicks >= this.pauseWhileEmptySeconds() * 20;
|
||||
}
|
||||
|
|
|
@ -6,10 +6,10 @@ Subject: [PATCH] Only attempt to find spawn position if there isn't a fixed
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index c352c6717835d92cadc2bd131fba432714fe56e5..40eddfb94d85834b384ae34445c6159f904ae577 100644
|
||||
index 3ea668e3b33353d8a6353ebc4f18e7103b573353..ab4f1bd1ebf0af54f3fa88ee9e2007d20445e7e9 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -816,7 +816,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -817,7 +817,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
worldProperties.setSpawn(BlockPos.ZERO.above(80), 0.0F);
|
||||
} else {
|
||||
ServerChunkCache chunkproviderserver = world.getChunkSource();
|
||||
|
@ -18,7 +18,7 @@ index c352c6717835d92cadc2bd131fba432714fe56e5..40eddfb94d85834b384ae34445c6159f
|
|||
// CraftBukkit start
|
||||
if (world.generator != null) {
|
||||
Random rand = new Random(world.getSeed());
|
||||
@@ -832,6 +832,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -833,6 +833,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
|
Loading…
Reference in a new issue