Separate tick count to ensure vanilla parity (#12077)
This commit is contained in:
@ -366,7 +366,7 @@ index d95413af04121fe91ca0f3b0c70025b9808acef9..ad665c7535c615d2b03a3e7864be435f
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
||||||
index 79d23c3403efc6dbef2381a3fa5946023f862452..3b19229427d83290bba1431bee5357e2ced34f94 100644
|
index 8204528c26456929fdec0d8ba7a5a52128409097..01bc2d1639be9f04afc63e5841c5c99730ea37d8 100644
|
||||||
--- a/net/minecraft/server/level/ServerLevel.java
|
--- a/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -551,6 +551,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
@@ -551,6 +551,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||||
@ -377,8 +377,8 @@ index 79d23c3403efc6dbef2381a3fa5946023f862452..3b19229427d83290bba1431bee5357e2
|
|||||||
this.entityTickList
|
this.entityTickList
|
||||||
.forEach(
|
.forEach(
|
||||||
entity -> {
|
entity -> {
|
||||||
@@ -979,12 +980,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
@@ -980,12 +981,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||||
entity.tickCount++;
|
entity.totalEntityAge++; // Paper - age-like counter for all entities
|
||||||
profilerFiller.push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString());
|
profilerFiller.push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString());
|
||||||
profilerFiller.incrementCounter("tickNonPassenger");
|
profilerFiller.incrementCounter("tickNonPassenger");
|
||||||
+ final boolean isActive = io.papermc.paper.entity.activation.ActivationRange.checkIfActive(entity); // Paper - EAR 2
|
+ final boolean isActive = io.papermc.paper.entity.activation.ActivationRange.checkIfActive(entity); // Paper - EAR 2
|
||||||
@ -394,7 +394,7 @@ index 79d23c3403efc6dbef2381a3fa5946023f862452..3b19229427d83290bba1431bee5357e2
|
|||||||
}
|
}
|
||||||
// Paper start - log detailed entity tick information
|
// Paper start - log detailed entity tick information
|
||||||
} finally {
|
} finally {
|
||||||
@@ -995,7 +999,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
@@ -996,7 +1000,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||||
// Paper end - log detailed entity tick information
|
// Paper end - log detailed entity tick information
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,7 +403,7 @@ index 79d23c3403efc6dbef2381a3fa5946023f862452..3b19229427d83290bba1431bee5357e2
|
|||||||
if (passengerEntity.isRemoved() || passengerEntity.getVehicle() != ridingEntity) {
|
if (passengerEntity.isRemoved() || passengerEntity.getVehicle() != ridingEntity) {
|
||||||
passengerEntity.stopRiding();
|
passengerEntity.stopRiding();
|
||||||
} else if (passengerEntity instanceof Player || this.entityTickList.contains(passengerEntity)) {
|
} else if (passengerEntity instanceof Player || this.entityTickList.contains(passengerEntity)) {
|
||||||
@@ -1004,12 +1008,21 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
@@ -1006,12 +1010,21 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||||
ProfilerFiller profilerFiller = Profiler.get();
|
ProfilerFiller profilerFiller = Profiler.get();
|
||||||
profilerFiller.push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(passengerEntity.getType()).toString());
|
profilerFiller.push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(passengerEntity.getType()).toString());
|
||||||
profilerFiller.incrementCounter("tickPassenger");
|
profilerFiller.incrementCounter("tickPassenger");
|
||||||
@ -476,12 +476,12 @@ index 24735284fda151414d99faad401d25ba60995f9a..23b342cc31c7e72ade0e1ccad86a9ccf
|
|||||||
public void tick() {
|
public void tick() {
|
||||||
super.tick();
|
super.tick();
|
||||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||||
index bf5f2b753e3cbe3dfa8ad86df06718fbc1fbcbc4..988e5740b86c7768fee7391dc7e2900305a51be9 100644
|
index b15420ffa1432d49aec8e91e917598bde4e94337..054ece1d539d69a4b7eec57e681179343c7e75c3 100644
|
||||||
--- a/net/minecraft/world/entity/Entity.java
|
--- a/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/net/minecraft/world/entity/Entity.java
|
+++ b/net/minecraft/world/entity/Entity.java
|
||||||
@@ -380,6 +380,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -381,6 +381,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
public boolean fixedPose = false; // Paper - Expand Pose API
|
|
||||||
private final int despawnTime; // Paper - entity despawn time limit
|
private final int despawnTime; // Paper - entity despawn time limit
|
||||||
|
public int totalEntityAge; // Paper - age-like counter for all entities
|
||||||
public final io.papermc.paper.entity.activation.ActivationType activationType = io.papermc.paper.entity.activation.ActivationType.activationTypeFor(this); // Paper - EAR 2/tracking ranges
|
public final io.papermc.paper.entity.activation.ActivationType activationType = io.papermc.paper.entity.activation.ActivationType.activationTypeFor(this); // Paper - EAR 2/tracking ranges
|
||||||
+ // Paper start - EAR 2
|
+ // Paper start - EAR 2
|
||||||
+ public final boolean defaultActivationState;
|
+ public final boolean defaultActivationState;
|
||||||
@ -495,7 +495,7 @@ index bf5f2b753e3cbe3dfa8ad86df06718fbc1fbcbc4..988e5740b86c7768fee7391dc7e29003
|
|||||||
|
|
||||||
public void setOrigin(@javax.annotation.Nonnull org.bukkit.Location location) {
|
public void setOrigin(@javax.annotation.Nonnull org.bukkit.Location location) {
|
||||||
this.origin = location.toVector();
|
this.origin = location.toVector();
|
||||||
@@ -413,6 +422,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -414,6 +423,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
this.position = Vec3.ZERO;
|
this.position = Vec3.ZERO;
|
||||||
this.blockPosition = BlockPos.ZERO;
|
this.blockPosition = BlockPos.ZERO;
|
||||||
this.chunkPosition = ChunkPos.ZERO;
|
this.chunkPosition = ChunkPos.ZERO;
|
||||||
@ -509,7 +509,7 @@ index bf5f2b753e3cbe3dfa8ad86df06718fbc1fbcbc4..988e5740b86c7768fee7391dc7e29003
|
|||||||
SynchedEntityData.Builder builder = new SynchedEntityData.Builder(this);
|
SynchedEntityData.Builder builder = new SynchedEntityData.Builder(this);
|
||||||
builder.define(DATA_SHARED_FLAGS_ID, (byte)0);
|
builder.define(DATA_SHARED_FLAGS_ID, (byte)0);
|
||||||
builder.define(DATA_AIR_SUPPLY_ID, this.getMaxAirSupply());
|
builder.define(DATA_AIR_SUPPLY_ID, this.getMaxAirSupply());
|
||||||
@@ -977,6 +993,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -978,6 +994,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
} else {
|
} else {
|
||||||
this.wasOnFire = this.isOnFire();
|
this.wasOnFire = this.isOnFire();
|
||||||
if (type == MoverType.PISTON) {
|
if (type == MoverType.PISTON) {
|
||||||
@ -518,7 +518,7 @@ index bf5f2b753e3cbe3dfa8ad86df06718fbc1fbcbc4..988e5740b86c7768fee7391dc7e29003
|
|||||||
movement = this.limitPistonMovement(movement);
|
movement = this.limitPistonMovement(movement);
|
||||||
if (movement.equals(Vec3.ZERO)) {
|
if (movement.equals(Vec3.ZERO)) {
|
||||||
return;
|
return;
|
||||||
@@ -990,6 +1008,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -991,6 +1009,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
this.stuckSpeedMultiplier = Vec3.ZERO;
|
this.stuckSpeedMultiplier = Vec3.ZERO;
|
||||||
this.setDeltaMovement(Vec3.ZERO);
|
this.setDeltaMovement(Vec3.ZERO);
|
||||||
}
|
}
|
||||||
@ -845,7 +845,7 @@ index 32f184288f6065259c921293922c1b0163df4dc4..0f346faa82b988e86834c38837f6f11b
|
|||||||
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
|
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
|
||||||
// Paper start - add paper world config
|
// Paper start - add paper world config
|
||||||
diff --git a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
diff --git a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
||||||
index 754cfdcd5a28287aa3545aaffdce1e391cbefc1e..1e6e940fca9d96ef410c7bf05524bd9b24db4a79 100644
|
index ce880bd45fbda4829d17de8507034b3a39c68cbb..ee2f8e8deb35059824b5730a1442f383dc79f01c 100644
|
||||||
--- a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
--- a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
||||||
+++ b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
+++ b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
||||||
@@ -149,6 +149,10 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
@@ -149,6 +149,10 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
||||||
|
|||||||
@ -14,7 +14,7 @@ movement will load only the chunk the player enters anyways and avoids loading
|
|||||||
massive amounts of surrounding chunks due to large AABB lookups.
|
massive amounts of surrounding chunks due to large AABB lookups.
|
||||||
|
|
||||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||||
index 334859c5ff7023c730513301cc11c9837b2c7823..45f69a914d5a0565196c4105d61541047301470f 100644
|
index 054ece1d539d69a4b7eec57e681179343c7e75c3..6f35067c64f378e955261e763f2bda9a0a6d0153 100644
|
||||||
--- a/net/minecraft/world/entity/Entity.java
|
--- a/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/net/minecraft/world/entity/Entity.java
|
+++ b/net/minecraft/world/entity/Entity.java
|
||||||
@@ -218,6 +218,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -218,6 +218,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
|
|||||||
@ -26735,7 +26735,7 @@ index da793ad12565c36fffb26eb771ff68c76632caf7..db06f966077928419bfe469260f04d7d
|
|||||||
if (!passengers.equals(this.lastPassengers)) {
|
if (!passengers.equals(this.lastPassengers)) {
|
||||||
this.broadcastAndSend(new ClientboundSetPassengersPacket(this.entity)); // CraftBukkit
|
this.broadcastAndSend(new ClientboundSetPassengersPacket(this.entity)); // CraftBukkit
|
||||||
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
||||||
index b851520559b83c800eb240cebced0c40f1b8a66c..a293d1481b5f4a1d18addc3e518486c639223f09 100644
|
index 4a521a37e5fa0250d2cb7b4bc061d309c977e034..fc4a1efaa1f0005237340a236a231d8d3fec8d84 100644
|
||||||
--- a/net/minecraft/server/level/ServerLevel.java
|
--- a/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -170,7 +170,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
@@ -170,7 +170,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
@ -27305,7 +27305,7 @@ index b851520559b83c800eb240cebced0c40f1b8a66c..a293d1481b5f4a1d18addc3e518486c6
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Paper start - log detailed entity tick information
|
// Paper start - log detailed entity tick information
|
||||||
@@ -1033,6 +1316,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
@@ -1035,6 +1318,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save(@Nullable ProgressListener progress, boolean flush, boolean skipSave) {
|
public void save(@Nullable ProgressListener progress, boolean flush, boolean skipSave) {
|
||||||
@ -27317,7 +27317,7 @@ index b851520559b83c800eb240cebced0c40f1b8a66c..a293d1481b5f4a1d18addc3e518486c6
|
|||||||
ServerChunkCache chunkSource = this.getChunkSource();
|
ServerChunkCache chunkSource = this.getChunkSource();
|
||||||
if (!skipSave) {
|
if (!skipSave) {
|
||||||
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(this.getWorld())); // CraftBukkit
|
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(this.getWorld())); // CraftBukkit
|
||||||
@@ -1045,13 +1333,18 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
@@ -1047,13 +1335,18 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||||
progress.progressStage(Component.translatable("menu.savingChunks"));
|
progress.progressStage(Component.translatable("menu.savingChunks"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27341,7 +27341,7 @@ index b851520559b83c800eb240cebced0c40f1b8a66c..a293d1481b5f4a1d18addc3e518486c6
|
|||||||
|
|
||||||
// CraftBukkit start - moved from MinecraftServer.saveChunks
|
// CraftBukkit start - moved from MinecraftServer.saveChunks
|
||||||
ServerLevel worldserver1 = this;
|
ServerLevel worldserver1 = this;
|
||||||
@@ -1182,7 +1475,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
@@ -1184,7 +1477,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||||
this.removePlayerImmediately((ServerPlayer)entity, Entity.RemovalReason.DISCARDED);
|
this.removePlayerImmediately((ServerPlayer)entity, Entity.RemovalReason.DISCARDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27350,7 +27350,7 @@ index b851520559b83c800eb240cebced0c40f1b8a66c..a293d1481b5f4a1d18addc3e518486c6
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
@@ -1213,7 +1506,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
@@ -1215,7 +1508,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -27359,7 +27359,7 @@ index b851520559b83c800eb240cebced0c40f1b8a66c..a293d1481b5f4a1d18addc3e518486c6
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1224,7 +1517,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
@@ -1226,7 +1519,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||||
|
|
||||||
public boolean tryAddFreshEntityWithPassengers(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
|
public boolean tryAddFreshEntityWithPassengers(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -27368,7 +27368,7 @@ index b851520559b83c800eb240cebced0c40f1b8a66c..a293d1481b5f4a1d18addc3e518486c6
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this.addFreshEntityWithPassengers(entity, reason); // CraftBukkit
|
this.addFreshEntityWithPassengers(entity, reason); // CraftBukkit
|
||||||
@@ -1959,7 +2252,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
@@ -1961,7 +2254,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27377,7 +27377,7 @@ index b851520559b83c800eb240cebced0c40f1b8a66c..a293d1481b5f4a1d18addc3e518486c6
|
|||||||
bufferedWriter.write(String.format(Locale.ROOT, "block_entity_tickers: %d\n", this.blockEntityTickers.size()));
|
bufferedWriter.write(String.format(Locale.ROOT, "block_entity_tickers: %d\n", this.blockEntityTickers.size()));
|
||||||
bufferedWriter.write(String.format(Locale.ROOT, "block_ticks: %d\n", this.getBlockTicks().count()));
|
bufferedWriter.write(String.format(Locale.ROOT, "block_ticks: %d\n", this.getBlockTicks().count()));
|
||||||
bufferedWriter.write(String.format(Locale.ROOT, "fluid_ticks: %d\n", this.getFluidTicks().count()));
|
bufferedWriter.write(String.format(Locale.ROOT, "fluid_ticks: %d\n", this.getFluidTicks().count()));
|
||||||
@@ -1977,13 +2270,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
@@ -1979,13 +2272,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||||
Path path1 = path.resolve("chunks.csv");
|
Path path1 = path.resolve("chunks.csv");
|
||||||
|
|
||||||
try (Writer bufferedWriter2 = Files.newBufferedWriter(path1)) {
|
try (Writer bufferedWriter2 = Files.newBufferedWriter(path1)) {
|
||||||
@ -27393,7 +27393,7 @@ index b851520559b83c800eb240cebced0c40f1b8a66c..a293d1481b5f4a1d18addc3e518486c6
|
|||||||
}
|
}
|
||||||
|
|
||||||
Path path3 = path.resolve("entities.csv");
|
Path path3 = path.resolve("entities.csv");
|
||||||
@@ -2092,8 +2385,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
@@ -2094,8 +2387,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||||
Locale.ROOT,
|
Locale.ROOT,
|
||||||
"players: %s, entities: %s [%s], block_entities: %d [%s], block_ticks: %d, fluid_ticks: %d, chunk_source: %s",
|
"players: %s, entities: %s [%s], block_entities: %d [%s], block_ticks: %d, fluid_ticks: %d, chunk_source: %s",
|
||||||
this.players.size(),
|
this.players.size(),
|
||||||
@ -27404,7 +27404,7 @@ index b851520559b83c800eb240cebced0c40f1b8a66c..a293d1481b5f4a1d18addc3e518486c6
|
|||||||
this.blockEntityTickers.size(),
|
this.blockEntityTickers.size(),
|
||||||
getTypeCount(this.blockEntityTickers, TickingBlockEntity::getType),
|
getTypeCount(this.blockEntityTickers, TickingBlockEntity::getType),
|
||||||
this.getBlockTicks().count(),
|
this.getBlockTicks().count(),
|
||||||
@@ -2125,15 +2418,25 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
@@ -2127,15 +2420,25 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||||
@Override
|
@Override
|
||||||
public LevelEntityGetter<Entity> getEntities() {
|
public LevelEntityGetter<Entity> getEntities() {
|
||||||
org.spigotmc.AsyncCatcher.catchOp("Chunk getEntities call"); // Spigot
|
org.spigotmc.AsyncCatcher.catchOp("Chunk getEntities call"); // Spigot
|
||||||
@ -27433,7 +27433,7 @@ index b851520559b83c800eb240cebced0c40f1b8a66c..a293d1481b5f4a1d18addc3e518486c6
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void startTickingChunk(LevelChunk chunk) {
|
public void startTickingChunk(LevelChunk chunk) {
|
||||||
@@ -2151,32 +2454,45 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
@@ -2153,32 +2456,45 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
super.close();
|
super.close();
|
||||||
@ -27486,7 +27486,7 @@ index b851520559b83c800eb240cebced0c40f1b8a66c..a293d1481b5f4a1d18addc3e518486c6
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2230,7 +2546,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
@@ -2232,7 +2548,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||||
@Override
|
@Override
|
||||||
public CrashReportCategory fillReportDetails(CrashReport report) {
|
public CrashReportCategory fillReportDetails(CrashReport report) {
|
||||||
CrashReportCategory crashReportCategory = super.fillReportDetails(report);
|
CrashReportCategory crashReportCategory = super.fillReportDetails(report);
|
||||||
@ -28466,7 +28466,7 @@ index 19e4576b4b3be92961e993a8b14c8368789c692e..216482b4bb705520411bdeaa58f6044d
|
|||||||
}
|
}
|
||||||
// Paper end - Share random for entities to make them more random
|
// Paper end - Share random for entities to make them more random
|
||||||
public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper - Entity#getEntitySpawnReason
|
public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper - Entity#getEntitySpawnReason
|
||||||
@@ -415,6 +371,156 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -416,6 +372,156 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
return this.dimensions.makeBoundingBox(x, y, z);
|
return this.dimensions.makeBoundingBox(x, y, z);
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
@ -28623,7 +28623,7 @@ index 19e4576b4b3be92961e993a8b14c8368789c692e..216482b4bb705520411bdeaa58f6044d
|
|||||||
|
|
||||||
public Entity(EntityType<?> entityType, Level level) {
|
public Entity(EntityType<?> entityType, Level level) {
|
||||||
this.type = entityType;
|
this.type = entityType;
|
||||||
@@ -1323,35 +1429,77 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -1324,35 +1430,77 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
return distance;
|
return distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28725,7 +28725,7 @@ index 19e4576b4b3be92961e993a8b14c8368789c692e..216482b4bb705520411bdeaa58f6044d
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static float[] collectCandidateStepUpHeights(AABB box, List<VoxelShape> colliders, float deltaY, float maxUpStep) {
|
private static float[] collectCandidateStepUpHeights(AABB box, List<VoxelShape> colliders, float deltaY, float maxUpStep) {
|
||||||
@@ -2658,23 +2806,110 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -2659,23 +2807,110 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInWall() {
|
public boolean isInWall() {
|
||||||
@ -28849,7 +28849,7 @@ index 19e4576b4b3be92961e993a8b14c8368789c692e..216482b4bb705520411bdeaa58f6044d
|
|||||||
}
|
}
|
||||||
|
|
||||||
public InteractionResult interact(Player player, InteractionHand hand) {
|
public InteractionResult interact(Player player, InteractionHand hand) {
|
||||||
@@ -4098,15 +4333,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -4099,15 +4334,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
}
|
}
|
||||||
|
|
||||||
public Iterable<Entity> getIndirectPassengers() {
|
public Iterable<Entity> getIndirectPassengers() {
|
||||||
@ -28875,7 +28875,7 @@ index 19e4576b4b3be92961e993a8b14c8368789c692e..216482b4bb705520411bdeaa58f6044d
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int countPlayerPassengers() {
|
public int countPlayerPassengers() {
|
||||||
@@ -4244,77 +4481,136 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -4245,77 +4482,136 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
return Mth.lerp(partialTick, this.yRotO, this.yRot);
|
return Mth.lerp(partialTick, this.yRotO, this.yRot);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29066,7 +29066,7 @@ index 19e4576b4b3be92961e993a8b14c8368789c692e..216482b4bb705520411bdeaa58f6044d
|
|||||||
|
|
||||||
public boolean touchingUnloadedChunk() {
|
public boolean touchingUnloadedChunk() {
|
||||||
AABB aabb = this.getBoundingBox().inflate(1.0);
|
AABB aabb = this.getBoundingBox().inflate(1.0);
|
||||||
@@ -4467,6 +4763,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -4468,6 +4764,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
this.setPosRaw(x, y, z, false);
|
this.setPosRaw(x, y, z, false);
|
||||||
}
|
}
|
||||||
public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) {
|
public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) {
|
||||||
@ -29082,7 +29082,7 @@ index 19e4576b4b3be92961e993a8b14c8368789c692e..216482b4bb705520411bdeaa58f6044d
|
|||||||
if (!checkPosition(this, x, y, z)) {
|
if (!checkPosition(this, x, y, z)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -4597,6 +4902,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -4598,6 +4903,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void setRemoved(Entity.RemovalReason removalReason, org.bukkit.event.entity.EntityRemoveEvent.Cause cause) {
|
public final void setRemoved(Entity.RemovalReason removalReason, org.bukkit.event.entity.EntityRemoveEvent.Cause cause) {
|
||||||
@ -29095,7 +29095,7 @@ index 19e4576b4b3be92961e993a8b14c8368789c692e..216482b4bb705520411bdeaa58f6044d
|
|||||||
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityRemoveEvent(this, cause);
|
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityRemoveEvent(this, cause);
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
final boolean alreadyRemoved = this.removalReason != null; // Paper - Folia schedulers
|
final boolean alreadyRemoved = this.removalReason != null; // Paper - Folia schedulers
|
||||||
@@ -4608,7 +4919,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -4609,7 +4920,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
this.stopRiding();
|
this.stopRiding();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29104,7 +29104,7 @@ index 19e4576b4b3be92961e993a8b14c8368789c692e..216482b4bb705520411bdeaa58f6044d
|
|||||||
this.levelCallback.onRemove(removalReason);
|
this.levelCallback.onRemove(removalReason);
|
||||||
this.onRemoval(removalReason);
|
this.onRemoval(removalReason);
|
||||||
// Paper start - Folia schedulers
|
// Paper start - Folia schedulers
|
||||||
@@ -4642,7 +4953,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -4643,7 +4954,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
public boolean shouldBeSaved() {
|
public boolean shouldBeSaved() {
|
||||||
return (this.removalReason == null || this.removalReason.shouldSave())
|
return (this.removalReason == null || this.removalReason.shouldSave())
|
||||||
&& !this.isPassenger()
|
&& !this.isPassenger()
|
||||||
|
|||||||
@ -2337,7 +2337,7 @@ index a293d1481b5f4a1d18addc3e518486c639223f09..5bf38ab129451e867b638cfbd2d7be59
|
|||||||
|
|
||||||
public LevelChunk getChunkIfLoaded(int x, int z) {
|
public LevelChunk getChunkIfLoaded(int x, int z) {
|
||||||
return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
|
return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
|
||||||
@@ -2555,6 +2556,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
@@ -2557,6 +2558,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||||
return this.chunkSource.getGenerator().getSeaLevel();
|
return this.chunkSource.getGenerator().getSeaLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -50,10 +50,10 @@ index 409c1134327bfcc338c3ac5e658a83cc396645d1..cc2d442682496197d29ace79b22e6cf6
|
|||||||
ProfilerFiller profilerFiller = Profiler.get();
|
ProfilerFiller profilerFiller = Profiler.get();
|
||||||
this.runAllTasks(); // Paper - move runAllTasks() into full server tick (previously for timings)
|
this.runAllTasks(); // Paper - move runAllTasks() into full server tick (previously for timings)
|
||||||
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
||||||
index 46dfaed12c998c219a20c711a06531aed2c68012..ebeeb63c3dca505a3ce8b88feaa5d2ca20ec24a2 100644
|
index 42995dac38248032b6abecc27124adfe12ec4cab..28a67294c3e678e01d5dfd68b950234213d8e55c 100644
|
||||||
--- a/net/minecraft/server/level/ServerLevel.java
|
--- a/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -1316,6 +1316,28 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
@@ -1318,6 +1318,28 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||||
return !this.server.isUnderSpawnProtection(this, pos, player) && this.getWorldBorder().isWithinBounds(pos);
|
return !this.server.isUnderSpawnProtection(this, pos, player) && this.getWorldBorder().isWithinBounds(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ index 46dfaed12c998c219a20c711a06531aed2c68012..ebeeb63c3dca505a3ce8b88feaa5d2ca
|
|||||||
// Paper start - add close param
|
// Paper start - add close param
|
||||||
this.save(progress, flush, skipSave, false);
|
this.save(progress, flush, skipSave, false);
|
||||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||||
index 422db52e8a0a08350542670bfc9ba94ad9481d0c..1fe212e8584c177b49e83f29b1a869b534914348 100644
|
index f44600604a7bf68c990cd74a1ac2d7900ff6e88e..69b8074e18775c846d5991f40bc2e0a5186500ac 100644
|
||||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||||
@@ -180,6 +180,7 @@ import org.slf4j.Logger;
|
@@ -180,6 +180,7 @@ import org.slf4j.Logger;
|
||||||
@ -95,7 +95,7 @@ index 422db52e8a0a08350542670bfc9ba94ad9481d0c..1fe212e8584c177b49e83f29b1a869b5
|
|||||||
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10;
|
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10;
|
||||||
private static final int FLY_STAT_RECORDING_SPEED = 25;
|
private static final int FLY_STAT_RECORDING_SPEED = 25;
|
||||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||||
index 5e94dd9e26aa4fd6545dbaae2ae0cb51cb6f13e0..03feaf0adb8ee87e33744a4615dc2507a02f92d7 100644
|
index 7d1d4abfb04829d8c4722e326c6c6b8fb2ab91f4..5a4960fdbd97d830ac79845697eea9372c48a13b 100644
|
||||||
--- a/net/minecraft/server/players/PlayerList.java
|
--- a/net/minecraft/server/players/PlayerList.java
|
||||||
+++ b/net/minecraft/server/players/PlayerList.java
|
+++ b/net/minecraft/server/players/PlayerList.java
|
||||||
@@ -482,6 +482,7 @@ public abstract class PlayerList {
|
@@ -482,6 +482,7 @@ public abstract class PlayerList {
|
||||||
|
|||||||
@ -460,7 +460,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void resetEmptyTime() {
|
public void resetEmptyTime() {
|
||||||
@@ -746,18 +_,45 @@
|
@@ -746,18 +_,46 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,6 +487,7 @@
|
|||||||
entity.setOldPosAndRot();
|
entity.setOldPosAndRot();
|
||||||
ProfilerFiller profilerFiller = Profiler.get();
|
ProfilerFiller profilerFiller = Profiler.get();
|
||||||
entity.tickCount++;
|
entity.tickCount++;
|
||||||
|
+ entity.totalEntityAge++; // Paper - age-like counter for all entities
|
||||||
profilerFiller.push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString());
|
profilerFiller.push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString());
|
||||||
profilerFiller.incrementCounter("tickNonPassenger");
|
profilerFiller.incrementCounter("tickNonPassenger");
|
||||||
entity.tick();
|
entity.tick();
|
||||||
@ -506,7 +507,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void tickPassenger(Entity ridingEntity, Entity passengerEntity) {
|
private void tickPassenger(Entity ridingEntity, Entity passengerEntity) {
|
||||||
@@ -770,6 +_,7 @@
|
@@ -766,10 +_,12 @@
|
||||||
|
} else if (passengerEntity instanceof Player || this.entityTickList.contains(passengerEntity)) {
|
||||||
|
passengerEntity.setOldPosAndRot();
|
||||||
|
passengerEntity.tickCount++;
|
||||||
|
+ passengerEntity.totalEntityAge++; // Paper - age-like counter for all entities
|
||||||
|
ProfilerFiller profilerFiller = Profiler.get();
|
||||||
profilerFiller.push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(passengerEntity.getType()).toString());
|
profilerFiller.push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(passengerEntity.getType()).toString());
|
||||||
profilerFiller.incrementCounter("tickPassenger");
|
profilerFiller.incrementCounter("tickPassenger");
|
||||||
passengerEntity.rideTick();
|
passengerEntity.rideTick();
|
||||||
|
|||||||
@ -127,7 +127,7 @@
|
|||||||
private final double[] pistonDeltas = new double[]{0.0, 0.0, 0.0};
|
private final double[] pistonDeltas = new double[]{0.0, 0.0, 0.0};
|
||||||
private long pistonDeltasGameTime;
|
private long pistonDeltasGameTime;
|
||||||
private EntityDimensions dimensions;
|
private EntityDimensions dimensions;
|
||||||
@@ -250,6 +_,59 @@
|
@@ -250,6 +_,60 @@
|
||||||
private final List<Entity.Movement> movementThisTick = new ArrayList<>();
|
private final List<Entity.Movement> movementThisTick = new ArrayList<>();
|
||||||
private final Set<BlockState> blocksInside = new ReferenceArraySet<>();
|
private final Set<BlockState> blocksInside = new ReferenceArraySet<>();
|
||||||
private final LongSet visitedBlocks = new LongOpenHashSet();
|
private final LongSet visitedBlocks = new LongOpenHashSet();
|
||||||
@ -158,6 +158,7 @@
|
|||||||
+ public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
|
+ public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
|
||||||
+ public boolean fixedPose = false; // Paper - Expand Pose API
|
+ public boolean fixedPose = false; // Paper - Expand Pose API
|
||||||
+ private final int despawnTime; // Paper - entity despawn time limit
|
+ private final int despawnTime; // Paper - entity despawn time limit
|
||||||
|
+ public int totalEntityAge; // Paper - age-like counter for all entities
|
||||||
+ public final io.papermc.paper.entity.activation.ActivationType activationType = io.papermc.paper.entity.activation.ActivationType.activationTypeFor(this); // Paper - EAR 2/tracking ranges
|
+ public final io.papermc.paper.entity.activation.ActivationType activationType = io.papermc.paper.entity.activation.ActivationType.activationTypeFor(this); // Paper - EAR 2/tracking ranges
|
||||||
+
|
+
|
||||||
+ public void setOrigin(@javax.annotation.Nonnull org.bukkit.Location location) {
|
+ public void setOrigin(@javax.annotation.Nonnull org.bukkit.Location location) {
|
||||||
@ -369,7 +370,7 @@
|
|||||||
|
|
||||||
public void tick() {
|
public void tick() {
|
||||||
+ // Paper start - entity despawn time limit
|
+ // Paper start - entity despawn time limit
|
||||||
+ if (this.despawnTime >= 0 && this.tickCount >= this.despawnTime) {
|
+ if (this.despawnTime >= 0 && this.totalEntityAge >= this.despawnTime) {
|
||||||
+ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN);
|
+ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN);
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
@ -798,7 +799,7 @@
|
|||||||
+ if (this.maxAirTicks != this.getDefaultMaxAirSupply()) {
|
+ if (this.maxAirTicks != this.getDefaultMaxAirSupply()) {
|
||||||
+ compound.putInt("Bukkit.MaxAirSupply", this.getMaxAirSupply());
|
+ compound.putInt("Bukkit.MaxAirSupply", this.getMaxAirSupply());
|
||||||
+ }
|
+ }
|
||||||
+ compound.putInt("Spigot.ticksLived", this.tickCount);
|
+ compound.putInt("Spigot.ticksLived", this.totalEntityAge); // Paper
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
Component customName = this.getCustomName();
|
Component customName = this.getCustomName();
|
||||||
if (customName != null) {
|
if (customName != null) {
|
||||||
@ -860,7 +861,7 @@
|
|||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ // Spigot start
|
+ // Spigot start
|
||||||
+ if (this instanceof net.minecraft.world.entity.LivingEntity) {
|
+ if (this instanceof net.minecraft.world.entity.LivingEntity) {
|
||||||
+ this.tickCount = compound.getInt("Spigot.ticksLived");
|
+ this.totalEntityAge = compound.getInt("Spigot.ticksLived"); // Paper
|
||||||
+ }
|
+ }
|
||||||
+ // Spigot end
|
+ // Spigot end
|
||||||
+ this.persist = !compound.contains("Bukkit.persist") || compound.getBoolean("Bukkit.persist");
|
+ this.persist = !compound.contains("Bukkit.persist") || compound.getBoolean("Bukkit.persist");
|
||||||
|
|||||||
@ -519,13 +519,14 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTicksLived() {
|
public int getTicksLived() {
|
||||||
return this.getHandle().tickCount;
|
return this.getHandle().totalEntityAge;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTicksLived(int value) {
|
public void setTicksLived(int value) {
|
||||||
Preconditions.checkArgument(value > 0, "Age value (%s) must be greater than 0", value);
|
Preconditions.checkArgument(value > 0, "Age value (%s) must be greater than 0", value);
|
||||||
this.getHandle().tickCount = value;
|
this.getHandle().tickCount = value;
|
||||||
|
this.getHandle().totalEntityAge = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Entity getHandle() {
|
public Entity getHandle() {
|
||||||
|
|||||||
Reference in New Issue
Block a user