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 05aee4fbc835cbd665084c6102542f6e3f23802f..c2b1430ba41ec0e54ad08214c57ed97c21cdb3b9 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 29bceddeddb8e4b3f699506b9e9aa8fd5d79eec1..bc7b8e41dedeb6ba76f4d9d6240ecd218f376bd8 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 2e0eef11d45befbbadb5c4dd29944c0695ffb1e0..cfe7cdce3b1de8d0f3f93601ef04f56bb9011693 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 1da68536a7ea57435194a2cdc3b60df919323259..04523043b085541f55dbe6326bb82ac898785378 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 f3557fe7927454ca1171a8466416fb575c421fd0..fd5f555da28a2a03fb059e380f0525e0db1dd260 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 ec080bccb2f8d8b410d49791df69e1fb85c14872..9f69b82cc8c2180182a52cf07f2f2e9ee3e90d31 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 b10af93106ca9494e1ce7c3b74b366ae628a225f..0e00590f1cc0b28b2c2abe9576af891e35e21e6a 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 a145568e9c144a885640a0b197b6ffd5e4cd766b..58cffca0783a35eff6421c8d26d3022c785dfb0a 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 b83decce3c728b04fd6c15ab445ab217e07768bb..73d2973f604ccd0403abcee6a7eacb96e9df2e29 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 8e6aca729a145530166fa04e47f307552ea84d77..13b567cdbc05da4e23a95e4be681b060b0064ecb 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 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 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; } } 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 9dcc4bb370673fd6408db814643ac90bd0ada195..4462991ab5b3dfb00c7aa51fc6ba96669d27f827 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 6d7eb392dbdc8029aea0d09c6ad92175d2b55a77..93ba2ccf3f084beb0f98a75c5022a4fb8cb88e51 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 f540bb4914162767f2e5edb61816e30071ee6185..bbd11d8747c3014e0730358cd7aa46cf858fe783 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; } }