mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Compiler issues v3
This commit is contained in:
parent
c6a0ad379d
commit
319032e137
20 changed files with 89 additions and 59 deletions
|
@ -17,13 +17,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ @Override
|
||||
+ public org.bukkit.NamespacedKey getBiomeKey(org.bukkit.RegionAccessor accessor, int x, int y, int z) {
|
||||
+ org.bukkit.craftbukkit.CraftRegionAccessor cra = (org.bukkit.craftbukkit.CraftRegionAccessor) accessor;
|
||||
+ return org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(cra.getHandle().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME).getKey(cra.getHandle().getBiome(new net.minecraft.core.BlockPos(x, y, z)).value()));
|
||||
+ return org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(cra.getHandle().registryAccess().lookupOrThrow(net.minecraft.core.registries.Registries.BIOME).getKey(cra.getHandle().getBiome(new net.minecraft.core.BlockPos(x, y, z)).value()));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setBiomeKey(org.bukkit.RegionAccessor accessor, int x, int y, int z, org.bukkit.NamespacedKey biomeKey) {
|
||||
+ org.bukkit.craftbukkit.CraftRegionAccessor cra = (org.bukkit.craftbukkit.CraftRegionAccessor) accessor;
|
||||
+ net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biomeBase = cra.getHandle().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME).getHolderOrThrow(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.BIOME, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(biomeKey)));
|
||||
+ net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biomeBase = cra.getHandle().registryAccess().lookupOrThrow(net.minecraft.core.registries.Registries.BIOME).getOrThrow(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.BIOME, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(biomeKey)));
|
||||
+ cra.setBiome(x, y, z, biomeBase);
|
||||
+ }
|
||||
+ // Paper end - namespaced key biome methods
|
||||
|
|
|
@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Update client
|
||||
+ player.containerMenu.sendAllDataToRemote();
|
||||
+
|
||||
+ return ItemInteractionResult.CONSUME;
|
||||
+ return InteractionResult.CONSUME;
|
||||
+ }
|
||||
+ // Paper end - Add PlayerFlowerPotManipulateEvent
|
||||
world.setBlock(pos, blockState, 3);
|
||||
|
|
|
@ -14,8 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
+ // Paper start - Add PlayerItemCooldownEvent
|
||||
+ @Override
|
||||
+ public void addCooldown(Item item, int duration) {
|
||||
+ io.papermc.paper.event.player.PlayerItemCooldownEvent event = new io.papermc.paper.event.player.PlayerItemCooldownEvent(this.player.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemType.minecraftToBukkit(item), duration);
|
||||
+ public void addCooldown(ItemStack item, int duration) {
|
||||
+ io.papermc.paper.event.player.PlayerItemCooldownEvent event = new io.papermc.paper.event.player.PlayerItemCooldownEvent(this.player.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemType.minecraftToBukkit(item.getItem()), duration);
|
||||
+ if (event.callEvent()) {
|
||||
+ super.addCooldown(item, event.getCooldown());
|
||||
+ }
|
||||
|
|
|
@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ io.papermc.paper.event.block.PlayerShearBlockEvent event = new io.papermc.paper.event.block.PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), new java.util.ArrayList<>());
|
||||
+ event.getDrops().add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(Items.HONEYCOMB, 3)));
|
||||
+ if (!event.callEvent()) {
|
||||
+ return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION;
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ // Paper end
|
||||
world.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.BEEHIVE_SHEAR, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
|
@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ io.papermc.paper.event.block.PlayerShearBlockEvent event = new io.papermc.paper.event.block.PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), new java.util.ArrayList<>());
|
||||
+ event.getDrops().add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(Items.PUMPKIN_SEEDS, 4)));
|
||||
+ if (!event.callEvent()) {
|
||||
+ return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION;
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ // Paper end - Add PlayerShearBlockEvent
|
||||
Direction direction = hit.getDirection();
|
||||
|
|
|
@ -80,7 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Generate a new UUID so we don't have to worry about deserializing the same entity twice
|
||||
+ compound.remove("UUID");
|
||||
+ }
|
||||
+ return net.minecraft.world.entity.EntityType.create(compound, ((org.bukkit.craftbukkit.CraftWorld) world).getHandle())
|
||||
+ return net.minecraft.world.entity.EntityType.create(compound, ((org.bukkit.craftbukkit.CraftWorld) world).getHandle(), net.minecraft.world.entity.EntitySpawnReason.LOAD)
|
||||
+ .orElseThrow(() -> new IllegalArgumentException("An ID was not found for the data. Did you downgrade?")).getBukkitEntity();
|
||||
+ }
|
||||
+
|
||||
|
|
|
@ -23,12 +23,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ return null;
|
||||
+ }
|
||||
+ if (event.getResult() != null) {
|
||||
+ return Pair.of(io.papermc.paper.util.MCUtil.toBlockPos(event.getResult().pos()), world.registryAccess().registryOrThrow(Registries.STRUCTURE).wrapAsHolder(org.bukkit.craftbukkit.generator.structure.CraftStructure.bukkitToMinecraft(event.getResult().structure())));
|
||||
+ return Pair.of(io.papermc.paper.util.MCUtil.toBlockPos(event.getResult().pos()), world.registryAccess().lookupOrThrow(Registries.STRUCTURE).wrapAsHolder(org.bukkit.craftbukkit.generator.structure.CraftStructure.bukkitToMinecraft(event.getResult().structure())));
|
||||
+ }
|
||||
+ center = io.papermc.paper.util.MCUtil.toBlockPosition(event.getOrigin());
|
||||
+ radius = event.getRadius();
|
||||
+ skipReferencedStructures = event.shouldFindUnexplored();
|
||||
+ structures = HolderSet.direct(api -> world.registryAccess().registryOrThrow(Registries.STRUCTURE).wrapAsHolder(org.bukkit.craftbukkit.generator.structure.CraftStructure.bukkitToMinecraft(api)), event.getStructures());
|
||||
+ structures = HolderSet.direct(api -> world.registryAccess().lookupOrThrow(Registries.STRUCTURE).wrapAsHolder(org.bukkit.craftbukkit.generator.structure.CraftStructure.bukkitToMinecraft(api)), event.getStructures());
|
||||
+ }
|
||||
+ // Paper end
|
||||
ChunkGeneratorStructureState chunkgeneratorstructurestate = world.getChunkSource().getGeneratorState();
|
||||
|
|
|
@ -331,7 +331,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+ }
|
||||
+
|
||||
+ EmptyLevelChunk emptyChunk = new EmptyLevelChunk(level, new ChunkPos(0, 0), MinecraftServer.getServer().registryAccess().registryOrThrow(Registries.BIOME).getHolderOrThrow(Biomes.PLAINS));
|
||||
+ EmptyLevelChunk emptyChunk = new EmptyLevelChunk(level, new ChunkPos(0, 0), MinecraftServer.getServer().registryAccess().lookupOrThrow(Registries.BIOME).getOrThrow(Biomes.PLAINS));
|
||||
+ BlockPos zeroPos = new BlockPos(0, 0, 0);
|
||||
+
|
||||
+ for (int i = 0; i < solidGlobal.length; i++) {
|
||||
|
@ -427,7 +427,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ LevelChunkSection[] nearbyChunkSections = new LevelChunkSection[4];
|
||||
+ LevelChunk chunk = chunkPacketInfoAntiXray.getChunk();
|
||||
+ Level level = chunk.getLevel();
|
||||
+ int maxChunkSectionIndex = Math.min((maxBlockHeight >> 4) - chunk.getMinSection(), chunk.getSectionsCount()) - 1;
|
||||
+ int maxChunkSectionIndex = Math.min((maxBlockHeight >> 4) - chunk.getMinSectionY(), chunk.getSectionsCount()) - 1;
|
||||
+ boolean[] solidTemp = null;
|
||||
+ boolean[] obfuscateTemp = null;
|
||||
+ bitStorageReader.setBuffer(chunkPacketInfoAntiXray.getBuffer());
|
||||
|
@ -485,7 +485,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ presetBlockStateBitsTemp = switch (level.getWorld().getEnvironment()) {
|
||||
+ case NETHER -> presetBlockStateBitsNetherrackGlobal;
|
||||
+ case THE_END -> presetBlockStateBitsEndStoneGlobal;
|
||||
+ default -> chunkSectionIndex + chunk.getMinSection() < 0 ? presetBlockStateBitsDeepslateGlobal : presetBlockStateBitsStoneGlobal;
|
||||
+ default -> chunkSectionIndex + chunk.getMinSectionY() < 0 ? presetBlockStateBitsDeepslateGlobal : presetBlockStateBitsStoneGlobal;
|
||||
+ };
|
||||
+ } else {
|
||||
+ presetBlockStateBitsTemp = presetBlockStateBitsGlobal;
|
||||
|
@ -1540,7 +1540,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
if (nbttagcompound3.contains("block_states", 10)) {
|
||||
- datapaletteblock = (PalettedContainer) SerializableChunkData.BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, nbttagcompound3.getCompound("block_states")).promotePartial((s1) -> {
|
||||
+ Codec<PalettedContainer<BlockState>> blockStateCodec = presetBlockStates == null ? ChunkSerializer.BLOCK_STATE_CODEC : PalettedContainer.codecRW(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState(), presetBlockStates); // Paper - Anti-Xray
|
||||
+ Codec<PalettedContainer<BlockState>> blockStateCodec = presetBlockStates == null ? BLOCK_STATE_CODEC : PalettedContainer.codecRW(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState(), presetBlockStates); // Paper - Anti-Xray
|
||||
+ datapaletteblock = blockStateCodec.parse(NbtOps.INSTANCE, nbttagcompound1.getCompound("block_states")).promotePartial((s1) -> { // Paper - Anti-Xray
|
||||
logErrors(chunkcoordintpair, b0, s1);
|
||||
}).getOrThrow(SerializableChunkData.ChunkReadException::new);
|
||||
|
|
|
@ -15,10 +15,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
public void onMobRemoved(ServerLevel world, LivingEntity entity, int amplifier, Entity.RemovalReason reason) {
|
||||
if (reason == Entity.RemovalReason.KILLED && (entity instanceof Player || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) {
|
||||
- this.spawnCobwebsRandomlyAround(world, entity.getRandom(), entity.blockPosition());
|
||||
+ this.spawnCobwebsRandomlyAround(entity, world, entity.getRandom(), entity.blockPosition()); // Paper - Fire EntityChangeBlockEvent in more places
|
||||
+ this.spawnCobwebsRandomlyAround(world, entity.getRandom(), entity.blockPosition(), entity); // Paper - Fire EntityChangeBlockEvent in more places
|
||||
}
|
||||
}
|
||||
|
||||
- private void spawnCobwebsRandomlyAround(ServerLevel world, RandomSource random, BlockPos pos) {
|
||||
+ private void spawnCobwebsRandomlyAround(ServerLevel world, RandomSource random, BlockPos pos, LivingEntity entity) { // Paper - Fire EntityChangeBlockEvent in more places
|
||||
Set<BlockPos> set = Sets.newHashSet();
|
||||
int i = this.maxCobwebs.applyAsInt(random);
|
||||
|
||||
@@ -0,0 +0,0 @@ class WeavingMobEffect extends MobEffect {
|
||||
}
|
||||
|
||||
|
@ -160,8 +165,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
BlockState blockState = level.getBlockState(blockPos);
|
||||
if (context.getClickedFace() != Direction.DOWN && blockState.is(BlockTags.CONVERTABLE_TO_MUD) && potionContents.is(Potions.WATER)) {
|
||||
+ // Paper start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityhuman, blockposition, Blocks.MUD.defaultBlockState())) {
|
||||
+ entityhuman.containerMenu.sendAllDataToRemote();
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, blockPos, Blocks.MUD.defaultBlockState())) {
|
||||
+ player.containerMenu.sendAllDataToRemote();
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
@ -214,7 +219,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper start - call change block event
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, pos, CandleCakeBlock.byCandle(candleblock))) {
|
||||
+ player.containerMenu.sendAllDataToRemote(); // update inv because candle could decrease
|
||||
+ return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||
+ return InteractionResult.TRY_WITH_EMPTY_HAND;
|
||||
+ }
|
||||
+ // Paper end - call change block event
|
||||
stack.consume(1, player);
|
||||
|
@ -254,7 +259,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
BlockState iblockdata1 = ComposterBlock.addItem(player, state, world, pos, stack);
|
||||
+ // Paper start - handle cancelled events
|
||||
+ if (iblockdata1 == null) {
|
||||
+ return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION;
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
if (reader.isTag()) {
|
||||
TagKey<EntityType<?>> tagKey = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.read(reader.getReader()));
|
||||
+ // Paper start - tell clients to ask server for suggestions for EntityArguments; throw error if invalid entity tag (only on suggestions to keep cmd success behavior)
|
||||
+ if (reader.parsingEntityArgumentSuggestions && io.papermc.paper.configuration.GlobalConfiguration.get().commands.fixTargetSelectorTagCompletion && net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.getTag(tagKey).isEmpty()) {
|
||||
+ if (reader.parsingEntityArgumentSuggestions && io.papermc.paper.configuration.GlobalConfiguration.get().commands.fixTargetSelectorTagCompletion && net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(tagKey).isEmpty()) {
|
||||
+ reader.getReader().setCursor(i);
|
||||
+ throw ERROR_ENTITY_TAG_INVALID.createWithContext(reader.getReader(), tagKey);
|
||||
+ }
|
||||
|
|
|
@ -88,13 +88,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
int viewDistance = world.getCraftServer().getViewDistance() * 16;
|
||||
BlockPos soundPos = blockposition1.offset(1, 0, 1);
|
||||
- for (ServerPlayer player : world.getServer().getPlayerList().players) {
|
||||
+ for (ServerPlayer player : world.getPlayersForGlobalSoundGamerule()) { // Paper - respect global sound events gamerule
|
||||
+ final net.minecraft.server.level.ServerLevel serverLevel = (net.minecraft.server.level.ServerLevel) world; // Paper - respect global sound events gamerule - ensured by isClientSide check above
|
||||
+ for (ServerPlayer player : serverLevel.getPlayersForGlobalSoundGamerule()) { // Paper - respect global sound events gamerule
|
||||
double deltaX = soundPos.getX() - player.getX();
|
||||
double deltaZ = soundPos.getZ() - player.getZ();
|
||||
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
||||
- if (world.spigotConfig.endPortalSoundRadius > 0 && distanceSquared > world.spigotConfig.endPortalSoundRadius * world.spigotConfig.endPortalSoundRadius) continue; // Spigot
|
||||
+ final double soundRadiusSquared = world.getGlobalSoundRangeSquared(config -> config.endPortalSoundRadius); // Paper - respect global sound events gamerule
|
||||
+ if (!world.getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_GLOBAL_SOUND_EVENTS) && distanceSquared > soundRadiusSquared) continue; // Spigot // Paper - respect global sound events gamerule
|
||||
+ final double soundRadiusSquared = serverLevel.getGlobalSoundRangeSquared(config -> config.endPortalSoundRadius); // Paper - respect global sound events gamerule
|
||||
+ if (!serverLevel.getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_GLOBAL_SOUND_EVENTS) && distanceSquared > soundRadiusSquared) continue; // Spigot // Paper - respect global sound events gamerule
|
||||
if (distanceSquared > viewDistance * viewDistance) {
|
||||
double deltaLength = Math.sqrt(distanceSquared);
|
||||
double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance;
|
||||
|
|
|
@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Spigot start
|
||||
+ for ( Map.Entry<ResourceLocation, Integer> entry : org.spigotmc.SpigotConfig.forcedStats.entrySet() )
|
||||
+ {
|
||||
+ Stat<ResourceLocation> wrapper = Stats.CUSTOM.get(java.util.Objects.requireNonNull(BuiltInRegistries.CUSTOM_STAT.get(entry.getKey()))); // Paper - ensured by SpigotConfig#stats
|
||||
+ Stat<ResourceLocation> wrapper = Stats.CUSTOM.get(java.util.Objects.requireNonNull(BuiltInRegistries.CUSTOM_STAT.getValue(entry.getKey()))); // Paper - ensured by SpigotConfig#stats
|
||||
+ this.stats.put( wrapper, entry.getValue().intValue() );
|
||||
+ }
|
||||
+ // Spigot end
|
||||
|
|
|
@ -86,18 +86,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
}
|
||||
return CraftMagicNumbers.getItem(itemToBeRepaired.getType()).isValidRepairItem(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial));
|
||||
return CraftItemStack.unwrap(itemToBeRepaired).isValidRepairItem(CraftItemStack.unwrap(repairMaterial));
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean hasDefaultEntityAttributes(NamespacedKey bukkitEntityKey) {
|
||||
+ return net.minecraft.world.entity.ai.attributes.DefaultAttributes.hasSupplier(net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey)));
|
||||
+ return net.minecraft.world.entity.ai.attributes.DefaultAttributes.hasSupplier(net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.getValue(CraftNamespacedKey.toMinecraft(bukkitEntityKey)));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public org.bukkit.attribute.Attributable getDefaultEntityAttributes(NamespacedKey bukkitEntityKey) {
|
||||
+ Preconditions.checkArgument(hasDefaultEntityAttributes(bukkitEntityKey), bukkitEntityKey + " doesn't have default attributes");
|
||||
+ var supplier = net.minecraft.world.entity.ai.attributes.DefaultAttributes.getSupplier((net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.LivingEntity>) net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey)));
|
||||
+ var supplier = net.minecraft.world.entity.ai.attributes.DefaultAttributes.getSupplier((net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.LivingEntity>) net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.getValue(CraftNamespacedKey.toMinecraft(bukkitEntityKey)));
|
||||
+ return new io.papermc.paper.attribute.UnmodifiableAttributeMap(supplier);
|
||||
+ }
|
||||
// Paper end
|
||||
|
|
|
@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ if (!itemToBeRepaired.getType().isItem() || !repairMaterial.getType().isItem()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ return CraftMagicNumbers.getItem(itemToBeRepaired.getType()).isValidRepairItem(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial));
|
||||
+ return CraftItemStack.unwrap(itemToBeRepaired).isValidRepairItem(CraftItemStack.unwrap(repairMaterial));
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
|
|
|
@ -128,18 +128,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ /* Lootable */
|
||||
+ @Override
|
||||
+ default @Nullable LootTable getLootTable() {
|
||||
+ return CraftLootTable.minecraftToBukkit(this.getHandle().getLootTable());
|
||||
+ return CraftLootTable.minecraftToBukkit(this.getHandle().getContainerLootTable());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default void setLootTable(final @Nullable LootTable table, final long seed) {
|
||||
+ this.getHandle().setLootTable(CraftLootTable.bukkitToMinecraft(table));
|
||||
+ this.getHandle().setLootTableSeed(seed);
|
||||
+ this.getHandle().setContainerLootTable(CraftLootTable.bukkitToMinecraft(table));
|
||||
+ this.getHandle().setContainerLootTableSeed(seed);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default long getSeed() {
|
||||
+ return this.getHandle().getLootTableSeed();
|
||||
+ return this.getHandle().getContainerLootTableSeed();
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java
|
||||
|
|
|
@ -4,6 +4,19 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/Util.java
|
||||
+++ b/src/main/java/net/minecraft/Util.java
|
||||
@@ -0,0 +0,0 @@ public class Util {
|
||||
public static <K extends Enum<K>, V> EnumMap<K, V> makeEnumMap(Class<K> enumClass, Function<K, V> mapper) {
|
||||
EnumMap<K, V> enumMap = new EnumMap<>(enumClass);
|
||||
|
||||
- for (K enum_ : (Enum[])enumClass.getEnumConstants()) {
|
||||
+ for (K enum_ : enumClass.getEnumConstants()) { // Paper - decompile error
|
||||
enumMap.put(enum_, mapper.apply(enum_));
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/arguments/item/ItemInput.java b/src/main/java/net/minecraft/commands/arguments/item/ItemInput.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/commands/arguments/item/ItemInput.java
|
||||
|
@ -70,6 +83,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
if (!this.hasElementSeparator()) {
|
||||
diff --git a/src/main/java/net/minecraft/resources/RegistryDataLoader.java b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/resources/RegistryDataLoader.java
|
||||
+++ b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
|
||||
@@ -0,0 +0,0 @@ import org.slf4j.Logger;
|
||||
|
||||
public class RegistryDataLoader {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
- private static final Comparator<ResourceKey<?>> ERROR_KEY_COMPARATOR = Comparator.comparing(ResourceKey::registry).thenComparing(ResourceKey::location);
|
||||
+ private static final Comparator<ResourceKey<?>> ERROR_KEY_COMPARATOR = Comparator.<ResourceKey<?>, ResourceLocation>comparing(ResourceKey::registry).thenComparing(ResourceKey::location); // Paper - decompile fix
|
||||
private static final RegistrationInfo NETWORK_REGISTRATION_INFO = new RegistrationInfo(Optional.empty(), Lifecycle.experimental());
|
||||
private static final Function<Optional<KnownPack>, RegistrationInfo> REGISTRATION_INFO_CACHE = Util.memoize(knownPacks -> {
|
||||
Lifecycle lifecycle = knownPacks.map(KnownPack::isVanilla).map(vanilla -> Lifecycle.stable()).orElse(Lifecycle.experimental());
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
|
@ -96,6 +122,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
public static <T> SortedArraySet<T> create(Comparator<T> comparator) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||
@@ -0,0 +0,0 @@ public class Dolphin extends AgeableWaterCreature {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
- protected SoundEvent getDeathSound() {
|
||||
+ public SoundEvent getDeathSound() { // Paper - decompile error
|
||||
return SoundEvents.DOLPHIN_DEATH;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Pillager.java b/src/main/java/net/minecraft/world/entity/monster/Pillager.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Pillager.java
|
||||
|
|
|
@ -3882,11 +3882,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // min, max are inclusive
|
||||
+
|
||||
+ public static int getMaxSection(final LevelHeightAccessor world) {
|
||||
+ return world.getMaxSection() - 1; // getMaxSection() is exclusive
|
||||
+ return world.getMaxSectionY() - 1; // getMaxSection() is exclusive
|
||||
+ }
|
||||
+
|
||||
+ public static int getMinSection(final LevelHeightAccessor world) {
|
||||
+ return world.getMinSection();
|
||||
+ return world.getMinSectionY();
|
||||
+ }
|
||||
+
|
||||
+ public static int getMaxLightSection(final LevelHeightAccessor world) {
|
||||
|
@ -4622,23 +4622,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
ChunkAccess ichunkaccess = chunk.getLatestChunk();
|
||||
-
|
||||
- if (this.pendingUnloads.remove(pos, chunk) && ichunkaccess != null) {
|
||||
- LevelChunk chunk1;
|
||||
+ // Paper start
|
||||
+ boolean removed;
|
||||
+ if ((removed = this.pendingUnloads.remove(pos, chunk)) && ichunkaccess != null) {
|
||||
+ ca.spottedleaf.moonrise.common.util.ChunkSystem.onChunkHolderDelete(this.level, chunk);
|
||||
+ // Paper end
|
||||
+ LevelChunk chunk;
|
||||
LevelChunk chunk1;
|
||||
|
||||
if (ichunkaccess instanceof LevelChunk) {
|
||||
chunk1 = (LevelChunk) ichunkaccess;
|
||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.lightEngine.tryScheduleUpdate();
|
||||
this.progressListener.onStatusChange(ichunkaccess.getPos(), (ChunkStatus) null);
|
||||
this.nextChunkSaveTime.remove(ichunkaccess.getPos().toLong());
|
||||
- }
|
||||
+ } else if (removed) { // Paper start
|
||||
+ ca.spottedleaf.moonrise.common.util.ChunkSystem.onChunkHolderDelete(this.level, holder);
|
||||
+ ca.spottedleaf.moonrise.common.util.ChunkSystem.onChunkHolderDelete(this.level, chunk);
|
||||
+ } // Paper end
|
||||
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- itemstack.consume(1, user);
|
||||
+ // Paper start - PlayerLaunchProjectileEvent
|
||||
+ final Projectile.Delayed<Snowball> snowball = Projectile.spawnProjectileFromRotationDelayed(Snowball::new, worldserver, itemstack, user, 0.0F, 1.5F, 1.0F);
|
||||
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Projectile) entitysnowball.getBukkitEntity());
|
||||
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Projectile) snowball.projectile().getBukkitEntity());
|
||||
+ if (event.callEvent() && snowball.attemptSpawn()) {
|
||||
+ user.awardStat(Stats.ITEM_USED.get(this));
|
||||
+ if (event.shouldConsume()) {
|
||||
|
|
|
@ -1145,9 +1145,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ public static final io.papermc.paper.registry.data.util.Conversions BUILT_IN_CONVERSIONS = new io.papermc.paper.registry.data.util.Conversions(new net.minecraft.resources.RegistryOps.RegistryInfoLookup() {
|
||||
+ @Override
|
||||
+ public <T> java.util.Optional<net.minecraft.resources.RegistryOps.RegistryInfo<T>> lookup(final ResourceKey<? extends Registry<? extends T>> registryRef) {
|
||||
+ final Registry<T> registry = net.minecraft.server.RegistryLayer.STATIC_ACCESS.registryOrThrow(registryRef);
|
||||
+ final Registry<T> registry = net.minecraft.server.RegistryLayer.STATIC_ACCESS.lookupOrThrow(registryRef);
|
||||
+ return java.util.Optional.of(
|
||||
+ new net.minecraft.resources.RegistryOps.RegistryInfo<>(registry.asLookup(), registry.asTagAddingLookup(), Lifecycle.experimental())
|
||||
+ new net.minecraft.resources.RegistryOps.RegistryInfo<>(registry, registry, Lifecycle.experimental())
|
||||
+ );
|
||||
+ }
|
||||
+ });
|
||||
|
@ -1348,12 +1348,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper start - RegistrySet API
|
||||
+ @Override
|
||||
+ public boolean hasTag(final io.papermc.paper.registry.tag.TagKey<B> key) {
|
||||
+ return this.minecraftRegistry.getTag(net.minecraft.tags.TagKey.create(this.minecraftRegistry.key(), io.papermc.paper.adventure.PaperAdventure.asVanilla(key.key()))).isPresent();
|
||||
+ return this.minecraftRegistry.get(net.minecraft.tags.TagKey.create(this.minecraftRegistry.key(), io.papermc.paper.adventure.PaperAdventure.asVanilla(key.key()))).isPresent();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public io.papermc.paper.registry.tag.Tag<B> getTag(final io.papermc.paper.registry.tag.TagKey<B> key) {
|
||||
+ final net.minecraft.core.HolderSet.Named<M> namedHolderSet = this.minecraftRegistry.getTag(io.papermc.paper.registry.PaperRegistries.toNms(key)).orElseThrow();
|
||||
+ final net.minecraft.core.HolderSet.Named<M> namedHolderSet = this.minecraftRegistry.get(io.papermc.paper.registry.PaperRegistries.toNms(key)).orElseThrow();
|
||||
+ return new io.papermc.paper.registry.set.NamedRegistryKeySetImpl<>(key, namedHolderSet);
|
||||
+ }
|
||||
+ // Paper end - RegistrySet API
|
||||
|
@ -1373,9 +1373,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ throw new UnsupportedOperationException(tagKey.registryKey() + " doesn't have tags");
|
||||
+ }
|
||||
+ final net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<M>> nmsKey = io.papermc.paper.registry.PaperRegistries.registryToNms(tagKey.registryKey());
|
||||
+ final net.minecraft.core.Registry<M> nmsRegistry = org.bukkit.craftbukkit.CraftRegistry.getMinecraftRegistry().registryOrThrow(nmsKey);
|
||||
+ final net.minecraft.core.Registry<M> nmsRegistry = org.bukkit.craftbukkit.CraftRegistry.getMinecraftRegistry().lookupOrThrow(nmsKey);
|
||||
+ return nmsRegistry
|
||||
+ .getTag(io.papermc.paper.registry.PaperRegistries.toNms(tagKey))
|
||||
+ .get(io.papermc.paper.registry.PaperRegistries.toNms(tagKey))
|
||||
+ .map(named -> new io.papermc.paper.registry.set.NamedRegistryKeySetImpl<>(tagKey, named))
|
||||
+ .orElse(null);
|
||||
+ }
|
||||
|
|
|
@ -58,19 +58,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
entityliving1 = entityliving2;
|
||||
} else {
|
||||
entityliving1 = null;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||
@@ -0,0 +0,0 @@ public class Dolphin extends AgeableWaterCreature {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
- protected SoundEvent getDeathSound() {
|
||||
+ public SoundEvent getDeathSound() { // Paper - remap fixes
|
||||
return SoundEvents.DOLPHIN_DEATH;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
|
||||
|
|
|
@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
Registry<StructureTemplatePool> registry = world.registryAccess().lookupOrThrow(Registries.TEMPLATE_POOL);
|
||||
- Holder<StructureTemplatePool> holder = registry.getOrThrow(this.pool);
|
||||
+ // Paper start - Replace getHolderOrThrow with a null check
|
||||
+ Holder<StructureTemplatePool> holder = registry.getHolder(this.pool).orElse(null);
|
||||
+ Holder<StructureTemplatePool> holder = registry.get(this.pool).orElse(null);
|
||||
+ if (holder == null) {
|
||||
+ return;
|
||||
+ }
|
||||
|
|
Loading…
Reference in a new issue