Skip to content

Commit

Permalink
Update Paper
Browse files Browse the repository at this point in the history
  • Loading branch information
Spottedleaf committed Jan 29, 2025
1 parent b05f1ef commit 873afea
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
private EntityDimensions dimensions;
private float eyeHeight;
public boolean isInPowderSnow;
@@ -525,6 +_,23 @@
@@ -521,6 +_,23 @@
}
}
// Paper end - optimise entity tracker
Expand All @@ -51,7 +51,7 @@

public Entity(EntityType<?> entityType, Level level) {
this.type = entityType;
@@ -655,8 +_,7 @@
@@ -651,8 +_,7 @@
// due to interactions on the client.
public void resendPossiblyDesyncedEntityData(net.minecraft.server.level.ServerPlayer player) {
if (player.getBukkitEntity().canSee(this.getBukkitEntity())) {
Expand All @@ -61,7 +61,7 @@
if (tracker == null) {
return;
}
@@ -823,7 +_,7 @@
@@ -819,7 +_,7 @@
public void postTick() {
// 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
if (!(this instanceof ServerPlayer) && this.isAlive()) { // Paper - don't attempt to teleport dead entities
Expand All @@ -70,7 +70,7 @@
}
}
// CraftBukkit end
@@ -841,7 +_,7 @@
@@ -837,7 +_,7 @@
this.boardingCooldown--;
}

Expand All @@ -79,7 +79,7 @@
if (this.canSpawnSprintParticle()) {
this.spawnSprintParticle();
}
@@ -1104,8 +_,8 @@
@@ -1100,8 +_,8 @@
} else {
this.wasOnFire = this.isOnFire();
if (type == MoverType.PISTON) {
Expand All @@ -90,7 +90,7 @@
movement = this.limitPistonMovement(movement);
if (movement.equals(Vec3.ZERO)) {
return;
@@ -1404,7 +_,7 @@
@@ -1400,7 +_,7 @@
if (pos.lengthSqr() <= 1.0E-7) {
return pos;
} else {
Expand All @@ -99,23 +99,23 @@
if (gameTime != this.pistonDeltasGameTime) {
Arrays.fill(this.pistonDeltas, 0.0);
this.pistonDeltasGameTime = gameTime;
@@ -3038,6 +_,7 @@
@@ -3034,6 +_,7 @@
}

if (force || this.canRide(vehicle) && vehicle.canAddPassenger(this)) {
+ if (this.valid) { // Folia - region threading - suppress entire event logic during worldgen
// CraftBukkit start
if (vehicle.getBukkitEntity() instanceof org.bukkit.entity.Vehicle && this.getBukkitEntity() instanceof org.bukkit.entity.LivingEntity) {
org.bukkit.event.vehicle.VehicleEnterEvent event = new org.bukkit.event.vehicle.VehicleEnterEvent((org.bukkit.entity.Vehicle) vehicle.getBukkitEntity(), this.getBukkitEntity());
@@ -3059,6 +_,7 @@
@@ -3055,6 +_,7 @@
return false;
}
// CraftBukkit end
+ } // Folia - region threading - suppress entire event logic during worldgen
if (this.isPassenger()) {
this.stopRiding();
}
@@ -3126,7 +_,7 @@
@@ -3122,7 +_,7 @@
this.passengers = ImmutableList.copyOf(list);
}

Expand All @@ -124,23 +124,23 @@
}
}

@@ -3140,6 +_,7 @@
@@ -3136,6 +_,7 @@
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
} else {
// CraftBukkit start
+ if (this.valid) { // Folia - region threading - suppress entire event logic during worldgen
org.bukkit.craftbukkit.entity.CraftEntity craft = (org.bukkit.craftbukkit.entity.CraftEntity) passenger.getBukkitEntity().getVehicle();
Entity orig = craft == null ? null : craft.getHandle();
if (this.getBukkitEntity() instanceof org.bukkit.entity.Vehicle && passenger.getBukkitEntity() instanceof org.bukkit.entity.LivingEntity) {
@@ -3167,6 +_,7 @@
@@ -3163,6 +_,7 @@
return false;
}
// CraftBukkit end
+ } // Folia - region threading - suppress entire event logic during worldgen
if (this.passengers.size() == 1 && this.passengers.get(0) == passenger) {
this.passengers = ImmutableList.of();
} else {
@@ -3174,7 +_,7 @@
@@ -3170,7 +_,7 @@
}

passenger.boardingCooldown = 60;
Expand All @@ -149,7 +149,7 @@
}
return true; // CraftBukkit
}
@@ -3258,7 +_,7 @@
@@ -3254,7 +_,7 @@
}
}

Expand All @@ -158,7 +158,7 @@
if (this.level() instanceof ServerLevel serverLevel) {
this.processPortalCooldown();
if (this.portalProcess != null) {
@@ -3266,21 +_,20 @@
@@ -3262,21 +_,20 @@
ProfilerFiller profilerFiller = Profiler.get();
profilerFiller.push("portal");
this.setPortalCooldown();
Expand Down Expand Up @@ -188,7 +188,7 @@
}

public int getDimensionChangingDelay() {
@@ -3420,6 +_,11 @@
@@ -3416,6 +_,11 @@

@Nullable
public PlayerTeam getTeam() {
Expand All @@ -200,7 +200,7 @@
if (!this.level().paperConfig().scoreboards.allowNonPlayerEntitiesOnScoreboards && !(this instanceof Player)) { return null; } // Paper - Perf: Disable Scoreboards for non players by default
return this.level().getScoreboard().getPlayersTeam(this.getScoreboardName());
}
@@ -3726,8 +_,789 @@
@@ -3722,8 +_,789 @@
this.portalProcess = entity.portalProcess;
}

Expand Down Expand Up @@ -990,7 +990,7 @@
// Paper start - Fix item duplication and teleport issues
if ((!this.isAlive() || !this.valid) && (teleportTransition.newLevel() != this.level)) {
LOGGER.warn("Illegal Entity Teleport " + this + " to " + teleportTransition.newLevel() + ":" + teleportTransition.position(), new Throwable());
@@ -3911,6 +_,12 @@
@@ -3907,6 +_,12 @@
}
}

Expand All @@ -1003,7 +1003,7 @@
protected void removeAfterChangingDimensions() {
this.setRemoved(Entity.RemovalReason.CHANGED_DIMENSION, null); // CraftBukkit - add Bukkit remove cause
if (this instanceof Leashable leashable && leashable.isLeashed()) { // Paper - only call if it is leashed
@@ -4246,6 +_,12 @@
@@ -4242,6 +_,12 @@
}

public void startSeenByPlayer(ServerPlayer serverPlayer) {
Expand All @@ -1016,7 +1016,7 @@
}

public void stopSeenByPlayer(ServerPlayer serverPlayer) {
@@ -4255,6 +_,12 @@
@@ -4251,6 +_,12 @@
new io.papermc.paper.event.player.PlayerUntrackEntityEvent(serverPlayer.getBukkitEntity(), this.getBukkitEntity()).callEvent();
}
// Paper end - entity tracking events
Expand All @@ -1029,7 +1029,7 @@
}

public float rotate(Rotation transformRotation) {
@@ -4790,7 +_,8 @@
@@ -4786,7 +_,8 @@
}
}
// Paper end - Fix MC-4
Expand All @@ -1039,7 +1039,7 @@
synchronized (this.posLock) { // Paper - detailed watchdog information
this.position = new Vec3(x, y, z);
} // Paper - detailed watchdog information
@@ -4809,7 +_,7 @@
@@ -4805,7 +_,7 @@
}
// Paper start - Block invalid positions and bounding box; don't allow desync of pos and AABB
// hanging has its own special logic
Expand All @@ -1048,7 +1048,7 @@
this.setBoundingBox(this.makeBoundingBox());
}
// Paper end - Block invalid positions and bounding box
@@ -4893,6 +_,12 @@
@@ -4889,6 +_,12 @@
return this.removalReason != null;
}

Expand All @@ -1061,7 +1061,7 @@
@Nullable
public Entity.RemovalReason getRemovalReason() {
return this.removalReason;
@@ -4915,6 +_,9 @@
@@ -4911,6 +_,9 @@
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityRemoveEvent(this, cause);
// CraftBukkit end
final boolean alreadyRemoved = this.removalReason != null; // Paper - Folia schedulers
Expand All @@ -1071,7 +1071,7 @@
if (this.removalReason == null) {
this.removalReason = removalReason;
}
@@ -4937,6 +_,10 @@
@@ -4933,6 +_,10 @@
public void unsetRemoved() {
this.removalReason = null;
}
Expand Down
Loading

0 comments on commit 873afea

Please sign in to comment.