diff --git a/paper-server/patches/sources/net/minecraft/world/entity/Entity.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/Entity.java.patch index d55dca6e51..82672cbfec 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/Entity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/Entity.java.patch @@ -61,7 +61,7 @@ +// CraftBukkit end public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, ScoreHolder { - ++ + // CraftBukkit start + private static final int CURRENT_LEVEL = 2; + static boolean isLevelAtLeast(CompoundTag tag, int level) { @@ -76,7 +76,7 @@ + } + return this.bukkitEntity; + } -+ + + // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir() + public int getDefaultMaxAirSupply() { + return Entity.TOTAL_AIR_SUPPLY; @@ -125,7 +125,7 @@ + private org.bukkit.util.Vector origin; + @javax.annotation.Nullable + private UUID originWorld; - ++ + public void setOrigin(@javax.annotation.Nonnull Location location) { + this.origin = location.toVector(); + this.originWorld = location.getWorld().getUID(); @@ -144,7 +144,7 @@ + public float getBukkitYaw() { + return this.yRot; + } -+ + + public boolean isChunkLoaded() { + return this.level.hasChunk((int) Math.floor(this.getX()) >> 4, (int) Math.floor(this.getZ()) >> 4); + } @@ -340,7 +340,20 @@ } } -@@ -568,15 +756,32 @@ +@@ -537,7 +725,11 @@ + } + + public void checkBelowWorld() { +- if (this.getY() < (double) (this.level().getMinY() - 64)) { ++ // Paper start - Configurable nether ceiling damage ++ if (this.getY() < (double) (this.level.getMinY() - 64) || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER ++ && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> this.getY() >= v) ++ && (!(this instanceof Player player) || !player.getAbilities().invulnerable))) { ++ // Paper end - Configurable nether ceiling damage + this.onBelowWorld(); + } + +@@ -568,15 +760,32 @@ public void lavaHurt() { if (!this.fireImmune()) { @@ -375,7 +388,7 @@ } } -@@ -587,9 +792,25 @@ +@@ -587,9 +796,25 @@ } public final void igniteForSeconds(float seconds) { @@ -402,7 +415,7 @@ public void igniteForTicks(int ticks) { if (this.remainingFireTicks < ticks) { this.setRemainingFireTicks(ticks); -@@ -610,7 +831,7 @@ +@@ -610,7 +835,7 @@ } protected void onBelowWorld() { @@ -411,10 +424,13 @@ } public boolean isFree(double offsetX, double offsetY, double offsetZ) { -@@ -750,6 +971,28 @@ - } - } +@@ -747,8 +972,30 @@ + if (movement.y != vec3d1.y) { + block.updateEntityMovementAfterFallOn(this.level(), this); ++ } ++ } ++ + // CraftBukkit start + if (this.horizontalCollision && this.getBukkitEntity() instanceof Vehicle) { + Vehicle vehicle = (Vehicle) this.getBukkitEntity(); @@ -433,14 +449,13 @@ + if (!bl.getType().isAir()) { + VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, bl); + this.level.getCraftServer().getPluginManager().callEvent(event); -+ } -+ } + } + } + // CraftBukkit end -+ + if (!this.level().isClientSide() || this.isControlledByLocalInstance()) { Entity.MovementEmission entity_movementemission = this.getMovementEmission(); - -@@ -1131,7 +1374,21 @@ +@@ -1131,7 +1378,21 @@ protected SoundEvent getSwimHighSpeedSplashSound() { return SoundEvents.GENERIC_SPLASH; @@ -462,7 +477,7 @@ public void recordMovementThroughBlocks(Vec3 oldPos, Vec3 newPos) { this.movementThisTick.add(new Entity.Movement(oldPos, newPos)); -@@ -1609,6 +1866,7 @@ +@@ -1609,6 +1870,7 @@ this.yo = y; this.zo = d4; this.setPos(d3, y, d4); @@ -470,21 +485,20 @@ } public void moveTo(Vec3 pos) { -@@ -1859,7 +2117,13 @@ - - public boolean isPushable() { +@@ -1861,6 +2123,12 @@ return false; -+ } -+ + } + + // CraftBukkit start - collidable API + public boolean canCollideWithBukkit(Entity entity) { + return this.isPushable(); - } ++ } + // CraftBukkit end - ++ public void awardKillScore(Entity entityKilled, DamageSource damageSource) { if (entityKilled instanceof ServerPlayer) { -@@ -1889,16 +2153,22 @@ + CriteriaTriggers.ENTITY_KILLED_PLAYER.trigger((ServerPlayer) entityKilled, this, damageSource); +@@ -1889,16 +2157,22 @@ } public boolean saveAsPassenger(CompoundTag nbt) { @@ -510,7 +524,7 @@ return true; } } -@@ -1909,54 +2179,98 @@ +@@ -1909,54 +2183,98 @@ } public CompoundTag saveWithoutId(CompoundTag nbt) { @@ -629,7 +643,7 @@ } ListTag nbttaglist; -@@ -1972,10 +2286,10 @@ +@@ -1972,10 +2290,10 @@ nbttaglist.add(StringTag.valueOf(s)); } @@ -642,7 +656,7 @@ if (this.isVehicle()) { nbttaglist = new ListTag(); iterator = this.getPassengers().iterator(); -@@ -1984,17 +2298,31 @@ +@@ -1984,17 +2302,31 @@ Entity entity = (Entity) iterator.next(); CompoundTag nbttagcompound1 = new CompoundTag(); @@ -677,7 +691,7 @@ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT"); CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being saved"); -@@ -2080,6 +2408,64 @@ +@@ -2080,6 +2412,64 @@ } else { throw new IllegalStateException("Entity has invalid position"); } @@ -742,7 +756,7 @@ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT"); CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being loaded"); -@@ -2101,6 +2487,12 @@ +@@ -2101,6 +2491,12 @@ return entitytypes.canSerialize() && minecraftkey != null ? minecraftkey.toString() : null; } @@ -755,7 +769,7 @@ protected abstract void readAdditionalSaveData(CompoundTag nbt); protected abstract void addAdditionalSaveData(CompoundTag nbt); -@@ -2153,9 +2545,22 @@ +@@ -2153,9 +2549,22 @@ if (stack.isEmpty()) { return null; } else { @@ -778,7 +792,7 @@ world.addFreshEntity(entityitem); return entityitem; } -@@ -2184,6 +2589,12 @@ +@@ -2184,6 +2593,12 @@ if (this.isAlive() && this instanceof Leashable leashable) { if (leashable.getLeashHolder() == player) { if (!this.level().isClientSide()) { @@ -791,7 +805,7 @@ if (player.hasInfiniteMaterials()) { leashable.removeLeash(); } else { -@@ -2200,6 +2611,13 @@ +@@ -2200,6 +2615,13 @@ if (itemstack.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) { if (!this.level().isClientSide()) { @@ -805,7 +819,7 @@ leashable.setLeashedTo(player, true); } -@@ -2265,7 +2683,7 @@ +@@ -2265,7 +2687,7 @@ } public boolean showVehicleHealth() { @@ -814,7 +828,7 @@ } public boolean startRiding(Entity entity, boolean force) { -@@ -2273,7 +2691,7 @@ +@@ -2273,7 +2695,7 @@ return false; } else if (!entity.couldAcceptPassenger()) { return false; @@ -823,7 +837,7 @@ return false; } else { for (Entity entity1 = entity; entity1.vehicle != null; entity1 = entity1.vehicle) { -@@ -2285,11 +2703,32 @@ +@@ -2285,11 +2707,32 @@ if (!force && (!this.canRide(entity) || !entity.canAddPassenger(this))) { return false; } else { @@ -857,7 +871,7 @@ this.vehicle = entity; this.vehicle.addPassenger(this); entity.getIndirectPassengersStream().filter((entity2) -> { -@@ -2318,7 +2757,7 @@ +@@ -2318,7 +2761,7 @@ Entity entity = this.vehicle; this.vehicle = null; @@ -866,7 +880,7 @@ } } -@@ -2349,21 +2788,50 @@ +@@ -2349,21 +2792,50 @@ } } @@ -923,7 +937,7 @@ } protected boolean canAddPassenger(Entity passenger) { -@@ -2464,7 +2932,7 @@ +@@ -2464,7 +2936,7 @@ if (teleporttransition != null) { ServerLevel worldserver1 = teleporttransition.newLevel(); @@ -932,7 +946,7 @@ this.teleport(teleporttransition); } } -@@ -2547,7 +3015,7 @@ +@@ -2547,7 +3019,7 @@ } public boolean isCrouching() { @@ -941,7 +955,7 @@ } public boolean isSprinting() { -@@ -2563,7 +3031,7 @@ +@@ -2563,7 +3035,7 @@ } public boolean isVisuallySwimming() { @@ -950,7 +964,7 @@ } public boolean isVisuallyCrawling() { -@@ -2571,6 +3039,13 @@ +@@ -2571,6 +3043,13 @@ } public void setSwimming(boolean swimming) { @@ -964,7 +978,7 @@ this.setSharedFlag(4, swimming); } -@@ -2624,8 +3099,12 @@ +@@ -2624,8 +3103,12 @@ return this.getTeam() != null ? this.getTeam().isAlliedTo(team) : false; } @@ -978,7 +992,7 @@ } public boolean getSharedFlag(int index) { -@@ -2644,7 +3123,7 @@ +@@ -2644,7 +3127,7 @@ } public int getMaxAirSupply() { @@ -987,7 +1001,7 @@ } public int getAirSupply() { -@@ -2652,7 +3131,18 @@ +@@ -2652,7 +3135,18 @@ } public void setAirSupply(int air) { @@ -1007,7 +1021,7 @@ } public int getTicksFrozen() { -@@ -2679,11 +3169,40 @@ +@@ -2679,11 +3173,40 @@ public void thunderHit(ServerLevel world, LightningBolt lightning) { this.setRemainingFireTicks(this.remainingFireTicks + 1); @@ -1050,7 +1064,7 @@ } public void onAboveBubbleCol(boolean drag) { -@@ -2713,7 +3232,7 @@ +@@ -2713,7 +3236,7 @@ this.resetFallDistance(); } @@ -1059,7 +1073,7 @@ return true; } -@@ -2852,6 +3371,18 @@ +@@ -2852,6 +3375,18 @@ if (world instanceof ServerLevel worldserver) { if (!this.isRemoved()) { @@ -1078,7 +1092,7 @@ ServerLevel worldserver1 = teleportTarget.newLevel(); boolean flag = worldserver1.dimension() != worldserver.dimension(); -@@ -2920,8 +3451,12 @@ +@@ -2920,8 +3455,12 @@ } else { entity.restoreFrom(this); this.removeAfterChangingDimensions(); @@ -1092,7 +1106,7 @@ Iterator iterator1 = list1.iterator(); while (iterator1.hasNext()) { -@@ -2947,7 +3482,7 @@ +@@ -2947,7 +3486,7 @@ } private void sendTeleportTransitionToRidingPlayers(TeleportTransition teleportTarget) { @@ -1101,7 +1115,7 @@ Iterator iterator = this.getIndirectPassengers().iterator(); while (iterator.hasNext()) { -@@ -2995,8 +3530,9 @@ +@@ -2995,8 +3534,9 @@ } protected void removeAfterChangingDimensions() { @@ -1112,7 +1126,7 @@ leashable.removeLeash(); } -@@ -3006,6 +3542,20 @@ +@@ -3006,6 +3546,20 @@ return PortalShape.getRelativePosition(portalRect, portalAxis, this.position(), this.getDimensions(this.getPose())); } @@ -1133,7 +1147,7 @@ public boolean canUsePortal(boolean allowVehicles) { return (allowVehicles || !this.isPassenger()) && this.isAlive(); } -@@ -3134,10 +3684,16 @@ +@@ -3134,10 +3688,16 @@ return (Boolean) this.entityData.get(Entity.DATA_CUSTOM_NAME_VISIBLE); } @@ -1153,7 +1167,7 @@ return entity != null; } -@@ -3187,7 +3743,7 @@ +@@ -3187,7 +3747,7 @@ /** @deprecated */ @Deprecated protected void fixupDimensions() { @@ -1162,7 +1176,7 @@ EntityDimensions entitysize = this.getDimensions(entitypose); this.dimensions = entitysize; -@@ -3196,7 +3752,7 @@ +@@ -3196,7 +3756,7 @@ public void refreshDimensions() { EntityDimensions entitysize = this.dimensions; @@ -1171,7 +1185,7 @@ EntityDimensions entitysize1 = this.getDimensions(entitypose); this.dimensions = entitysize1; -@@ -3258,10 +3814,29 @@ +@@ -3258,10 +3818,29 @@ } public final void setBoundingBox(AABB boundingBox) { @@ -1203,7 +1217,7 @@ return this.getDimensions(pose).eyeHeight(); } -@@ -3335,7 +3910,7 @@ +@@ -3335,7 +3914,7 @@ } @Nullable @@ -1212,7 +1226,7 @@ return null; } -@@ -3435,7 +4010,7 @@ +@@ -3435,7 +4014,7 @@ } public boolean isControlledByLocalInstance() { @@ -1221,7 +1235,7 @@ if (entityliving instanceof Player entityhuman) { return entityhuman.isLocalPlayer(); -@@ -3445,7 +4020,7 @@ +@@ -3445,7 +4024,7 @@ } public boolean isControlledByClient() { @@ -1230,7 +1244,7 @@ return entityliving != null && entityliving.isControlledByClient(); } -@@ -3463,7 +4038,7 @@ +@@ -3463,7 +4042,7 @@ return new Vec3((double) f1 * d2 / (double) f3, 0.0D, (double) f2 * d2 / (double) f3); } @@ -1239,11 +1253,10 @@ return new Vec3(this.getX(), this.getBoundingBox().maxY, this.getZ()); } -@@ -3488,9 +4063,38 @@ - public int getFireImmuneTicks() { +@@ -3489,8 +4068,37 @@ return 1; } -+ + + // CraftBukkit start + private final CommandSource commandSource = new CommandSource() { + @@ -1255,7 +1268,7 @@ + public CommandSender getBukkitSender(CommandSourceStack wrapper) { + return Entity.this.getBukkitEntity(); + } - ++ + @Override + public boolean acceptsSuccess() { + return ((ServerLevel) Entity.this.level()).getGameRules().getBoolean(GameRules.RULE_SENDCOMMANDFEEDBACK); @@ -1279,7 +1292,7 @@ } public void lookAt(EntityAnchorArgument.Anchor anchorPoint, Vec3 target) { -@@ -3551,6 +4155,11 @@ +@@ -3551,6 +4159,11 @@ vec3d = vec3d.add(vec3d1); ++k1; } @@ -1291,7 +1304,7 @@ } } } -@@ -3613,7 +4222,7 @@ +@@ -3613,7 +4226,7 @@ return new ClientboundAddEntityPacket(this, entityTrackerEntry); } @@ -1300,7 +1313,7 @@ return this.type.getDimensions(); } -@@ -3818,8 +4427,16 @@ +@@ -3818,8 +4431,16 @@ @Override public final void setRemoved(Entity.RemovalReason reason) { @@ -1318,7 +1331,7 @@ } if (this.removalReason.shouldDestroy()) { -@@ -3827,8 +4444,8 @@ +@@ -3827,8 +4448,8 @@ } this.getPassengers().forEach(Entity::stopRiding); @@ -1329,7 +1342,7 @@ } public void unsetRemoved() { -@@ -3887,7 +4504,7 @@ +@@ -3887,7 +4508,7 @@ } public Vec3 getKnownMovement() { diff --git a/paper-server/patches/sources/net/minecraft/world/level/portal/PortalForcer.java.patch b/paper-server/patches/sources/net/minecraft/world/level/portal/PortalForcer.java.patch index 15875d2c0f..63a46778ba 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/portal/PortalForcer.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/portal/PortalForcer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/portal/PortalForcer.java +++ b/net/minecraft/world/level/portal/PortalForcer.java -@@ -43,24 +43,36 @@ +@@ -43,33 +43,50 @@ } public Optional findClosestPortalPosition(BlockPos pos, boolean destIsNether, WorldBorder worldBorder) { @@ -25,7 +25,7 @@ - Objects.requireNonNull(worldBorder); - return stream.filter(worldBorder::isWithinBounds).filter((blockposition1) -> { + Objects.requireNonNull(worldborder); -+ return stream.filter(worldborder::isWithinBounds).filter((blockposition1) -> { ++ return stream.filter(worldborder::isWithinBounds).filter(pos -> !(this.level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> pos.getY() >= v))).filter((blockposition1) -> { // Paper - Configurable nether ceiling damage return this.level.getBlockState(blockposition1).hasProperty(BlockStateProperties.HORIZONTAL_AXIS); - }).min(Comparator.comparingDouble((blockposition1) -> { - return blockposition1.distSqr(pos); @@ -46,9 +46,14 @@ double d0 = -1.0D; BlockPos blockposition1 = null; double d1 = -1.0D; -@@ -68,8 +80,8 @@ + BlockPos blockposition2 = null; WorldBorder worldborder = this.level.getWorldBorder(); int i = Math.min(this.level.getMaxY(), this.level.getMinY() + this.level.getLogicalHeight() - 1); ++ // Paper start - Configurable nether ceiling damage; make sure the max height doesn't exceed the void damage height ++ if (this.level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.enabled()) { ++ i = Math.min(i, this.level.paperConfig().environment.netherCeilingVoidDamageHeight.intValue() - 1); ++ } ++ // Paper end - Configurable nether ceiling damage boolean flag = true; - BlockPos.MutableBlockPos blockposition_mutableblockposition = pos.mutable(); - Iterator iterator = BlockPos.spiralAround(pos, 16, Direction.EAST, Direction.SOUTH).iterator(); @@ -57,7 +62,7 @@ int j; int k; -@@ -95,7 +107,7 @@ +@@ -95,7 +112,7 @@ if (i1 <= 0 || i1 >= 3) { blockposition_mutableblockposition1.setY(k); if (this.canHostFrame(blockposition_mutableblockposition1, blockposition_mutableblockposition, enumdirection, 0)) { @@ -66,7 +71,7 @@ if (this.canHostFrame(blockposition_mutableblockposition1, blockposition_mutableblockposition, enumdirection, -1) && this.canHostFrame(blockposition_mutableblockposition1, blockposition_mutableblockposition, enumdirection, 1) && (d0 == -1.0D || d0 > d2)) { d0 = d2; -@@ -122,6 +134,7 @@ +@@ -122,6 +139,7 @@ int j1; int k1; @@ -74,7 +79,7 @@ if (d0 == -1.0D) { j1 = Math.max(this.level.getMinY() - -1, 70); k1 = i - 9; -@@ -129,7 +142,7 @@ +@@ -129,7 +147,7 @@ return Optional.empty(); } @@ -83,7 +88,7 @@ blockposition1 = worldborder.clampToBounds(blockposition1); Direction enumdirection1 = enumdirection.getClockWise(); -@@ -139,7 +152,7 @@ +@@ -139,7 +157,7 @@ BlockState iblockdata = i1 < 0 ? Blocks.OBSIDIAN.defaultBlockState() : Blocks.AIR.defaultBlockState(); blockposition_mutableblockposition.setWithOffset(blockposition1, l * enumdirection.getStepX() + k * enumdirection1.getStepX(), i1, l * enumdirection.getStepZ() + k * enumdirection1.getStepZ()); @@ -92,7 +97,7 @@ } } } -@@ -149,20 +162,30 @@ +@@ -149,20 +167,30 @@ for (k1 = -1; k1 < 4; ++k1) { if (j1 == -1 || j1 == 2 || k1 == -1 || k1 == 3) { blockposition_mutableblockposition.setWithOffset(blockposition1, j1 * enumdirection.getStepX(), k1, j1 * enumdirection.getStepZ());