geforkt von Mirrors/Paper
fix some startup issues
Dieser Commit ist enthalten in:
Ursprung
04801b7982
Commit
66a288b4f4
@ -934,7 +934,7 @@ index 0000000000000000000000000000000000000000..69add4a7f1147015806bc9b63a8340d1
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..9db94ec0cd508a13e86c56e991b9c853a103520d
|
index 0000000000000000000000000000000000000000..0b6d68350f608bb64a701d0e390283d50f12094e
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||||
@@ -0,0 +1,435 @@
|
@@ -0,0 +1,435 @@
|
||||||
@ -1143,7 +1143,7 @@ index 0000000000000000000000000000000000000000..9db94ec0cd508a13e86c56e991b9c853
|
|||||||
+ .register(new TypeToken<Reference2IntMap<?>>() {}, new FastutilMapSerializer.SomethingToPrimitive<Reference2IntMap<?>>(Reference2IntOpenHashMap::new, Integer.TYPE))
|
+ .register(new TypeToken<Reference2IntMap<?>>() {}, new FastutilMapSerializer.SomethingToPrimitive<Reference2IntMap<?>>(Reference2IntOpenHashMap::new, Integer.TYPE))
|
||||||
+ .register(new TypeToken<Reference2LongMap<?>>() {}, new FastutilMapSerializer.SomethingToPrimitive<Reference2LongMap<?>>(Reference2LongOpenHashMap::new, Long.TYPE))
|
+ .register(new TypeToken<Reference2LongMap<?>>() {}, new FastutilMapSerializer.SomethingToPrimitive<Reference2LongMap<?>>(Reference2LongOpenHashMap::new, Long.TYPE))
|
||||||
+ .register(new TypeToken<Table<?, ?, ?>>() {}, new TableSerializer())
|
+ .register(new TypeToken<Table<?, ?, ?>>() {}, new TableSerializer())
|
||||||
+ .register(new StringRepresentableSerializer())
|
+ .register(StringRepresentableSerializer::isValidFor, new StringRepresentableSerializer())
|
||||||
+ .register(IntOr.Default.SERIALIZER)
|
+ .register(IntOr.Default.SERIALIZER)
|
||||||
+ .register(IntOr.Disabled.SERIALIZER)
|
+ .register(IntOr.Disabled.SERIALIZER)
|
||||||
+ .register(DoubleOrDefault.SERIALIZER)
|
+ .register(DoubleOrDefault.SERIALIZER)
|
||||||
@ -2468,14 +2468,15 @@ index 0000000000000000000000000000000000000000..bc065d5cc8975dd189954272116a6bc5
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/io/papermc/paper/configuration/serializer/StringRepresentableSerializer.java b/src/main/java/io/papermc/paper/configuration/serializer/StringRepresentableSerializer.java
|
diff --git a/src/main/java/io/papermc/paper/configuration/serializer/StringRepresentableSerializer.java b/src/main/java/io/papermc/paper/configuration/serializer/StringRepresentableSerializer.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..add9d16bac9e4570fbdcf8368d7ba03116e97ddf
|
index 0000000000000000000000000000000000000000..7fc0905fc6b8f5df762b4cea573f935dc00b8bc1
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/io/papermc/paper/configuration/serializer/StringRepresentableSerializer.java
|
+++ b/src/main/java/io/papermc/paper/configuration/serializer/StringRepresentableSerializer.java
|
||||||
@@ -0,0 +1,43 @@
|
@@ -0,0 +1,52 @@
|
||||||
+package io.papermc.paper.configuration.serializer;
|
+package io.papermc.paper.configuration.serializer;
|
||||||
+
|
+
|
||||||
+import net.minecraft.util.StringRepresentable;
|
+import net.minecraft.util.StringRepresentable;
|
||||||
+import net.minecraft.world.entity.MobCategory;
|
+import net.minecraft.world.entity.MobCategory;
|
||||||
|
+import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
+import org.spongepowered.configurate.serialize.ScalarSerializer;
|
+import org.spongepowered.configurate.serialize.ScalarSerializer;
|
||||||
+import org.spongepowered.configurate.serialize.SerializationException;
|
+import org.spongepowered.configurate.serialize.SerializationException;
|
||||||
+
|
+
|
||||||
@ -2487,18 +2488,26 @@ index 0000000000000000000000000000000000000000..add9d16bac9e4570fbdcf8368d7ba031
|
|||||||
+
|
+
|
||||||
+public final class StringRepresentableSerializer extends ScalarSerializer<StringRepresentable> {
|
+public final class StringRepresentableSerializer extends ScalarSerializer<StringRepresentable> {
|
||||||
+ private static final Map<Type, Function<String, StringRepresentable>> TYPES = Collections.synchronizedMap(Map.ofEntries(
|
+ private static final Map<Type, Function<String, StringRepresentable>> TYPES = Collections.synchronizedMap(Map.ofEntries(
|
||||||
+ Map.entry(MobCategory.class, s -> {
|
+ createEntry(MobCategory.class)
|
||||||
+ for (MobCategory value : MobCategory.values()) {
|
+ ));
|
||||||
|
+
|
||||||
|
+ public StringRepresentableSerializer() {
|
||||||
|
+ super(StringRepresentable.class);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static boolean isValidFor(final Type type) {
|
||||||
|
+ return TYPES.containsKey(type);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static <E extends Enum<E> & StringRepresentable> Map.Entry<Type, Function<String, @Nullable StringRepresentable>> createEntry(Class<E> type) {
|
||||||
|
+ return Map.entry(type, s -> {
|
||||||
|
+ for (E value : type.getEnumConstants()) {
|
||||||
+ if (value.getSerializedName().equals(s)) {
|
+ if (value.getSerializedName().equals(s)) {
|
||||||
+ return value;
|
+ return value;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ return null;
|
+ return null;
|
||||||
+ })
|
+ });
|
||||||
+ ));
|
|
||||||
+
|
|
||||||
+ public StringRepresentableSerializer() {
|
|
||||||
+ super(StringRepresentable.class);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
|
@ -39,6 +39,19 @@ index d4c46f44f7a998121482c2fc56d7986881d489d8..6801a3aa5f2f1e9a7a72ff81c09b4944
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
diff --git a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
|
||||||
|
index 3233f69345838af653b4259d2142169930533a69..5b8ecf5b0165ed2cd4397cdee958e97c2e8f18d5 100644
|
||||||
|
--- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
|
||||||
|
+++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
|
||||||
|
@@ -305,7 +305,7 @@ public class BuiltInRegistries {
|
||||||
|
LOADERS.put(resourceLocation, () -> {
|
||||||
|
return initializer.run(registry);
|
||||||
|
});
|
||||||
|
- WRITABLE_REGISTRY.register(key, registry, lifecycle);
|
||||||
|
+ WRITABLE_REGISTRY.register((ResourceKey) key, registry, lifecycle); // Paper - decompile fix
|
||||||
|
return registry;
|
||||||
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||||
index 24e864d1cd376e9f94cfa68fd06f96b239eed888..c0fe7c576f2361e599bc23003da7c49bb7cb62b2 100644
|
index 24e864d1cd376e9f94cfa68fd06f96b239eed888..c0fe7c576f2361e599bc23003da7c49bb7cb62b2 100644
|
||||||
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||||
|
@ -19,6 +19,24 @@ public net.minecraft.world.level.levelgen.SurfaceSystem getOrCreateRandomFactory
|
|||||||
|
|
||||||
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
|
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
|
||||||
|
index 5b8ecf5b0165ed2cd4397cdee958e97c2e8f18d5..ad802eb211f05f646159d7fc53f8a9427b46cb89 100644
|
||||||
|
--- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
|
||||||
|
+++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
|
||||||
|
@@ -310,7 +310,13 @@ public class BuiltInRegistries {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void bootStrap() {
|
||||||
|
+ // Paper start
|
||||||
|
+ bootStrap(() -> {});
|
||||||
|
+ }
|
||||||
|
+ public static void bootStrap(Runnable runnable) {
|
||||||
|
+ // Paper end
|
||||||
|
createContents();
|
||||||
|
+ runnable.run(); // Paper
|
||||||
|
freeze();
|
||||||
|
validate(REGISTRY);
|
||||||
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/data/worldgen/SurfaceRuleData.java b/src/main/java/net/minecraft/data/worldgen/SurfaceRuleData.java
|
diff --git a/src/main/java/net/minecraft/data/worldgen/SurfaceRuleData.java b/src/main/java/net/minecraft/data/worldgen/SurfaceRuleData.java
|
||||||
index 06e1774dfbb667aca69bc30c9675ed472cb5728c..1d5bc86516df3781aea894c3afd340421ba51a17 100644
|
index 06e1774dfbb667aca69bc30c9675ed472cb5728c..1d5bc86516df3781aea894c3afd340421ba51a17 100644
|
||||||
--- a/src/main/java/net/minecraft/data/worldgen/SurfaceRuleData.java
|
--- a/src/main/java/net/minecraft/data/worldgen/SurfaceRuleData.java
|
||||||
@ -114,14 +132,19 @@ index 06e1774dfbb667aca69bc30c9675ed472cb5728c..1d5bc86516df3781aea894c3afd34042
|
|||||||
|
|
||||||
public static SurfaceRules.RuleSource end() {
|
public static SurfaceRules.RuleSource end() {
|
||||||
diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java
|
diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java
|
||||||
index 0d3a8f576c037886ccdd6068ce953c4ce010ae2f..bf3fa6454477041898ca00a6341db83a06a52d6f 100644
|
index 0d3a8f576c037886ccdd6068ce953c4ce010ae2f..d0ee6523477309bc984869774533ee1941ed0cb0 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Bootstrap.java
|
--- a/src/main/java/net/minecraft/server/Bootstrap.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Bootstrap.java
|
+++ b/src/main/java/net/minecraft/server/Bootstrap.java
|
||||||
@@ -70,6 +70,7 @@ public class Bootstrap {
|
@@ -69,7 +69,11 @@ public class Bootstrap {
|
||||||
|
EntitySelectorOptions.bootStrap();
|
||||||
DispenseItemBehavior.bootStrap();
|
DispenseItemBehavior.bootStrap();
|
||||||
CauldronInteraction.bootStrap();
|
CauldronInteraction.bootStrap();
|
||||||
BuiltInRegistries.bootStrap();
|
- BuiltInRegistries.bootStrap();
|
||||||
+ net.minecraft.core.Registry.register(net.minecraft.core.registries.BuiltInRegistries.MATERIAL_CONDITION, new net.minecraft.resources.ResourceLocation("paper", "bedrock_condition_source"), net.minecraft.data.worldgen.SurfaceRuleData.PaperBedrockConditionSource.CODEC.codec()); // Paper - register custom flat bedrock thing. TODO is this the best place to do this?
|
+ // Paper start - register custom flat bedrock
|
||||||
|
+ BuiltInRegistries.bootStrap(() -> {
|
||||||
|
+ net.minecraft.core.Registry.register(net.minecraft.core.registries.BuiltInRegistries.MATERIAL_CONDITION, new net.minecraft.resources.ResourceLocation("paper", "bedrock_condition_source"), net.minecraft.data.worldgen.SurfaceRuleData.PaperBedrockConditionSource.CODEC.codec());
|
||||||
|
+ });
|
||||||
|
+ // Paper end
|
||||||
Bootstrap.wrapStreams();
|
Bootstrap.wrapStreams();
|
||||||
}
|
}
|
||||||
// CraftBukkit start - easier than fixing the decompile
|
// CraftBukkit start - easier than fixing the decompile
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren