From f829dcd46a061b976d7422dffec46675a7de9f7b Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 30 Mar 2016 19:36:20 -0400 Subject: [PATCH] MC Dev fixes --- .../sources/net/minecraft/Util.java.patch | 11 +++++++++++ .../arguments/item/ItemInput.java.patch | 10 ++++++++++ .../net/minecraft/core/BlockPos.java.patch | 18 ++++++++++++++++++ .../registries/BuiltInRegistries.java.patch | 11 +++++++++++ .../net/minecraft/nbt/TagParser.java.patch | 17 +++++++++++++++++ .../resources/RegistryDataLoader.java.patch | 11 +++++++++++ .../server/MinecraftServer.java.patch | 2 +- .../minecraft/util/SortedArraySet.java.patch | 11 +++++++++++ .../world/entity/animal/Dolphin.java.patch | 9 +++++++++ .../chunk/status/ChunkStatusTasks.java.patch | 9 +++++++++ 10 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 paper-server/patches/sources/net/minecraft/Util.java.patch create mode 100644 paper-server/patches/sources/net/minecraft/commands/arguments/item/ItemInput.java.patch create mode 100644 paper-server/patches/sources/net/minecraft/core/registries/BuiltInRegistries.java.patch create mode 100644 paper-server/patches/sources/net/minecraft/nbt/TagParser.java.patch create mode 100644 paper-server/patches/sources/net/minecraft/resources/RegistryDataLoader.java.patch create mode 100644 paper-server/patches/sources/net/minecraft/util/SortedArraySet.java.patch diff --git a/paper-server/patches/sources/net/minecraft/Util.java.patch b/paper-server/patches/sources/net/minecraft/Util.java.patch new file mode 100644 index 0000000000..9866198c82 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/Util.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/Util.java ++++ b/net/minecraft/Util.java +@@ -537,7 +537,7 @@ + public static , V> EnumMap makeEnumMap(Class enumClass, Function mapper) { + EnumMap enumMap = new EnumMap<>(enumClass); + +- for (K enum_ : (Enum[])enumClass.getEnumConstants()) { ++ for (K enum_ : enumClass.getEnumConstants()) { // Paper - decompile error + enumMap.put(enum_, mapper.apply(enum_)); + } + diff --git a/paper-server/patches/sources/net/minecraft/commands/arguments/item/ItemInput.java.patch b/paper-server/patches/sources/net/minecraft/commands/arguments/item/ItemInput.java.patch new file mode 100644 index 0000000000..a20c412208 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/commands/arguments/item/ItemInput.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/commands/arguments/item/ItemInput.java ++++ b/net/minecraft/commands/arguments/item/ItemInput.java +@@ -78,6 +78,6 @@ + } + + private String getItemName() { +- return this.item.unwrapKey().map(ResourceKey::location).orElseGet(() -> "unknown[" + this.item + "]").toString(); ++ return this.item.unwrapKey().map(ResourceKey::location).orElseGet(() -> "unknown[" + this.item + "]").toString(); // Paper - decompile fix + } + } diff --git a/paper-server/patches/sources/net/minecraft/core/BlockPos.java.patch b/paper-server/patches/sources/net/minecraft/core/BlockPos.java.patch index aa1ba9962d..10461b13b8 100644 --- a/paper-server/patches/sources/net/minecraft/core/BlockPos.java.patch +++ b/paper-server/patches/sources/net/minecraft/core/BlockPos.java.patch @@ -33,3 +33,21 @@ } } +@@ -444,12 +446,12 @@ + if (this.index == l) { + return this.endOfData(); + } else { +- int i = this.index % i; +- int j = this.index / i; +- int k = j % j; +- int l = j / j; ++ int offsetX = this.index % i; // Paper - decomp fix ++ int u = this.index / i; // Paper - decomp fix ++ int offsetY = u % j; // Paper - decomp fix ++ int offsetZ = u / j; // Paper - decomp fix + this.index++; +- return this.cursor.set(startX + i, startY + k, startZ + l); ++ return this.cursor.set(startX + offsetX, startY + offsetY, startZ + offsetZ); // Paper - decomp fix + } + } + }; diff --git a/paper-server/patches/sources/net/minecraft/core/registries/BuiltInRegistries.java.patch b/paper-server/patches/sources/net/minecraft/core/registries/BuiltInRegistries.java.patch new file mode 100644 index 0000000000..fcc7ffd22e --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/core/registries/BuiltInRegistries.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/core/registries/BuiltInRegistries.java ++++ b/net/minecraft/core/registries/BuiltInRegistries.java +@@ -325,7 +325,7 @@ + Bootstrap.checkBootstrapCalled(() -> "registry " + key.location()); + ResourceLocation resourceLocation = key.location(); + LOADERS.put(resourceLocation, () -> initializer.run(registry)); +- WRITABLE_REGISTRY.register((ResourceKey>)key, registry, RegistrationInfo.BUILT_IN); ++ WRITABLE_REGISTRY.register((ResourceKey)key, registry, RegistrationInfo.BUILT_IN); // Paper - decompile fix + return registry; + } + diff --git a/paper-server/patches/sources/net/minecraft/nbt/TagParser.java.patch b/paper-server/patches/sources/net/minecraft/nbt/TagParser.java.patch new file mode 100644 index 0000000000..b661474d3c --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/nbt/TagParser.java.patch @@ -0,0 +1,17 @@ +--- a/net/minecraft/nbt/TagParser.java ++++ b/net/minecraft/nbt/TagParser.java +@@ -253,11 +253,11 @@ + } + + if (typeReader == ByteTag.TYPE) { +- list.add((T)((NumericTag)tag).getAsByte()); ++ list.add((T)(Byte)((NumericTag)tag).getAsByte()); // Paper - decompile fix + } else if (typeReader == LongTag.TYPE) { +- list.add((T)((NumericTag)tag).getAsLong()); ++ list.add((T)(Long)((NumericTag)tag).getAsLong()); // Paper - decompile fix + } else { +- list.add((T)((NumericTag)tag).getAsInt()); ++ list.add((T)(Integer)((NumericTag)tag).getAsInt()); // Paper - decompile fix + } + + if (!this.hasElementSeparator()) { diff --git a/paper-server/patches/sources/net/minecraft/resources/RegistryDataLoader.java.patch b/paper-server/patches/sources/net/minecraft/resources/RegistryDataLoader.java.patch new file mode 100644 index 0000000000..b87b265ef6 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/resources/RegistryDataLoader.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/resources/RegistryDataLoader.java ++++ b/net/minecraft/resources/RegistryDataLoader.java +@@ -74,7 +74,7 @@ + + public class RegistryDataLoader { + private static final Logger LOGGER = LogUtils.getLogger(); +- private static final Comparator> ERROR_KEY_COMPARATOR = Comparator.comparing(ResourceKey::registry).thenComparing(ResourceKey::location); ++ private static final Comparator> ERROR_KEY_COMPARATOR = Comparator., ResourceLocation>comparing(ResourceKey::registry).thenComparing(ResourceKey::location); // Paper - decompile fix + private static final RegistrationInfo NETWORK_REGISTRATION_INFO = new RegistrationInfo(Optional.empty(), Lifecycle.experimental()); + private static final Function, RegistrationInfo> REGISTRATION_INFO_CACHE = Util.memoize(knownPacks -> { + Lifecycle lifecycle = knownPacks.map(KnownPack::isVanilla).map(vanilla -> Lifecycle.stable()).orElse(Lifecycle.experimental()); diff --git a/paper-server/patches/sources/net/minecraft/server/MinecraftServer.java.patch b/paper-server/patches/sources/net/minecraft/server/MinecraftServer.java.patch index 36383250b0..6210cd8bee 100644 --- a/paper-server/patches/sources/net/minecraft/server/MinecraftServer.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/MinecraftServer.java.patch @@ -981,7 +981,7 @@ Objects.requireNonNull(this.packRepository); - return (ImmutableList) stream.map(resourcepackrepository::getPack).filter(Objects::nonNull).map(Pack::open).collect(ImmutableList.toImmutableList()); -+ return stream.map(resourcepackrepository::getPack).filter(Objects::nonNull).map(Pack::open).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error ++ return stream.map(resourcepackrepository::getPack).filter(Objects::nonNull).map(Pack::open).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error // Paper - decompile error // todo: is this needed anymore? }, this).thenCompose((immutablelist) -> { MultiPackResourceManager resourcemanager = new MultiPackResourceManager(PackType.SERVER_DATA, immutablelist); List> list = TagLoader.loadTagsForExistingRegistries(resourcemanager, this.registries.compositeAccess()); diff --git a/paper-server/patches/sources/net/minecraft/util/SortedArraySet.java.patch b/paper-server/patches/sources/net/minecraft/util/SortedArraySet.java.patch new file mode 100644 index 0000000000..00af73f775 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/util/SortedArraySet.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/util/SortedArraySet.java ++++ b/net/minecraft/util/SortedArraySet.java +@@ -28,7 +28,7 @@ + } + + public static > SortedArraySet create(int initialCapacity) { +- return new SortedArraySet<>(initialCapacity, Comparator.naturalOrder()); ++ return new SortedArraySet<>(initialCapacity, Comparator.naturalOrder()); // Paper - decompile fix + } + + public static SortedArraySet create(Comparator comparator) { diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/Dolphin.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/Dolphin.java.patch index 3da0d3b474..b745a078e9 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/animal/Dolphin.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/Dolphin.java.patch @@ -49,6 +49,15 @@ } } +@@ -332,7 +349,7 @@ + + @Nullable + @Override +- protected SoundEvent getDeathSound() { ++ public SoundEvent getDeathSound() { // Paper - decompile error + return SoundEvents.DOLPHIN_DEATH; + } + @@ -495,7 +512,7 @@ @Override diff --git a/paper-server/patches/sources/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java.patch b/paper-server/patches/sources/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java.patch index 4d145a9527..4a88e54b72 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java.patch @@ -9,6 +9,15 @@ context.generator().createStructures(worldserver.registryAccess(), worldserver.getChunkSource().getGeneratorState(), worldserver.structureManager(), chunk, context.structureManager(), worldserver.dimension()); } +@@ -151,7 +151,7 @@ + if (protochunk instanceof ImposterProtoChunk protochunkextension) { + chunk1 = protochunkextension.getWrapped(); + } else { +- chunk1 = new LevelChunk(worldserver, protochunk, (chunk1) -> { ++ chunk1 = new LevelChunk(worldserver, protochunk, ($) -> { // Paper - decompile fix + ChunkStatusTasks.postLoadProtoChunk(worldserver, protochunk.getEntities()); + }); + generationchunkholder.replaceProtoChunk(new ImposterProtoChunk(chunk1, false)); @@ -170,7 +170,17 @@ private static void postLoadProtoChunk(ServerLevel world, List entities) {