Paper/patches/server/0006-MC-Dev-fixes.patch

247 lines
16 KiB
Diff
Raw Normal View History

2022-12-07 18:08:55 +01:00
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
2023-09-21 19:39:51 +02:00
index 46c230cea78334d3a804f51c3aa152d0fa56ebfb..092bfedfb32c38550d1cab1b696feac6df09131f 100644
2022-12-07 18:08:55 +01:00
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
2023-09-21 19:39:51 +02:00
@@ -359,7 +359,7 @@ public class Util {
2022-12-07 18:08:55 +01:00
}
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
2023-06-07 18:24:39 +02:00
index e89fa618fa20e3e843d8de81629e6dc551777823..2bb5e51f71cbf66819d198505aa4a5ecffd246c6 100644
2022-12-07 18:08:55 +01:00
--- a/src/main/java/net/minecraft/core/BlockPos.java
+++ b/src/main/java/net/minecraft/core/BlockPos.java
2023-06-07 18:24:39 +02:00
@@ -383,12 +383,12 @@ public class BlockPos extends Vec3i {
2022-12-07 18:08:55 +01:00
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
}
}
};
2022-12-08 09:52:08 +01:00
diff --git a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
2023-09-21 19:39:51 +02:00
index 1dfcb02b4f576e7f259a3726e0d2a48b7a76c569..bdd3b48e5de2afd6b7655ba6ff742a60ee9540c5 100644
2022-12-08 09:52:08 +01:00
--- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
+++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
2023-09-21 19:39:51 +02:00
@@ -318,7 +318,7 @@ public class BuiltInRegistries {
2022-12-08 09:52:08 +01:00
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;
}
2022-12-07 18:08:55 +01:00
diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
2023-09-21 19:39:51 +02:00
index 13c8051da164bed579fbda44af059a36b8f00a0e..b6506e881ef337bfd2a7a0644296b48b7300a0f6 100644
2022-12-07 18:08:55 +01:00
--- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java
+++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
2023-09-21 19:39:51 +02:00
@@ -129,9 +129,8 @@ public class ComponentUtils {
2022-12-07 18:08:55 +01:00
ComponentContents string = text.getContents();
if (string instanceof TranslatableContents) {
TranslatableContents translatableContents = (TranslatableContents)string;
- String string = translatableContents.getKey();
2023-03-14 19:05:23 +01:00
String string2 = translatableContents.getFallback();
- return string2 != null || Language.getInstance().has(string);
+ return string2 != null || Language.getInstance().has(translatableContents.getKey()); // Paper - decompile fix
2022-12-07 18:08:55 +01:00
}
}
2022-12-08 17:32:29 +01:00
diff --git a/src/main/java/net/minecraft/resources/RegistryDataLoader.java b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
2023-03-14 19:05:23 +01:00
index 41d6569c00db3d467f6e90d33ebd261529b89f4c..5f051cb22ae77f4d8994b07ac5b963bd0ff05673 100644
2022-12-08 17:32:29 +01:00
--- a/src/main/java/net/minecraft/resources/RegistryDataLoader.java
+++ b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
2023-03-14 19:05:23 +01:00
@@ -91,7 +91,7 @@ public class RegistryDataLoader {
2022-12-08 17:32:29 +01:00
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
}
};
}
2022-12-07 18:08:55 +01:00
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
2023-09-21 19:39:51 +02:00
index 1561b26e1b4115f4d5631f20b31c2238d1d23202..124fad1031d6125bca233541e2d5f256da70ca44 100644
2022-12-07 18:08:55 +01:00
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1774,7 +1774,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
2022-12-07 18:08:55 +01:00
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/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) {
2022-12-09 03:17:06 +01:00
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
2023-09-21 19:39:51 +02:00
index ff5c0d5a7dd263869ba1eb93f2e81e8c6de42f26..869f60e9407ed1c5bee536ef91a21f4d11f8f964 100644
2022-12-09 03:17:06 +01:00
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
2023-09-21 19:39:51 +02:00
@@ -148,7 +148,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
2022-12-09 03:17:06 +01:00
@Override
protected void customServerAiStep() {
2023-06-07 18:24:39 +02:00
this.level().getProfiler().push("camelBrain");
2022-12-09 03:17:06 +01:00
- Brain<?> brain = this.getBrain();
+ Brain<Camel> brain = (Brain<Camel>) this.getBrain(); // Paper - decompile fix
2023-06-07 18:24:39 +02:00
brain.tick((ServerLevel)this.level(), this);
this.level().getProfiler().pop();
this.level().getProfiler().push("camelActivityUpdate");
2022-12-07 18:08:55 +01:00
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
2023-09-21 19:39:51 +02:00
index 92c1966d8f64ff308bb73cea3e7a9cdf9cf350d5..7d1e6427ab5f2dabe9072d092d733b0ff34e0b44 100644
2022-12-07 18:08:55 +01:00
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
2023-09-21 19:39:51 +02:00
@@ -101,7 +101,7 @@ public class Frog extends Animal implements VariantHolder<FrogVariant> {
2022-12-07 18:08:55 +01:00
@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
2023-09-21 19:39:51 +02:00
index 9799f693dc08cdfc2974959fc792ba86c5c51ceb..7bcd5498c734873b74bee503992ec4806ae61df7 100644
2022-12-07 18:08:55 +01:00
--- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
2023-09-21 19:39:51 +02:00
@@ -125,7 +125,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
2022-12-07 18:08:55 +01:00
@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
2023-09-21 19:39:51 +02:00
index a81475d0cd3c5b75b4abe0d1a01389372a4d9ab1..bf16c44e2d61dccb662eceeef89a143a25ba40b0 100644
2022-12-07 18:08:55 +01:00
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
2023-09-21 19:39:51 +02:00
@@ -81,7 +81,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
2022-12-07 18:08:55 +01:00
}
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/block/CeilingHangingSignBlock.java b/src/main/java/net/minecraft/world/level/block/CeilingHangingSignBlock.java
index 769614aeb4ca914abcf0f770240a3d4c916f08cd..6c9d163b9f857806461dc72e54713f1a4f3a5c31 100644
--- a/src/main/java/net/minecraft/world/level/block/CeilingHangingSignBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CeilingHangingSignBlock.java
@@ -53,8 +53,10 @@ public class CeilingHangingSignBlock extends SignBlock {
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
BlockEntity itemStack = world.getBlockEntity(pos);
if (itemStack instanceof SignBlockEntity signBlockEntity) {
- ItemStack itemStack = player.getItemInHand(hand);
- if (this.shouldTryToChainAnotherHangingSign(player, hit, signBlockEntity, itemStack)) {
+ // Paper start - decompile fixes
+ ItemStack itemStack0 = player.getItemInHand(hand);
+ if (this.shouldTryToChainAnotherHangingSign(player, hit, signBlockEntity, itemStack0)) {
+ // Paper end - decompile fixes
return InteractionResult.PASS;
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/WallHangingSignBlock.java b/src/main/java/net/minecraft/world/level/block/WallHangingSignBlock.java
index db48010e633165972d2eac339dd7d1fd5a2f5bd8..d818d3ea6d28aa6ffb62127d4efd585d6f2935d1 100644
--- a/src/main/java/net/minecraft/world/level/block/WallHangingSignBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/WallHangingSignBlock.java
@@ -52,8 +52,10 @@ public class WallHangingSignBlock extends SignBlock {
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
BlockEntity itemStack = world.getBlockEntity(pos);
if (itemStack instanceof SignBlockEntity signBlockEntity) {
- ItemStack itemStack = player.getItemInHand(hand);
- if (this.shouldTryToChainAnotherHangingSign(state, player, hit, signBlockEntity, itemStack)) {
+ // Paper start - decompile fixes
+ ItemStack itemStack0 = player.getItemInHand(hand);
+ if (this.shouldTryToChainAnotherHangingSign(state, player, hit, signBlockEntity, itemStack0)) {
+ // Paper end
return InteractionResult.PASS;
}
}
2022-12-08 07:11:20 +01:00
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
2023-09-21 19:39:51 +02:00
index 9fbe8ef3fea77ecbbc8689cc6472d0d5f30b7166..b8fb6d1d85e07f5165bfaf7d80807e069b595851 100644
2022-12-08 07:11:20 +01:00
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
2023-09-21 19:39:51 +02:00
@@ -57,7 +57,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
2022-12-08 07:11:20 +01:00
}
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);
2022-12-07 18:08:55 +01:00
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;
}
}