diff --git a/paper-server/patches/sources/net/minecraft/commands/arguments/EntityArgument.java.patch b/paper-server/patches/sources/net/minecraft/commands/arguments/EntityArgument.java.patch index 30696dc07f..e2b9c3d155 100644 --- a/paper-server/patches/sources/net/minecraft/commands/arguments/EntityArgument.java.patch +++ b/paper-server/patches/sources/net/minecraft/commands/arguments/EntityArgument.java.patch @@ -7,7 +7,7 @@ + // CraftBukkit start + return this.parse(reader, allowSelectors, true); + } -+ private EntitySelector parse(StringReader reader, boolean allowSelectors, boolean overridePermissions) throws CommandSyntaxException { ++ public EntitySelector parse(StringReader reader, boolean allowSelectors, boolean overridePermissions) throws CommandSyntaxException { + // CraftBukkit end int i = 0; EntitySelectorParser entitySelectorParser = new EntitySelectorParser(reader, allowSelectors); diff --git a/paper-server/patches/sources/net/minecraft/server/commands/DebugCommand.java.patch b/paper-server/patches/sources/net/minecraft/server/commands/DebugCommand.java.patch new file mode 100644 index 0000000000..9d1cc61c46 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/server/commands/DebugCommand.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/server/commands/DebugCommand.java ++++ b/net/minecraft/server/commands/DebugCommand.java +@@ -262,6 +_,13 @@ + return true; + } + ++ // Paper start ++ @Override ++ public org.bukkit.command.CommandSender getBukkitSender(final CommandSourceStack wrapper) { ++ throw new UnsupportedOperationException(); ++ } ++ // Paper end ++ + @Override + public void close() { + IOUtils.closeQuietly((Writer)this.output); diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/Dolphin.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/Dolphin.java.patch index 281bb05b75..a9f720be0d 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/animal/Dolphin.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/Dolphin.java.patch @@ -39,15 +39,6 @@ } } } -@@ -341,7 +_,7 @@ - - @Nullable - @Override -- protected SoundEvent getDeathSound() { -+ public SoundEvent getDeathSound() { // Paper - decompile error - return SoundEvents.DOLPHIN_DEATH; - } - @@ -497,7 +_,7 @@ @Override diff --git a/paper-server/patches/sources/net/minecraft/world/entity/npc/ClientSideMerchant.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/npc/ClientSideMerchant.java.patch new file mode 100644 index 0000000000..b19fe89536 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/entity/npc/ClientSideMerchant.java.patch @@ -0,0 +1,16 @@ +--- a/net/minecraft/world/entity/npc/ClientSideMerchant.java ++++ b/net/minecraft/world/entity/npc/ClientSideMerchant.java +@@ -56,6 +_,13 @@ + return this.source == player; + } + ++ // Paper start ++ @Override ++ public org.bukkit.craftbukkit.inventory.CraftMerchant getCraftMerchant() { ++ throw new UnsupportedOperationException(); ++ } ++ // Paper end ++ + @Override + public int getVillagerXp() { + return this.xp; diff --git a/paper-server/patches/sources/net/minecraft/world/level/EmptyBlockAndTintGetter.java.patch b/paper-server/patches/sources/net/minecraft/world/level/EmptyBlockAndTintGetter.java.patch new file mode 100644 index 0000000000..6ca1c8d13e --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/level/EmptyBlockAndTintGetter.java.patch @@ -0,0 +1,21 @@ +--- a/net/minecraft/world/level/EmptyBlockAndTintGetter.java ++++ b/net/minecraft/world/level/EmptyBlockAndTintGetter.java +@@ -39,6 +_,18 @@ + return Blocks.AIR.defaultBlockState(); + } + ++ // Paper start ++ @Override ++ public @org.jetbrains.annotations.Nullable BlockState getBlockStateIfLoaded(final BlockPos blockposition) { ++ return null; ++ } ++ ++ @Override ++ public @org.jetbrains.annotations.Nullable FluidState getFluidIfLoaded(final BlockPos blockposition) { ++ return null; ++ } ++ // Paper end ++ + @Override + public FluidState getFluidState(BlockPos pos) { + return Fluids.EMPTY.defaultFluidState(); diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/ConcretePowderBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/ConcretePowderBlock.java.patch index 09d88b80ed..3c8335c0a5 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/ConcretePowderBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/ConcretePowderBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/ConcretePowderBlock.java +++ b/net/minecraft/world/level/block/ConcretePowderBlock.java -@@ -38,7 +_,7 @@ +@@ -38,16 +_,33 @@ @Override public void onLand(Level level, BlockPos pos, BlockState state, BlockState replaceableState, FallingBlockEntity fallingBlock) { if (shouldSolidify(level, pos, replaceableState)) { @@ -9,8 +9,10 @@ } } -@@ -47,7 +_,24 @@ - BlockGetter level = context.getLevel(); + @Override + public BlockState getStateForPlacement(BlockPlaceContext context) { +- BlockGetter level = context.getLevel(); ++ Level level = context.getLevel(); // Paper BlockPos clickedPos = context.getClickedPos(); BlockState blockState = level.getBlockState(clickedPos); - return shouldSolidify(level, clickedPos, blockState) ? this.concrete.defaultBlockState() : super.getStateForPlacement(context); diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/FlowerPotBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/FlowerPotBlock.java.patch index bf55cfd303..26f504f933 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/FlowerPotBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/FlowerPotBlock.java.patch @@ -24,7 +24,7 @@ } else { ItemStack itemStack = new ItemStack(this.potted); + // Paper start - Add PlayerFlowerPotManipulateEvent -+ org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos); ++ org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(level, pos); + org.bukkit.inventory.ItemStack pottedStack = new org.bukkit.inventory.ItemStack(org.bukkit.craftbukkit.block.CraftBlockType.minecraftToBukkit(this.potted)); + + io.papermc.paper.event.player.PlayerFlowerPotManipulateEvent event = new io.papermc.paper.event.player.PlayerFlowerPotManipulateEvent((org.bukkit.entity.Player) player.getBukkitEntity(), block, pottedStack, false); diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/NetherPortalBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/NetherPortalBlock.java.patch index d6707c3b66..cb2a17d059 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/NetherPortalBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/NetherPortalBlock.java.patch @@ -62,6 +62,7 @@ WorldBorder worldBorder = level1.getWorldBorder(); double teleportationScale = DimensionType.getTeleportationScale(level.dimensionType(), level1.dimensionType()); BlockPos blockPos = worldBorder.clampToBounds(entity.getX() * teleportationScale, entity.getY(), entity.getZ() * teleportationScale); +- return this.getExitPortal(level1, entity, pos, blockPos, flag, worldBorder); + // Paper start - Configurable portal search radius + int portalSearchRadius = level1.paperConfig().environment.portalSearchRadius; + if (entity.level().paperConfig().environment.portalSearchVanillaDimensionScaling && flag) { // flag = is going to nether @@ -76,8 +77,8 @@ + level1 = ((org.bukkit.craftbukkit.CraftWorld) event.getTo().getWorld()).getHandle(); + worldBorder = level1.getWorldBorder(); + blockPos = worldBorder.clampToBounds(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ()); ++ return this.getExitPortal(level1, entity, pos, blockPos, flag, worldBorder, event.getSearchRadius(), event.getCanCreatePortal(), event.getCreationRadius()); + // CraftBukkit end - return this.getExitPortal(level1, entity, pos, blockPos, flag, worldBorder); } } diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/PumpkinBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/PumpkinBlock.java.patch index 20e12e9b1d..281a3997a5 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/PumpkinBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/PumpkinBlock.java.patch @@ -5,7 +5,7 @@ return InteractionResult.SUCCESS; } else { + // Paper start - Add PlayerShearBlockEvent -+ 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<>()); ++ 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(level, 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 InteractionResult.PASS; diff --git a/paper-server/patches/sources/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java.patch b/paper-server/patches/sources/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java.patch index 1d206d5719..29f028e11a 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java.patch @@ -14,7 +14,7 @@ + return stack; + } + // Paper end - Configurable cartographer treasure maps -+ BlockPos blockPos = level.findNearestMapStructure(this.destination, BlockPos.containing(vec3), this.searchRadius, !serverLevel.paperConfig().environment.treasureMaps.findAlreadyDiscoveredLootTable.or(!this.skipKnownStructures)); // Paper - Configurable cartographer treasure maps ++ BlockPos blockPos = level.findNearestMapStructure(this.destination, BlockPos.containing(vec3), this.searchRadius, !level.paperConfig().environment.treasureMaps.findAlreadyDiscoveredLootTable.or(!this.skipKnownStructures)); // Paper - Configurable cartographer treasure maps if (blockPos != null) { ItemStack itemStack = MapItem.create(level, blockPos.getX(), blockPos.getZ(), this.zoom, true, true); MapItem.renderBiomePreviewMap(level, itemStack); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index b25b10c24a..98c1a4cff9 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -193,8 +193,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @Override public boolean isOnGround() { - if (this.entity instanceof AbstractArrow) { - return ((AbstractArrow) this.entity).isInGround(); + if (this.entity instanceof AbstractArrow abstractArrow) { + return abstractArrow.isInGround(); } return this.entity.onGround(); } @@ -417,7 +417,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @Override public org.bukkit.entity.Entity getPassenger() { - return this.isEmpty() ? null : this.getHandle().passengers.get(0).getBukkitEntity(); + return this.isEmpty() ? null : this.getHandle().getPassengers().getFirst().getBukkitEntity(); } @Override @@ -433,7 +433,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @Override public List getPassengers() { - return Lists.newArrayList(Lists.transform(this.getHandle().passengers, (Function) input -> input.getBukkitEntity())); + return Lists.newArrayList(Lists.transform(this.getHandle().getPassengers(), (Function) Entity::getBukkitEntity)); } @Override @@ -852,12 +852,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @Override public int getPortalCooldown() { - return this.getHandle().portalCooldown; + return this.getHandle().getPortalCooldown(); } @Override public void setPortalCooldown(int cooldown) { - this.getHandle().portalCooldown = cooldown; + this.getHandle().setPortalCooldown(cooldown);; } @Override diff --git a/paper-server/src/main/java/org/spigotmc/ActivationRange.java b/paper-server/src/main/java/org/spigotmc/ActivationRange.java index 34297951d3..607e2edb5c 100644 --- a/paper-server/src/main/java/org/spigotmc/ActivationRange.java +++ b/paper-server/src/main/java/org/spigotmc/ActivationRange.java @@ -142,9 +142,9 @@ public class ActivationRange } /** - * Checks for the activation state of all entities in this chunk. + * Tries to activate an entity. * - * @param chunk + * @param entity */ private static void activateEntity(Entity entity) { @@ -172,13 +172,13 @@ public class ActivationRange public static boolean checkEntityImmunities(Entity entity) { // quick checks. - if ( entity.wasTouchingWater || entity.getRemainingFireTicks() > 0 ) + if ( entity.isInWater() || entity.getRemainingFireTicks() > 0 ) { return true; } if ( !( entity instanceof AbstractArrow ) ) { - if ( !entity.onGround() || !entity.passengers.isEmpty() || entity.isPassenger() ) + if ( !entity.onGround() || !entity.getPassengers().isEmpty() || entity.isPassenger() ) { return true; }