Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/patches/server/0006-MC-Dev-fixes.patch

226 Zeilen
15 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 30 Mar 2016 19:36:20 -0400
Subject: [PATCH] MC Dev fixes
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index c400121d4956014a376760360180e5141013d702..b3e0495e0f242c96d4348438c0257c2045b801e5 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -357,7 +357,7 @@ public class Util {
}
public static <K> Hash.Strategy<K> identityStrategy() {
- return Util.IdentityStrategy.INSTANCE;
+ return (Hash.Strategy<K>) Util.IdentityStrategy.INSTANCE; // Paper - decompile fix
}
public static <V> CompletableFuture<List<V>> sequence(List<? extends CompletableFuture<V>> futures) {
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
index 77bf6865c6df829c5b5455d440cb2222a0d8f2af..819562d2c938fa05b8e8a00d1ae1f7c1fc9b00d5 100644
--- a/src/main/java/net/minecraft/core/BlockPos.java
+++ b/src/main/java/net/minecraft/core/BlockPos.java
@@ -370,12 +370,12 @@ public class BlockPos extends Vec3i {
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/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
index 396d065805853318b0fed98b64b2e1ab0a022e51..a969cd46694ce3094b4a65cf188677d38ae72198 100644
--- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
+++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
@@ -307,7 +307,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/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
index 9ff8afe750bc469c11c70b2f44c8a78887a8cd00..ea30dad0134644a8ad292a892450404203f3535e 100644
--- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java
+++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
@@ -138,9 +138,8 @@ public class ComponentUtils {
ComponentContents string = text.getContents();
if (string instanceof TranslatableContents) {
TranslatableContents translatableContents = (TranslatableContents)string;
- String string = translatableContents.getKey();
String string2 = translatableContents.getFallback();
- return string2 != null || Language.getInstance().has(string);
+ return string2 != null || Language.getInstance().has(translatableContents.getKey()); // Paper - decompile fix
}
}
diff --git a/src/main/java/net/minecraft/resources/RegistryDataLoader.java b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
index 41d6569c00db3d467f6e90d33ebd261529b89f4c..5f051cb22ae77f4d8994b07ac5b963bd0ff05673 100644
--- a/src/main/java/net/minecraft/resources/RegistryDataLoader.java
+++ b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
@@ -91,7 +91,7 @@ public class RegistryDataLoader {
return new RegistryOps.RegistryInfoLookup() {
@Override
public <T> Optional<RegistryOps.RegistryInfo<T>> lookup(ResourceKey<? extends Registry<? extends T>> registryRef) {
- return Optional.ofNullable(map.get(registryRef));
+ return Optional.ofNullable((RegistryOps.RegistryInfo<T>) map.get(registryRef)); // Paper - decompile fix
}
};
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 2ed954f1fab3235a1d3fff2dd0d24c3b398b4d67..41a6756144a3b826d32ecb85a71d26761e25ec11 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1775,7 +1775,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
PackRepository resourcepackrepository = this.packRepository;
Objects.requireNonNull(this.packRepository);
- return stream.map(resourcepackrepository::getPack).filter(Objects::nonNull).map(Pack::open).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error
+ return stream.<Pack>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);
diff --git a/src/main/java/net/minecraft/server/level/Ticket.java b/src/main/java/net/minecraft/server/level/Ticket.java
index 2f66abf62d303342f5fe614fb3e35e7844497ffc..b346fa94b23d81da7da073f71dd12e672e0f079c 100644
--- a/src/main/java/net/minecraft/server/level/Ticket.java
+++ b/src/main/java/net/minecraft/server/level/Ticket.java
@@ -21,7 +21,7 @@ public final class Ticket<T> implements Comparable<Ticket<?>> {
return i;
} else {
int j = Integer.compare(System.identityHashCode(this.type), System.identityHashCode(ticket.type));
- return j != 0 ? j : this.type.getComparator().compare(this.key, ticket.key);
+ return j != 0 ? j : this.type.getComparator().compare(this.key, (T)ticket.key); // Paper - decompile fix
}
}
diff --git a/src/main/java/net/minecraft/util/ExtraCodecs.java b/src/main/java/net/minecraft/util/ExtraCodecs.java
index 6dede9fb8ce33e6f7a6a6d06789d9638ce8c579d..128353b6cad685689403bd1757cc9cc7cc1091d1 100644
--- a/src/main/java/net/minecraft/util/ExtraCodecs.java
+++ b/src/main/java/net/minecraft/util/ExtraCodecs.java
@@ -227,7 +227,7 @@ public class ExtraCodecs {
}, (pair) -> {
return ImmutableList.of(leftFunction.apply(pair), rightFunction.apply(pair));
});
- Codec<I> codec3 = RecordCodecBuilder.<Pair>create((instance) -> {
+ Codec<I> codec3 = RecordCodecBuilder.<Pair<P, P>>create((instance) -> { // Paper - decompile fix
return instance.group(codec.fieldOf(leftFieldName).forGetter(Pair::getFirst), codec.fieldOf(rightFieldName).forGetter(Pair::getSecond)).apply(instance, Pair::of);
}).comapFlatMap((pair) -> {
return combineFunction.apply((P)pair.getFirst(), (P)pair.getSecond());
diff --git a/src/main/java/net/minecraft/util/SortedArraySet.java b/src/main/java/net/minecraft/util/SortedArraySet.java
index 2dc801061025888192c3bf2c4c38b928c16a0165..ca788f0dcec4a117b410fe8348969e056b138b1e 100644
--- a/src/main/java/net/minecraft/util/SortedArraySet.java
+++ b/src/main/java/net/minecraft/util/SortedArraySet.java
@@ -28,7 +28,7 @@ public class SortedArraySet<T> extends AbstractSet<T> {
}
public static <T extends Comparable<T>> SortedArraySet<T> create(int initialCapacity) {
- return new SortedArraySet<>(initialCapacity, Comparator.naturalOrder());
+ return new SortedArraySet<>(initialCapacity, Comparator.<T>naturalOrder()); // Paper - decompile fix
}
public static <T> SortedArraySet<T> create(Comparator<T> comparator) {
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
index 37a01cd6f616cac741d50066aaba21911a1ed3bb..36222d2140aa1151c30e095afc557ea7db91911f 100644
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
@@ -150,7 +150,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Rider
@Override
protected void customServerAiStep() {
this.level.getProfiler().push("camelBrain");
- Brain<?> brain = this.getBrain();
+ Brain<Camel> brain = (Brain<Camel>) this.getBrain(); // Paper - decompile fix
brain.tick((ServerLevel)this.level, this);
this.level.getProfiler().pop();
this.level.getProfiler().push("camelActivityUpdate");
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
index 872243700e982c97c8ef491684a447afc7a24bdf..c12b8831deb54deb191908ba8a769d4c78825d5b 100644
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
@@ -104,7 +104,7 @@ public class Frog extends Animal implements VariantHolder<FrogVariant> {
@Override
public Brain<Frog> getBrain() {
- return super.getBrain();
+ return (Brain<Frog>) super.getBrain(); // Paper - decompile fix
}
@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
index 64314cf4dc53a1a0a5f676fa00503858e0120dfa..45741410a13cffe3419e34b5607b048bbcf1c3ff 100644
--- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
@@ -123,7 +123,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
@Override
public Brain<Hoglin> getBrain() {
- return super.getBrain();
+ return (Brain<Hoglin>) super.getBrain(); // Paper - decompile fix
}
@Override
diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
index 4d2d23ff118e9307d50ca2a5194b83450c91a752..ab6dc3449a1d3b7acf1d7bf5ac1c24224cc252c7 100644
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
@@ -78,7 +78,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
}
this.recipes = (Map) map1.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry1) -> {
- return (entry1.getValue()); // CraftBukkit
+ return entry1.getValue(); // CraftBukkit // Paper - decompile fix - *shrugs internally* // todo: is this needed anymore?
}));
this.byName = Maps.newHashMap(builder.build()); // CraftBukkit
RecipeManager.LOGGER.info("Loaded {} recipes", map1.size());
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
index b445f90b70d5a74f5bdc1b081500da4742e1c093..afba733824d84d650e669eda028bf4d28cf006b4 100644
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
@@ -56,7 +56,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
}
private static <T, C extends PalettedContainerRO<T>> Codec<C> codec(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy provider, T defaultValue, PalettedContainerRO.Unpacker<T, C> reader) {
- return RecordCodecBuilder.<PalettedContainerRO.PackedData>create((instance) -> {
+ return RecordCodecBuilder.<PalettedContainerRO.PackedData<T>>create((instance) -> { // Paper - decompile fix
return instance.group(entryCodec.mapResult(ExtraCodecs.orElsePartial(defaultValue)).listOf().fieldOf("palette").forGetter(PalettedContainerRO.PackedData::paletteEntries), Codec.LONG_STREAM.optionalFieldOf("data").forGetter(PalettedContainerRO.PackedData::storage)).apply(instance, PalettedContainerRO.PackedData::new);
}).comapFlatMap((serialized) -> {
return reader.read(idList, provider, serialized);
diff --git a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java
index 6b91771a4bf559881a4f3e6c98500e09b33d16e0..21a2800db22f287b9c6a8290326fdf3b94ae94b1 100644
--- a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java
+++ b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java
@@ -19,7 +19,7 @@ public class EntityLookup<T extends EntityAccess> {
public <U extends T> void getEntities(EntityTypeTest<T, U> filter, AbortableIterationConsumer<U> consumer) {
for(T entityAccess : this.byId.values()) {
U entityAccess2 = (U)((EntityAccess)filter.tryCast(entityAccess));
- if (entityAccess2 != null && consumer.accept((T)entityAccess2).shouldAbort()) {
+ if (entityAccess2 != null && consumer.accept(entityAccess2).shouldAbort()) { // Paper - decompile fix
return;
}
}
diff --git a/src/main/java/net/minecraft/world/level/entity/EntitySection.java b/src/main/java/net/minecraft/world/level/entity/EntitySection.java
index 69a19dbf58cde41680d086e78b9a12ffee602dbf..5dcb7f9cab097990148f5a7c4ccbe1556afdd514 100644
--- a/src/main/java/net/minecraft/world/level/entity/EntitySection.java
+++ b/src/main/java/net/minecraft/world/level/entity/EntitySection.java
@@ -44,7 +44,7 @@ public class EntitySection<T extends EntityAccess> {
} else {
for(T entityAccess : collection) {
U entityAccess2 = (U)((EntityAccess)type.tryCast(entityAccess));
- if (entityAccess2 != null && entityAccess.getBoundingBox().intersects(box) && consumer.accept((T)entityAccess2).shouldAbort()) {
+ if (entityAccess2 != null && entityAccess.getBoundingBox().intersects(box) && consumer.accept(entityAccess2).shouldAbort()) { // Paper - decompile fix
return AbortableIterationConsumer.Continuation.ABORT;
}
}