Update Paper

This commit is contained in:
Spottedleaf 2025-01-28 18:22:53 -08:00
parent b05f1ef01d
commit 873afea939
3 changed files with 68 additions and 68 deletions

View File

@ -27,7 +27,7 @@
private EntityDimensions dimensions;
private float eyeHeight;
public boolean isInPowderSnow;
@@ -525,6 +_,23 @@
@@ -521,6 +_,23 @@
}
}
// Paper end - optimise entity tracker
@ -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())) {
@ -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
@ -70,7 +70,7 @@
}
}
// CraftBukkit end
@@ -841,7 +_,7 @@
@@ -837,7 +_,7 @@
this.boardingCooldown--;
}
@ -79,7 +79,7 @@
if (this.canSpawnSprintParticle()) {
this.spawnSprintParticle();
}
@@ -1104,8 +_,8 @@
@@ -1100,8 +_,8 @@
} else {
this.wasOnFire = this.isOnFire();
if (type == MoverType.PISTON) {
@ -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 {
@ -99,7 +99,7 @@
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)) {
@ -107,7 +107,7 @@
// 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
@ -115,7 +115,7 @@
if (this.isPassenger()) {
this.stopRiding();
}
@@ -3126,7 +_,7 @@
@@ -3122,7 +_,7 @@
this.passengers = ImmutableList.copyOf(list);
}
@ -124,7 +124,7 @@
}
}
@@ -3140,6 +_,7 @@
@@ -3136,6 +_,7 @@
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
} else {
// CraftBukkit start
@ -132,7 +132,7 @@
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
@ -140,7 +140,7 @@
if (this.passengers.size() == 1 && this.passengers.get(0) == passenger) {
this.passengers = ImmutableList.of();
} else {
@@ -3174,7 +_,7 @@
@@ -3170,7 +_,7 @@
}
passenger.boardingCooldown = 60;
@ -149,7 +149,7 @@
}
return true; // CraftBukkit
}
@@ -3258,7 +_,7 @@
@@ -3254,7 +_,7 @@
}
}
@ -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();
@ -188,7 +188,7 @@
}
public int getDimensionChangingDelay() {
@@ -3420,6 +_,11 @@
@@ -3416,6 +_,11 @@
@Nullable
public PlayerTeam getTeam() {
@ -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;
}
@ -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 @@
}
}
@ -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) {
@ -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
@ -1029,7 +1029,7 @@
}
public float rotate(Rotation transformRotation) {
@@ -4790,7 +_,8 @@
@@ -4786,7 +_,8 @@
}
}
// Paper end - Fix MC-4
@ -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
@ -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;
}
@ -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
@ -1071,7 +1071,7 @@
if (this.removalReason == null) {
this.removalReason = removalReason;
}
@@ -4937,6 +_,10 @@
@@ -4933,6 +_,10 @@
public void unsetRemoved() {
this.removalReason = null;
}

View File

@ -18,7 +18,7 @@
}
}
// Paper end - per world spawn limits
@@ -370,6 +_,7 @@
@@ -371,6 +_,7 @@
@Override
public Chunk getChunkAt(int x, int z) {
@ -26,7 +26,7 @@
warnUnsafeChunk("getting a faraway chunk", x, z); // Paper
net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk) this.world.getChunk(x, z, ChunkStatus.FULL, true);
return new CraftChunk(chunk);
@@ -400,10 +_,10 @@
@@ -401,10 +_,10 @@
@Override
public boolean isChunkGenerated(int x, int z) {
// Paper start - Fix this method
@ -39,7 +39,7 @@
}
ChunkAccess chunk = world.getChunkSource().getChunkAtImmediately(x, z);
if (chunk != null) {
@@ -460,7 +_,7 @@
@@ -461,7 +_,7 @@
}
private boolean unloadChunk0(int x, int z, boolean save) {
@ -48,7 +48,7 @@
if (!this.isChunkLoaded(x, z)) {
return true;
}
@@ -477,7 +_,7 @@
@@ -478,7 +_,7 @@
@Override
public boolean regenerateChunk(int x, int z) {
@ -57,7 +57,7 @@
throw new UnsupportedOperationException("Not supported in this Minecraft version! Unless you can fix it, this is not a bug :)");
/*
if (!unloadChunk0(x, z, false)) {
@@ -504,6 +_,7 @@
@@ -505,6 +_,7 @@
@Override
public boolean refreshChunk(int x, int z) {
@ -65,7 +65,7 @@
ChunkHolder playerChunk = this.world.getChunkSource().chunkMap.getVisibleChunkIfPresent(ChunkPos.asLong(x, z));
if (playerChunk == null) return false;
@@ -554,7 +_,7 @@
@@ -555,7 +_,7 @@
@Override
public boolean loadChunk(int x, int z, boolean generate) {
@ -74,7 +74,7 @@
warnUnsafeChunk("loading a faraway chunk", x, z); // Paper
ChunkAccess chunk = this.world.getChunkSource().getChunk(x, z, generate || isChunkGenerated(x, z) ? ChunkStatus.FULL : ChunkStatus.EMPTY, true); // Paper
@@ -594,7 +_,7 @@
@@ -595,7 +_,7 @@
final DistanceManager distanceManager = this.world.getChunkSource().chunkMap.distanceManager;
if (distanceManager.addPluginRegionTicket(new ChunkPos(x, z), plugin)) {
@ -83,7 +83,7 @@
return true;
}
@@ -648,21 +_,24 @@
@@ -649,21 +_,24 @@
@Override
public boolean isChunkForceLoaded(int x, int z) {
@ -109,7 +109,7 @@
}
return Collections.unmodifiableCollection(chunks);
@@ -782,13 +_,15 @@
@@ -783,13 +_,15 @@
@Override
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
@ -130,7 +130,7 @@
BlockPos position = ((CraftBlockState) blockstate).getPosition();
net.minecraft.world.level.block.state.BlockState oldBlock = this.world.getBlockState(position);
int flag = ((CraftBlockState) blockstate).getFlag();
@@ -796,10 +_,10 @@
@@ -797,10 +_,10 @@
net.minecraft.world.level.block.state.BlockState newBlock = this.world.getBlockState(position);
this.world.notifyAndUpdatePhysics(position, null, oldBlock, newBlock, newBlock, flag, 512);
}
@ -143,7 +143,7 @@
return false;
}
}
@@ -833,6 +_,7 @@
@@ -834,6 +_,7 @@
@Override
public void setTime(long time) {
@ -151,7 +151,7 @@
long margin = (time - this.getFullTime()) % 24000;
if (margin < 0) margin += 24000;
this.setFullTime(this.getFullTime() + margin);
@@ -845,6 +_,7 @@
@@ -846,6 +_,7 @@
@Override
public void setFullTime(long time) {
@ -159,7 +159,7 @@
// Notify anyone who's listening
TimeSkipEvent event = new TimeSkipEvent(this, TimeSkipEvent.SkipReason.CUSTOM, time - this.world.getDayTime());
this.server.getPluginManager().callEvent(event);
@@ -872,7 +_,7 @@
@@ -873,7 +_,7 @@
@Override
public long getGameTime() {
@ -168,7 +168,7 @@
}
@Override
@@ -897,6 +_,7 @@
@@ -898,6 +_,7 @@
}
public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, Entity source, Consumer<net.minecraft.world.level.ServerExplosion> configurator) {
// Paper end - expand explosion API
@ -176,7 +176,7 @@
net.minecraft.world.level.Level.ExplosionInteraction explosionType;
if (!breakBlocks) {
explosionType = net.minecraft.world.level.Level.ExplosionInteraction.NONE; // Don't break blocks
@@ -906,6 +_,7 @@
@@ -907,6 +_,7 @@
explosionType = net.minecraft.world.level.Level.ExplosionInteraction.MOB; // Respect mobGriefing gamerule
}
@ -184,7 +184,7 @@
net.minecraft.world.entity.Entity entity = (source == null) ? null : ((CraftEntity) source).getHandle();
return !this.world.explode0(entity, Explosion.getDefaultDamageSource(this.world, entity), null, x, y, z, power, setFire, explosionType, ParticleTypes.EXPLOSION, ParticleTypes.EXPLOSION_EMITTER, SoundEvents.GENERIC_EXPLODE, configurator).wasCanceled; // Paper - expand explosion API
}
@@ -988,6 +_,7 @@
@@ -989,6 +_,7 @@
@Override
public int getHighestBlockYAt(int x, int z, org.bukkit.HeightMap heightMap) {
@ -192,7 +192,7 @@
warnUnsafeChunk("getting a faraway chunk", x >> 4, z >> 4); // Paper
// Transient load for this tick
return this.world.getChunk(x >> 4, z >> 4).getHeight(CraftHeightMap.toNMS(heightMap), x, z);
@@ -1018,6 +_,7 @@
@@ -1019,6 +_,7 @@
@Override
public void setBiome(int x, int y, int z, Holder<net.minecraft.world.level.biome.Biome> bb) {
BlockPos pos = new BlockPos(x, 0, z);
@ -200,7 +200,7 @@
if (this.world.hasChunkAt(pos)) {
net.minecraft.world.level.chunk.LevelChunk chunk = this.world.getChunkAt(pos);
@@ -1348,6 +_,7 @@
@@ -1349,6 +_,7 @@
@Override
public void setStorm(boolean hasStorm) {
@ -208,7 +208,7 @@
this.world.serverLevelData.setRaining(hasStorm, org.bukkit.event.weather.WeatherChangeEvent.Cause.PLUGIN); // Paper - Add cause to Weather/ThunderChangeEvents
this.setWeatherDuration(0); // Reset weather duration (legacy behaviour)
this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands)
@@ -1360,6 +_,7 @@
@@ -1361,6 +_,7 @@
@Override
public void setWeatherDuration(int duration) {
@ -216,7 +216,7 @@
this.world.serverLevelData.setRainTime(duration);
}
@@ -1370,6 +_,7 @@
@@ -1371,6 +_,7 @@
@Override
public void setThundering(boolean thundering) {
@ -224,7 +224,7 @@
this.world.serverLevelData.setThundering(thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause.PLUGIN); // Paper - Add cause to Weather/ThunderChangeEvents
this.setThunderDuration(0); // Reset weather duration (legacy behaviour)
this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands)
@@ -1382,6 +_,7 @@
@@ -1383,6 +_,7 @@
@Override
public void setThunderDuration(int duration) {
@ -232,7 +232,7 @@
this.world.serverLevelData.setThunderTime(duration);
}
@@ -1392,6 +_,7 @@
@@ -1393,6 +_,7 @@
@Override
public void setClearWeatherDuration(int duration) {
@ -240,7 +240,7 @@
this.world.serverLevelData.setClearWeatherTime(duration);
}
@@ -1590,6 +_,7 @@
@@ -1591,6 +_,7 @@
@Override
public void setKeepSpawnInMemory(boolean keepLoaded) {
@ -248,7 +248,7 @@
if (keepLoaded) {
this.setGameRule(GameRule.SPAWN_CHUNK_RADIUS, this.getGameRuleDefault(GameRule.SPAWN_CHUNK_RADIUS));
} else {
@@ -1658,6 +_,7 @@
@@ -1659,6 +_,7 @@
@Override
public void setHardcore(boolean hardcore) {
@ -256,7 +256,7 @@
this.world.serverLevelData.settings.hardcore = hardcore;
}
@@ -1670,6 +_,7 @@
@@ -1671,6 +_,7 @@
@Override
@Deprecated
public void setTicksPerAnimalSpawns(int ticksPerAnimalSpawns) {
@ -264,7 +264,7 @@
this.setTicksPerSpawns(SpawnCategory.ANIMAL, ticksPerAnimalSpawns);
}
@@ -1682,6 +_,7 @@
@@ -1683,6 +_,7 @@
@Override
@Deprecated
public void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns) {
@ -272,7 +272,7 @@
this.setTicksPerSpawns(SpawnCategory.MONSTER, ticksPerMonsterSpawns);
}
@@ -1694,6 +_,7 @@
@@ -1695,6 +_,7 @@
@Override
@Deprecated
public void setTicksPerWaterSpawns(int ticksPerWaterSpawns) {
@ -280,7 +280,7 @@
this.setTicksPerSpawns(SpawnCategory.WATER_ANIMAL, ticksPerWaterSpawns);
}
@@ -1706,6 +_,7 @@
@@ -1707,6 +_,7 @@
@Override
@Deprecated
public void setTicksPerWaterAmbientSpawns(int ticksPerWaterAmbientSpawns) {
@ -288,7 +288,7 @@
this.setTicksPerSpawns(SpawnCategory.WATER_AMBIENT, ticksPerWaterAmbientSpawns);
}
@@ -1718,6 +_,7 @@
@@ -1719,6 +_,7 @@
@Override
@Deprecated
public void setTicksPerWaterUndergroundCreatureSpawns(int ticksPerWaterUndergroundCreatureSpawns) {
@ -296,7 +296,7 @@
this.setTicksPerSpawns(SpawnCategory.WATER_UNDERGROUND_CREATURE, ticksPerWaterUndergroundCreatureSpawns);
}
@@ -1730,11 +_,13 @@
@@ -1731,11 +_,13 @@
@Override
@Deprecated
public void setTicksPerAmbientSpawns(int ticksPerAmbientSpawns) {
@ -310,7 +310,7 @@
Preconditions.checkArgument(spawnCategory != null, "SpawnCategory cannot be null");
Preconditions.checkArgument(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory.%s are not supported", spawnCategory);
@@ -1751,21 +_,25 @@
@@ -1752,21 +_,25 @@
@Override
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
@ -336,7 +336,7 @@
this.server.getWorldMetadata().removeMetadata(this, metadataKey, owningPlugin);
}
@@ -1778,6 +_,7 @@
@@ -1779,6 +_,7 @@
@Override
@Deprecated
public void setMonsterSpawnLimit(int limit) {
@ -344,7 +344,7 @@
this.setSpawnLimit(SpawnCategory.MONSTER, limit);
}
@@ -1790,6 +_,7 @@
@@ -1791,6 +_,7 @@
@Override
@Deprecated
public void setAnimalSpawnLimit(int limit) {
@ -352,7 +352,7 @@
this.setSpawnLimit(SpawnCategory.ANIMAL, limit);
}
@@ -1802,6 +_,7 @@
@@ -1803,6 +_,7 @@
@Override
@Deprecated
public void setWaterAnimalSpawnLimit(int limit) {
@ -360,7 +360,7 @@
this.setSpawnLimit(SpawnCategory.WATER_ANIMAL, limit);
}
@@ -1814,6 +_,7 @@
@@ -1815,6 +_,7 @@
@Override
@Deprecated
public void setWaterAmbientSpawnLimit(int limit) {
@ -368,7 +368,7 @@
this.setSpawnLimit(SpawnCategory.WATER_AMBIENT, limit);
}
@@ -1826,6 +_,7 @@
@@ -1827,6 +_,7 @@
@Override
@Deprecated
public void setWaterUndergroundCreatureSpawnLimit(int limit) {
@ -376,7 +376,7 @@
this.setSpawnLimit(SpawnCategory.WATER_UNDERGROUND_CREATURE, limit);
}
@@ -1838,6 +_,7 @@
@@ -1839,6 +_,7 @@
@Override
@Deprecated
public void setAmbientSpawnLimit(int limit) {
@ -384,7 +384,7 @@
this.setSpawnLimit(SpawnCategory.AMBIENT, limit);
}
@@ -1860,6 +_,7 @@
@@ -1861,6 +_,7 @@
@Override
public void setSpawnLimit(SpawnCategory spawnCategory, int limit) {
@ -392,7 +392,7 @@
Preconditions.checkArgument(spawnCategory != null, "SpawnCategory cannot be null");
Preconditions.checkArgument(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory.%s are not supported", spawnCategory);
@@ -1942,7 +_,7 @@
@@ -1943,7 +_,7 @@
if (!(entity instanceof CraftEntity craftEntity) || entity.getWorld() != this || sound == null || category == null) return;
ClientboundSoundEntityPacket packet = new ClientboundSoundEntityPacket(CraftSound.bukkitToMinecraftHolder(sound), net.minecraft.sounds.SoundSource.valueOf(category.name()), craftEntity.getHandle(), volume, pitch, seed);
@ -401,7 +401,7 @@
if (entityTracker != null) {
entityTracker.broadcastAndSend(packet);
}
@@ -1963,7 +_,7 @@
@@ -1964,7 +_,7 @@
if (!(entity instanceof CraftEntity craftEntity) || entity.getWorld() != this || sound == null || category == null) return;
ClientboundSoundEntityPacket packet = new ClientboundSoundEntityPacket(Holder.direct(SoundEvent.createVariableRangeEvent(ResourceLocation.parse(sound))), net.minecraft.sounds.SoundSource.valueOf(category.name()), craftEntity.getHandle(), volume, pitch, seed);
@ -410,7 +410,7 @@
if (entityTracker != null) {
entityTracker.broadcastAndSend(packet);
}
@@ -2046,6 +_,7 @@
@@ -2047,6 +_,7 @@
@Override
public boolean setGameRuleValue(String rule, String value) {
@ -418,7 +418,7 @@
// No null values allowed
if (rule == null || value == null) return false;
@@ -2088,6 +_,7 @@
@@ -2089,6 +_,7 @@
@Override
public <T> boolean setGameRule(GameRule<T> rule, T newValue) {
@ -426,7 +426,7 @@
Preconditions.checkArgument(rule != null, "GameRule cannot be null");
Preconditions.checkArgument(newValue != null, "GameRule value cannot be null");
@@ -2315,6 +_,12 @@
@@ -2316,6 +_,12 @@
@Override
public void sendGameEvent(Entity sourceEntity, org.bukkit.GameEvent gameEvent, Vector position) {

View File

@ -2,7 +2,7 @@ group=dev.folia
version=1.21.4-R0.1-SNAPSHOT
mcVersion=1.21.4
paperRef=1004374a83efcc730876d41b80288359c993ae0e
paperRef=54b2e9d9738ce32e2f415c321f20e3fc07063c14
org.gradle.configuration-cache=true
org.gradle.caching=true