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

247 Zeilen
16 KiB
Diff

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-22 19:31:02 +02:00
index 05aee4fbc835cbd665084c6102542f6e3f23802f..c2b1430ba41ec0e54ad08214c57ed97c21cdb3b9 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-09-22 19:31:02 +02:00
index 29bceddeddb8e4b3f699506b9e9aa8fd5d79eec1..bc7b8e41dedeb6ba76f4d9d6240ecd218f376bd8 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-22 19:31:02 +02:00
index 2e0eef11d45befbbadb5c4dd29944c0695ffb1e0..cfe7cdce3b1de8d0f3f93601ef04f56bb9011693 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-22 19:31:02 +02:00
index 1da68536a7ea57435194a2cdc3b60df919323259..04523043b085541f55dbe6326bb82ac898785378 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-09-22 19:31:02 +02:00
index f3557fe7927454ca1171a8466416fb575c421fd0..fd5f555da28a2a03fb059e380f0525e0db1dd260 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
2023-09-22 19:31:02 +02:00
index ec080bccb2f8d8b410d49791df69e1fb85c14872..9f69b82cc8c2180182a52cf07f2f2e9ee3e90d31 100644
2022-12-07 18:08:55 +01:00
--- 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
2023-09-22 19:31:02 +02:00
index b10af93106ca9494e1ce7c3b74b366ae628a225f..0e00590f1cc0b28b2c2abe9576af891e35e21e6a 100644
2022-12-07 18:08:55 +01:00
--- 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-22 19:31:02 +02:00
index a145568e9c144a885640a0b197b6ffd5e4cd766b..58cffca0783a35eff6421c8d26d3022c785dfb0a 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-22 19:31:02 +02:00
index b83decce3c728b04fd6c15ab445ab217e07768bb..73d2973f604ccd0403abcee6a7eacb96e9df2e29 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-22 19:31:02 +02:00
index 8e6aca729a145530166fa04e47f307552ea84d77..13b567cdbc05da4e23a95e4be681b060b0064ecb 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
2023-09-22 19:31:02 +02:00
index ec7c35a9d48bd20a67b5608c908c0f94742a8139..1af2e9eb1dcc8cf90afd38ea0fbe1b65396455f4 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
2023-09-22 19:31:02 +02:00
index 8f210a745f2d5abeff2c4d4d9b13034b1a0f1490..3a89fd4fe175b6e209548e5c98d18ce3fcff07b9 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-22 19:31:02 +02:00
index 9dcc4bb370673fd6408db814643ac90bd0ada195..4462991ab5b3dfb00c7aa51fc6ba96669d27f827 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
2023-09-22 19:31:02 +02:00
index 6d7eb392dbdc8029aea0d09c6ad92175d2b55a77..93ba2ccf3f084beb0f98a75c5022a4fb8cb88e51 100644
2022-12-07 18:08:55 +01:00
--- 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
2023-09-22 19:31:02 +02:00
index f540bb4914162767f2e5edb61816e30071ee6185..bbd11d8747c3014e0730358cd7aa46cf858fe783 100644
2022-12-07 18:08:55 +01:00
--- 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;
}
}