mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-03 13:42:25 -07:00
fix some startup issues
This commit is contained in:
@@ -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
|
||||||
|
+++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
|
||||||
|
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/data/worldgen/SurfaceRuleData.java
|
--- a/src/main/java/net/minecraft/data/worldgen/SurfaceRuleData.java
|
||||||
@@ -118,10 +136,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- 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
|
||||||
@@ -0,0 +0,0 @@ public class Bootstrap {
|
@@ -0,0 +0,0 @@ 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
|
||||||
|
@@ -39,6 +39,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
diff --git a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
|
||||||
|
+++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
|
||||||
|
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||||
|
@@ -1143,7 +1143,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ .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)
|
||||||
@@ -2476,6 +2476,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
+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..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
+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
|
||||||
|
Reference in New Issue
Block a user