diff --git a/patches/server/Add-PlayerSetSpawnEvent.patch b/patches/server/Add-PlayerSetSpawnEvent.patch index 8661c41c98..0444b5edbf 100644 --- a/patches/server/Add-PlayerSetSpawnEvent.patch +++ b/patches/server/Add-PlayerSetSpawnEvent.patch @@ -26,13 +26,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start + if (actualTargets.isEmpty()) { + return 0; -+ } else { -+ targets = actualTargets; + } + // Paper end String s = resourcekey.location().toString(); +- if (targets.size() == 1) { ++ if (actualTargets.size() == 1) { // Paper + source.sendSuccess(() -> { +- return Component.translatable("commands.spawnpoint.success.single", pos.getX(), pos.getY(), pos.getZ(), angle, s, ((ServerPlayer) targets.iterator().next()).getDisplayName()); ++ return Component.translatable("commands.spawnpoint.success.single", pos.getX(), pos.getY(), pos.getZ(), angle, s, ((ServerPlayer) actualTargets.iterator().next()).getDisplayName()); // Paper + }, true); + } else { + source.sendSuccess(() -> { +- return Component.translatable("commands.spawnpoint.success.multiple", pos.getX(), pos.getY(), pos.getZ(), angle, s, targets.size()); ++ return Component.translatable("commands.spawnpoint.success.multiple", pos.getX(), pos.getY(), pos.getZ(), angle, s, actualTargets.size()); // Paper + }, true); + } + +- return targets.size(); ++ return actualTargets.size(); // Paper + } + } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/patches/server/Add-config-for-mobs-immune-to-default-effects.patch b/patches/server/Add-config-for-mobs-immune-to-default-effects.patch index 1026c9de6c..ef57e95dd5 100644 --- a/patches/server/Add-config-for-mobs-immune-to-default-effects.patch +++ b/patches/server/Add-config-for-mobs-immune-to-default-effects.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 MobEffect mobeffectlist = effect.getEffect(); - if (mobeffectlist == MobEffects.REGENERATION || mobeffectlist == MobEffects.POISON) { -+ if ((mobeffectlist == MobEffects.REGENERATION || mobeffectlist == MobEffects.POISON) && this.level.paperConfig().entities.mobEffects.undeadImmuneToCertainEffects) { // Paper ++ if ((mobeffectlist == MobEffects.REGENERATION || mobeffectlist == MobEffects.POISON) && this.level().paperConfig().entities.mobEffects.undeadImmuneToCertainEffects) { // Paper return false; } } diff --git a/patches/server/Add-option-to-fix-items-merging-through-walls.patch b/patches/server/Add-option-to-fix-items-merging-through-walls.patch index d6ea3694f1..7bff99b5e6 100644 --- a/patches/server/Add-option-to-fix-items-merging-through-walls.patch +++ b/patches/server/Add-option-to-fix-items-merging-through-walls.patch @@ -13,10 +13,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (entityitem.isMergable()) { + // Paper Start - Fix items merging through walls -+ if (this.level.paperConfig().fixes.fixItemsMergingThroughWalls) { ++ if (this.level().paperConfig().fixes.fixItemsMergingThroughWalls) { + net.minecraft.world.level.ClipContext rayTrace = new net.minecraft.world.level.ClipContext(this.position(), entityitem.position(), + net.minecraft.world.level.ClipContext.Block.COLLIDER, net.minecraft.world.level.ClipContext.Fluid.NONE, this); -+ net.minecraft.world.phys.BlockHitResult rayTraceResult = level.clip(rayTrace); ++ net.minecraft.world.phys.BlockHitResult rayTraceResult = this.level().clip(rayTrace); + if (rayTraceResult.getType() == net.minecraft.world.phys.HitResult.Type.BLOCK) continue; + } + // Paper End diff --git a/patches/server/Don-t-apply-cramming-damage-to-players.patch b/patches/server/Don-t-apply-cramming-damage-to-players.patch index cc1933ea90..b019743d40 100644 --- a/patches/server/Don-t-apply-cramming-damage-to-players.patch +++ b/patches/server/Don-t-apply-cramming-damage-to-players.patch @@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public boolean isInvulnerableTo(DamageSource damageSource) { - return super.isInvulnerableTo(damageSource) || this.isChangingDimension(); -+ return super.isInvulnerableTo(damageSource) || this.isChangingDimension() || !level.paperConfig().collisions.allowPlayerCrammingDamage && damageSource == damageSources().cramming(); // Paper - disable player cramming ++ return super.isInvulnerableTo(damageSource) || this.isChangingDimension() || !this.level().paperConfig().collisions.allowPlayerCrammingDamage && damageSource == damageSources().cramming(); // Paper - disable player cramming } @Override diff --git a/patches/server/Hide-unnecessary-itemmeta-from-clients.patch b/patches/server/Hide-unnecessary-itemmeta-from-clients.patch index 88593f8949..62dbd0516c 100644 --- a/patches/server/Hide-unnecessary-itemmeta-from-clients.patch +++ b/patches/server/Hide-unnecessary-itemmeta-from-clients.patch @@ -56,7 +56,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + final ItemStack copy = copyItemStack ? itemStack.copy() : itemStack; -+ if (level.paperConfig().anticheat.obfuscation.items.hideDurability) { ++ if (this.level().paperConfig().anticheat.obfuscation.items.hideDurability) { + // Only show damage values for elytra's, since they show a different texture when broken. + if (!copy.is(Items.ELYTRA) || copy.getDamageValue() < copy.getMaxDamage() - 1) { + copy.setDamageValue(0); @@ -64,7 +64,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + final CompoundTag tag = copy.getTag(); -+ if (level.paperConfig().anticheat.obfuscation.items.hideItemmeta) { ++ if (this.level().paperConfig().anticheat.obfuscation.items.hideItemmeta) { + // Some resource packs show different textures when there is more than one item. Since this shouldn't provide a big advantage, + // we'll tell the client if there's one or (more than) two items. + copy.setCount(copy.getCount() > 1 ? 2 : 1); @@ -99,7 +99,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ if (level.paperConfig().anticheat.obfuscation.items.hideItemmetaWithVisualEffects && tag != null) { ++ if (this.level().paperConfig().anticheat.obfuscation.items.hideItemmetaWithVisualEffects && tag != null) { + // Lodestone compasses + tag.remove("LodestonePos"); + if (tag.contains("LodestoneDimension")) { diff --git a/patches/server/Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch b/patches/server/Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch index 8a18c4b10c..bdc5b5aa6b 100644 --- a/patches/server/Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch +++ b/patches/server/Highly-optimise-single-and-multi-AABB-VoxelShapes-an.patch @@ -1219,14 +1219,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { - this.tryCheckInsideBlocks(); float f = this.getBlockSpeedFactor(); -- this.setDeltaMovement(this.getDeltaMovement().multiply((double) f, 1.0D, (double) f)); + this.setDeltaMovement(this.getDeltaMovement().multiply((double) f, 1.0D, (double) f)); - if (this.level().getBlockStatesIfLoaded(this.getBoundingBox().deflate(1.0E-6D)).noneMatch((iblockdata2) -> { - return iblockdata2.is(BlockTags.FIRE) || iblockdata2.is(Blocks.LAVA); - })) { -+ this.setDeltaMovement(this.getDeltaMovement().multiply((double) f2, 1.0D, (double) f2)); + // Paper start - remove expensive streams from here + boolean noneMatch = true; + AABB fireSearchBox = this.getBoundingBox().deflate(1.0E-6D); diff --git a/patches/server/Pass-ServerLevel-for-gamerule-callbacks.patch b/patches/server/Pass-ServerLevel-for-gamerule-callbacks.patch index 27a1f1f683..ae378d4365 100644 --- a/patches/server/Pass-ServerLevel-for-gamerule-callbacks.patch +++ b/patches/server/Pass-ServerLevel-for-gamerule-callbacks.patch @@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.server.isHardcore()) { this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper - ((GameRules.BooleanValue) this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.server); -+ ((GameRules.BooleanValue) this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.player.getLevel()); // Paper ++ ((GameRules.BooleanValue) this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.player.serverLevel()); // Paper } } break; diff --git a/patches/server/Prevent-tile-entity-copies-loading-chunks.patch b/patches/server/Prevent-tile-entity-copies-loading-chunks.patch index 5f09774cfc..5a03355a4f 100644 --- a/patches/server/Prevent-tile-entity-copies-loading-chunks.patch +++ b/patches/server/Prevent-tile-entity-copies-loading-chunks.patch @@ -15,8 +15,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - BlockEntity tileentity = this.player.level().getBlockEntity(blockposition); + // Paper start + BlockEntity tileentity = null; -+ if (this.player.distanceToSqr(blockposition.getX(), blockposition.getY(), blockposition.getZ()) < 32 * 32 && this.player.getLevel().isLoadedAndInBounds(blockposition)) { -+ tileentity = this.player.level.getBlockEntity(blockposition); ++ if (this.player.distanceToSqr(blockposition.getX(), blockposition.getY(), blockposition.getZ()) < 32 * 32 && this.player.serverLevel().isLoadedAndInBounds(blockposition)) { ++ tileentity = this.player.level().getBlockEntity(blockposition); + } + // Paper end diff --git a/patches/server/check-global-player-list-where-appropriate.patch b/patches/server/check-global-player-list-where-appropriate.patch index f4eafbba82..a84c8661b0 100644 --- a/patches/server/check-global-player-list-where-appropriate.patch +++ b/patches/server/check-global-player-list-where-appropriate.patch @@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void onItemPickup(ItemEntity item) { - Entity entity = item.getOwner(); -+ Entity entity = item.thrower != null ? this.level.getGlobalPlayerByUUID(item.thrower) : null; // Paper - check all players ++ Entity entity = item.thrower != null ? this.level().getGlobalPlayerByUUID(item.thrower) : null; // Paper - check all players if (entity instanceof ServerPlayer) { CriteriaTriggers.THROWN_ITEM_PICKED_UP_BY_ENTITY.trigger((ServerPlayer) entity, item.getItem(), this); diff --git a/patches/server/fix-player-loottables-running-when-mob-loot-gamerule.patch b/patches/server/fix-player-loottables-running-when-mob-loot-gamerule.patch index 38bbe7430d..f631bf1a41 100644 --- a/patches/server/fix-player-loottables-running-when-mob-loot-gamerule.patch +++ b/patches/server/fix-player-loottables-running-when-mob-loot-gamerule.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } } -+ if (this.shouldDropLoot() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { // Paper - preserve this check from vanilla ++ if (this.shouldDropLoot() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { // Paper - preserve this check from vanilla // SPIGOT-5071: manually add player loot tables (SPIGOT-5195 - ignores keepInventory rule) this.dropFromLootTable(damageSource, this.lastHurtByPlayerTime > 0); for (org.bukkit.inventory.ItemStack item : this.drops) {