From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar 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 46c230cea78334d3a804f51c3aa152d0fa56ebfb..092bfedfb32c38550d1cab1b696feac6df09131f 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java @@ -359,7 +359,7 @@ public class Util { } public static Hash.Strategy identityStrategy() { - return Util.IdentityStrategy.INSTANCE; + return (Hash.Strategy) Util.IdentityStrategy.INSTANCE; // Paper - decompile fix } public static CompletableFuture> sequence(List> futures) { diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java index e89fa618fa20e3e843d8de81629e6dc551777823..2bb5e51f71cbf66819d198505aa4a5ecffd246c6 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java @@ -383,12 +383,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 1dfcb02b4f576e7f259a3726e0d2a48b7a76c569..bdd3b48e5de2afd6b7655ba6ff742a60ee9540c5 100644 --- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java +++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java @@ -318,7 +318,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 13c8051da164bed579fbda44af059a36b8f00a0e..b6506e881ef337bfd2a7a0644296b48b7300a0f6 100644 --- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java +++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java @@ -129,9 +129,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 Optional> lookup(ResourceKey> registryRef) { - return Optional.ofNullable(map.get(registryRef)); + return Optional.ofNullable((RegistryOps.RegistryInfo) 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 1561b26e1b4115f4d5631f20b31c2238d1d23202..124fad1031d6125bca233541e2d5f256da70ca44 100644 --- 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 ReentrantBlockableEventLoopmap(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 implements Comparable> { 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 extends AbstractSet { } 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/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java index ff5c0d5a7dd263869ba1eb93f2e81e8c6de42f26..869f60e9407ed1c5bee536ef91a21f4d11f8f964 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 @@ -148,7 +148,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl @Override protected void customServerAiStep() { this.level().getProfiler().push("camelBrain"); - Brain brain = this.getBrain(); + Brain brain = (Brain) 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 92c1966d8f64ff308bb73cea3e7a9cdf9cf350d5..7d1e6427ab5f2dabe9072d092d733b0ff34e0b44 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 @@ -101,7 +101,7 @@ public class Frog extends Animal implements VariantHolder { @Override public Brain getBrain() { - return super.getBrain(); + return (Brain) 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 9799f693dc08cdfc2974959fc792ba86c5c51ceb..7bcd5498c734873b74bee503992ec4806ae61df7 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 @@ -125,7 +125,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { @Override public Brain getBrain() { - return super.getBrain(); + return (Brain) 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 a81475d0cd3c5b75b4abe0d1a01389372a4d9ab1..bf16c44e2d61dccb662eceeef89a143a25ba40b0 100644 --- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java +++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java @@ -81,7 +81,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/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; } } 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 9fbe8ef3fea77ecbbc8689cc6472d0d5f30b7166..b8fb6d1d85e07f5165bfaf7d80807e069b595851 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java @@ -57,7 +57,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer } private static > Codec codec(IdMap idList, Codec entryCodec, PalettedContainer.Strategy provider, T defaultValue, PalettedContainerRO.Unpacker reader) { - return RecordCodecBuilder.create((instance) -> { + return RecordCodecBuilder.>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 { public void getEntities(EntityTypeTest filter, AbortableIterationConsumer 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 { } 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; } }