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 29f907ddac..01b316831d 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 @@ -311,13 +311,13 @@ - this.setRemoved(reason); + // CraftBukkit start - add Bukkit remove cause + this.setRemoved(reason, null); -+ } -+ + } + + public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) { + this.setRemoved(entity_removalreason, cause); + // CraftBukkit end - } - ++ } ++ public void onClientRemoval() {} public void onRemoval(Entity.RemovalReason reason) {} @@ -507,13 +507,10 @@ } public boolean isFree(double offsetX, double offsetY, double offsetZ) { -@@ -747,8 +1047,30 @@ +@@ -750,6 +1050,28 @@ + } + } - if (movement.y != vec3d1.y) { - block.updateEntityMovementAfterFallOn(this.level(), this); -+ } -+ } -+ + // CraftBukkit start + if (this.horizontalCollision && this.getBukkitEntity() instanceof Vehicle) { + Vehicle vehicle = (Vehicle) this.getBukkitEntity(); @@ -532,18 +529,17 @@ + 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 +1453,21 @@ - protected SoundEvent getSwimHighSpeedSplashSound() { +@@ -1133,6 +1455,20 @@ return SoundEvents.GENERIC_SPLASH; -+ } -+ + } + + // CraftBukkit start - Add delegate methods + public SoundEvent getSwimSound0() { + return this.getSwimSound(); @@ -555,11 +551,12 @@ + + public SoundEvent getSwimHighSpeedSplashSound0() { + return this.getSwimHighSpeedSplashSound(); - } ++ } + // CraftBukkit end - ++ public void recordMovementThroughBlocks(Vec3 oldPos, Vec3 newPos) { this.movementThisTick.add(new Entity.Movement(oldPos, newPos)); + } @@ -1609,6 +1945,7 @@ this.yo = y; this.zo = d4; @@ -801,10 +798,11 @@ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT"); CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being saved"); -@@ -2080,6 +2505,66 @@ +@@ -2079,7 +2504,67 @@ + } } else { throw new IllegalStateException("Entity has invalid position"); - } ++ } + + // CraftBukkit start + // Spigot start @@ -860,7 +858,7 @@ + } + this.originWorld = originWorld; + origin = new org.bukkit.util.Vector(originTag.getDouble(0), originTag.getDouble(1), originTag.getDouble(2)); -+ } + } + + spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status + // Paper end @@ -1193,6 +1191,15 @@ return true; } +@@ -2818,7 +3437,7 @@ + public String toString() { + String s = this.level() == null ? "~NULL~" : this.level().toString(); + +- return this.removalReason != null ? String.format(Locale.ROOT, "%s['%s'/%d, l='%s', x=%.2f, y=%.2f, z=%.2f, removed=%s]", this.getClass().getSimpleName(), this.getName().getString(), this.id, s, this.getX(), this.getY(), this.getZ(), this.removalReason) : String.format(Locale.ROOT, "%s['%s'/%d, l='%s', x=%.2f, y=%.2f, z=%.2f]", this.getClass().getSimpleName(), this.getName().getString(), this.id, s, this.getX(), this.getY(), this.getZ()); ++ return this.removalReason != null ? String.format(Locale.ROOT, "%s['%s'/%d, uuid='%s', l='%s', x=%.2f, y=%.2f, z=%.2f, cpos=%s, tl=%d, v=%b, removed=%s]", this.getClass().getSimpleName(), this.getName().getString(), this.id, this.uuid, s, this.getX(), this.getY(), this.getZ(), this.chunkPosition(), this.tickCount, this.valid, this.removalReason) : String.format(Locale.ROOT, "%s['%s'/%d, uuid='%s', l='%s', x=%.2f, y=%.2f, z=%.2f, cpos=%s, tl=%d, v=%b]", this.getClass().getSimpleName(), this.getName().getString(), this.id, this.uuid, s, this.getX(), this.getY(), this.getZ(), this.chunkPosition(), this.tickCount, this.valid); // Paper - add more info + } + + public final boolean isInvulnerableToBase(DamageSource damageSource) { @@ -2852,6 +3471,26 @@ if (world instanceof ServerLevel worldserver) { @@ -1254,12 +1261,10 @@ leashable.removeLeash(); } -@@ -3004,7 +3648,21 @@ - - public Vec3 getRelativePortalPosition(Direction.Axis portalAxis, BlockUtil.FoundRectangle portalRect) { +@@ -3006,6 +3650,20 @@ return PortalShape.getRelativePosition(portalRect, portalAxis, this.position(), this.getDimensions(this.getPose())); -+ } -+ + } + + // CraftBukkit start + public CraftPortalEvent callPortalEvent(Entity entity, Location exit, PlayerTeleportEvent.TeleportCause cause, int searchRadius, int creationRadius) { + org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity(); @@ -1271,11 +1276,12 @@ + return null; + } + return new CraftPortalEvent(event); - } ++ } + // CraftBukkit end - ++ public boolean canUsePortal(boolean allowVehicles) { return (allowVehicles || !this.isPassenger()) && this.isAlive(); + } @@ -3134,10 +3792,16 @@ return (Boolean) this.entityData.get(Entity.DATA_CUSTOM_NAME_VISIBLE); } @@ -1382,11 +1388,10 @@ return new Vec3(this.getX(), this.getBoundingBox().maxY, this.getZ()); } -@@ -3488,9 +4171,38 @@ - public int getFireImmuneTicks() { +@@ -3489,8 +4172,37 @@ return 1; } -+ + + // CraftBukkit start + private final CommandSource commandSource = new CommandSource() { + @@ -1415,7 +1420,7 @@ + } + }; + // CraftBukkit end - ++ public CommandSourceStack createCommandSourceStackForNameResolution(ServerLevel world) { - return new CommandSourceStack(CommandSource.NULL, this.position(), this.getRotationVector(), world, 0, this.getName().getString(), this.getDisplayName(), world.getServer(), this); + return new CommandSourceStack(this.commandSource, this.position(), this.getRotationVector(), world, 0, this.getName().getString(), this.getDisplayName(), world.getServer(), this); // CraftBukkit