|
27 | 27 | private EntityDimensions dimensions;
|
28 | 28 | private float eyeHeight;
|
29 | 29 | public boolean isInPowderSnow;
|
30 |
| -@@ -525,6 +_,23 @@ |
| 30 | +@@ -521,6 +_,23 @@ |
31 | 31 | }
|
32 | 32 | }
|
33 | 33 | // Paper end - optimise entity tracker
|
|
51 | 51 |
|
52 | 52 | public Entity(EntityType<?> entityType, Level level) {
|
53 | 53 | this.type = entityType;
|
54 |
| -@@ -655,8 +_,7 @@ |
| 54 | +@@ -651,8 +_,7 @@ |
55 | 55 | // due to interactions on the client.
|
56 | 56 | public void resendPossiblyDesyncedEntityData(net.minecraft.server.level.ServerPlayer player) {
|
57 | 57 | if (player.getBukkitEntity().canSee(this.getBukkitEntity())) {
|
|
61 | 61 | if (tracker == null) {
|
62 | 62 | return;
|
63 | 63 | }
|
64 |
| -@@ -823,7 +_,7 @@ |
| 64 | +@@ -819,7 +_,7 @@ |
65 | 65 | public void postTick() {
|
66 | 66 | // No clean way to break out of ticking once the entity has been copied to a new world, so instead we move the portalling later in the tick cycle
|
67 | 67 | if (!(this instanceof ServerPlayer) && this.isAlive()) { // Paper - don't attempt to teleport dead entities
|
|
70 | 70 | }
|
71 | 71 | }
|
72 | 72 | // CraftBukkit end
|
73 |
| -@@ -841,7 +_,7 @@ |
| 73 | +@@ -837,7 +_,7 @@ |
74 | 74 | this.boardingCooldown--;
|
75 | 75 | }
|
76 | 76 |
|
|
79 | 79 | if (this.canSpawnSprintParticle()) {
|
80 | 80 | this.spawnSprintParticle();
|
81 | 81 | }
|
82 |
| -@@ -1104,8 +_,8 @@ |
| 82 | +@@ -1100,8 +_,8 @@ |
83 | 83 | } else {
|
84 | 84 | this.wasOnFire = this.isOnFire();
|
85 | 85 | if (type == MoverType.PISTON) {
|
|
90 | 90 | movement = this.limitPistonMovement(movement);
|
91 | 91 | if (movement.equals(Vec3.ZERO)) {
|
92 | 92 | return;
|
93 |
| -@@ -1404,7 +_,7 @@ |
| 93 | +@@ -1400,7 +_,7 @@ |
94 | 94 | if (pos.lengthSqr() <= 1.0E-7) {
|
95 | 95 | return pos;
|
96 | 96 | } else {
|
|
99 | 99 | if (gameTime != this.pistonDeltasGameTime) {
|
100 | 100 | Arrays.fill(this.pistonDeltas, 0.0);
|
101 | 101 | this.pistonDeltasGameTime = gameTime;
|
102 |
| -@@ -3038,6 +_,7 @@ |
| 102 | +@@ -3034,6 +_,7 @@ |
103 | 103 | }
|
104 | 104 |
|
105 | 105 | if (force || this.canRide(vehicle) && vehicle.canAddPassenger(this)) {
|
106 | 106 | + if (this.valid) { // Folia - region threading - suppress entire event logic during worldgen
|
107 | 107 | // CraftBukkit start
|
108 | 108 | if (vehicle.getBukkitEntity() instanceof org.bukkit.entity.Vehicle && this.getBukkitEntity() instanceof org.bukkit.entity.LivingEntity) {
|
109 | 109 | org.bukkit.event.vehicle.VehicleEnterEvent event = new org.bukkit.event.vehicle.VehicleEnterEvent((org.bukkit.entity.Vehicle) vehicle.getBukkitEntity(), this.getBukkitEntity());
|
110 |
| -@@ -3059,6 +_,7 @@ |
| 110 | +@@ -3055,6 +_,7 @@ |
111 | 111 | return false;
|
112 | 112 | }
|
113 | 113 | // CraftBukkit end
|
114 | 114 | + } // Folia - region threading - suppress entire event logic during worldgen
|
115 | 115 | if (this.isPassenger()) {
|
116 | 116 | this.stopRiding();
|
117 | 117 | }
|
118 |
| -@@ -3126,7 +_,7 @@ |
| 118 | +@@ -3122,7 +_,7 @@ |
119 | 119 | this.passengers = ImmutableList.copyOf(list);
|
120 | 120 | }
|
121 | 121 |
|
|
124 | 124 | }
|
125 | 125 | }
|
126 | 126 |
|
127 |
| -@@ -3140,6 +_,7 @@ |
| 127 | +@@ -3136,6 +_,7 @@ |
128 | 128 | throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
|
129 | 129 | } else {
|
130 | 130 | // CraftBukkit start
|
131 | 131 | + if (this.valid) { // Folia - region threading - suppress entire event logic during worldgen
|
132 | 132 | org.bukkit.craftbukkit.entity.CraftEntity craft = (org.bukkit.craftbukkit.entity.CraftEntity) passenger.getBukkitEntity().getVehicle();
|
133 | 133 | Entity orig = craft == null ? null : craft.getHandle();
|
134 | 134 | if (this.getBukkitEntity() instanceof org.bukkit.entity.Vehicle && passenger.getBukkitEntity() instanceof org.bukkit.entity.LivingEntity) {
|
135 |
| -@@ -3167,6 +_,7 @@ |
| 135 | +@@ -3163,6 +_,7 @@ |
136 | 136 | return false;
|
137 | 137 | }
|
138 | 138 | // CraftBukkit end
|
139 | 139 | + } // Folia - region threading - suppress entire event logic during worldgen
|
140 | 140 | if (this.passengers.size() == 1 && this.passengers.get(0) == passenger) {
|
141 | 141 | this.passengers = ImmutableList.of();
|
142 | 142 | } else {
|
143 |
| -@@ -3174,7 +_,7 @@ |
| 143 | +@@ -3170,7 +_,7 @@ |
144 | 144 | }
|
145 | 145 |
|
146 | 146 | passenger.boardingCooldown = 60;
|
|
149 | 149 | }
|
150 | 150 | return true; // CraftBukkit
|
151 | 151 | }
|
152 |
| -@@ -3258,7 +_,7 @@ |
| 152 | +@@ -3254,7 +_,7 @@ |
153 | 153 | }
|
154 | 154 | }
|
155 | 155 |
|
|
158 | 158 | if (this.level() instanceof ServerLevel serverLevel) {
|
159 | 159 | this.processPortalCooldown();
|
160 | 160 | if (this.portalProcess != null) {
|
161 |
| -@@ -3266,21 +_,20 @@ |
| 161 | +@@ -3262,21 +_,20 @@ |
162 | 162 | ProfilerFiller profilerFiller = Profiler.get();
|
163 | 163 | profilerFiller.push("portal");
|
164 | 164 | this.setPortalCooldown();
|
|
188 | 188 | }
|
189 | 189 |
|
190 | 190 | public int getDimensionChangingDelay() {
|
191 |
| -@@ -3420,6 +_,11 @@ |
| 191 | +@@ -3416,6 +_,11 @@ |
192 | 192 |
|
193 | 193 | @Nullable
|
194 | 194 | public PlayerTeam getTeam() {
|
|
200 | 200 | if (!this.level().paperConfig().scoreboards.allowNonPlayerEntitiesOnScoreboards && !(this instanceof Player)) { return null; } // Paper - Perf: Disable Scoreboards for non players by default
|
201 | 201 | return this.level().getScoreboard().getPlayersTeam(this.getScoreboardName());
|
202 | 202 | }
|
203 |
| -@@ -3726,8 +_,789 @@ |
| 203 | +@@ -3722,8 +_,789 @@ |
204 | 204 | this.portalProcess = entity.portalProcess;
|
205 | 205 | }
|
206 | 206 |
|
|
990 | 990 | // Paper start - Fix item duplication and teleport issues
|
991 | 991 | if ((!this.isAlive() || !this.valid) && (teleportTransition.newLevel() != this.level)) {
|
992 | 992 | LOGGER.warn("Illegal Entity Teleport " + this + " to " + teleportTransition.newLevel() + ":" + teleportTransition.position(), new Throwable());
|
993 |
| -@@ -3911,6 +_,12 @@ |
| 993 | +@@ -3907,6 +_,12 @@ |
994 | 994 | }
|
995 | 995 | }
|
996 | 996 |
|
|
1003 | 1003 | protected void removeAfterChangingDimensions() {
|
1004 | 1004 | this.setRemoved(Entity.RemovalReason.CHANGED_DIMENSION, null); // CraftBukkit - add Bukkit remove cause
|
1005 | 1005 | if (this instanceof Leashable leashable && leashable.isLeashed()) { // Paper - only call if it is leashed
|
1006 |
| -@@ -4246,6 +_,12 @@ |
| 1006 | +@@ -4242,6 +_,12 @@ |
1007 | 1007 | }
|
1008 | 1008 |
|
1009 | 1009 | public void startSeenByPlayer(ServerPlayer serverPlayer) {
|
|
1016 | 1016 | }
|
1017 | 1017 |
|
1018 | 1018 | public void stopSeenByPlayer(ServerPlayer serverPlayer) {
|
1019 |
| -@@ -4255,6 +_,12 @@ |
| 1019 | +@@ -4251,6 +_,12 @@ |
1020 | 1020 | new io.papermc.paper.event.player.PlayerUntrackEntityEvent(serverPlayer.getBukkitEntity(), this.getBukkitEntity()).callEvent();
|
1021 | 1021 | }
|
1022 | 1022 | // Paper end - entity tracking events
|
|
1029 | 1029 | }
|
1030 | 1030 |
|
1031 | 1031 | public float rotate(Rotation transformRotation) {
|
1032 |
| -@@ -4790,7 +_,8 @@ |
| 1032 | +@@ -4786,7 +_,8 @@ |
1033 | 1033 | }
|
1034 | 1034 | }
|
1035 | 1035 | // Paper end - Fix MC-4
|
|
1039 | 1039 | synchronized (this.posLock) { // Paper - detailed watchdog information
|
1040 | 1040 | this.position = new Vec3(x, y, z);
|
1041 | 1041 | } // Paper - detailed watchdog information
|
1042 |
| -@@ -4809,7 +_,7 @@ |
| 1042 | +@@ -4805,7 +_,7 @@ |
1043 | 1043 | }
|
1044 | 1044 | // Paper start - Block invalid positions and bounding box; don't allow desync of pos and AABB
|
1045 | 1045 | // hanging has its own special logic
|
|
1048 | 1048 | this.setBoundingBox(this.makeBoundingBox());
|
1049 | 1049 | }
|
1050 | 1050 | // Paper end - Block invalid positions and bounding box
|
1051 |
| -@@ -4893,6 +_,12 @@ |
| 1051 | +@@ -4889,6 +_,12 @@ |
1052 | 1052 | return this.removalReason != null;
|
1053 | 1053 | }
|
1054 | 1054 |
|
|
1061 | 1061 | @Nullable
|
1062 | 1062 | public Entity.RemovalReason getRemovalReason() {
|
1063 | 1063 | return this.removalReason;
|
1064 |
| -@@ -4915,6 +_,9 @@ |
| 1064 | +@@ -4911,6 +_,9 @@ |
1065 | 1065 | org.bukkit.craftbukkit.event.CraftEventFactory.callEntityRemoveEvent(this, cause);
|
1066 | 1066 | // CraftBukkit end
|
1067 | 1067 | final boolean alreadyRemoved = this.removalReason != null; // Paper - Folia schedulers
|
|
1071 | 1071 | if (this.removalReason == null) {
|
1072 | 1072 | this.removalReason = removalReason;
|
1073 | 1073 | }
|
1074 |
| -@@ -4937,6 +_,10 @@ |
| 1074 | +@@ -4933,6 +_,10 @@ |
1075 | 1075 | public void unsetRemoved() {
|
1076 | 1076 | this.removalReason = null;
|
1077 | 1077 | }
|
|
0 commit comments