mirror of
https://github.com/PaperMC/Folia.git
synced 2025-04-22 20:29:19 +08:00
Update Paper
This commit is contained in:
parent
2dac12e8c8
commit
710d77e354
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/damagesource/DamageSource.java
|
||||
+++ b/net/minecraft/world/damagesource/DamageSource.java
|
||||
@@ -178,12 +_,12 @@
|
||||
@@ -163,12 +_,12 @@
|
||||
if (this.causingEntity == null && this.directEntity == null) {
|
||||
LivingEntity killCredit = livingEntity.getKillCredit();
|
||||
String string1 = string + ".player";
|
||||
|
@ -13,8 +13,8 @@
|
||||
public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper - Entity#getEntitySpawnReason
|
||||
|
||||
public boolean collisionLoadChunks = false; // Paper
|
||||
- private org.bukkit.craftbukkit.entity.CraftEntity bukkitEntity;
|
||||
+ private volatile org.bukkit.craftbukkit.entity.CraftEntity bukkitEntity; // Folia - region threading
|
||||
- private @Nullable org.bukkit.craftbukkit.entity.CraftEntity bukkitEntity;
|
||||
+ private volatile @Nullable org.bukkit.craftbukkit.entity.CraftEntity bukkitEntity; // Folia - region threading
|
||||
|
||||
public org.bukkit.craftbukkit.entity.CraftEntity getBukkitEntity() {
|
||||
if (this.bukkitEntity == null) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1504,6 +_,14 @@
|
||||
@@ -1506,6 +_,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
+ // damage player
|
||||
+ teleported.resetFallDistance();
|
||||
+ player.resetCurrentImpulseContext();
|
||||
+ player.hurtServer(player.serverLevel(), player.damageSources().enderPearl().customEventDamager(player), 5.0F); // CraftBukkit // Paper - fix DamageSource API
|
||||
+ player.hurtServer(player.serverLevel(), player.damageSources().enderPearl().eventEntityDamager(player), 5.0F); // CraftBukkit // Paper - fix DamageSource API
|
||||
+ playSound(teleported.level(), to);
|
||||
+ } else {
|
||||
+ // reset fall damage so that if the entity was falling they do not instantly die
|
||||
|
@ -48,16 +48,7 @@
|
||||
if (!this.isChunkLoaded(x, z)) {
|
||||
return true;
|
||||
}
|
||||
@@ -472,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public boolean regenerateChunk(int x, int z) {
|
||||
- org.spigotmc.AsyncCatcher.catchOp("chunk regenerate"); // Spigot
|
||||
+ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this.world, x, z, "Cannot regenerate chunk asynchronously"); // Folia - region threading
|
||||
throw new UnsupportedOperationException("Not supported in this Minecraft version! Unless you can fix it, this is not a bug :)");
|
||||
/*
|
||||
if (!unloadChunk0(x, z, false)) {
|
||||
@@ -499,6 +_,7 @@
|
||||
@@ -472,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public boolean refreshChunk(int x, int z) {
|
||||
@ -65,7 +56,7 @@
|
||||
ChunkHolder playerChunk = this.world.getChunkSource().chunkMap.getVisibleChunkIfPresent(ChunkPos.asLong(x, z));
|
||||
if (playerChunk == null) return false;
|
||||
|
||||
@@ -549,7 +_,7 @@
|
||||
@@ -522,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public boolean loadChunk(int x, int z, boolean generate) {
|
||||
@ -74,7 +65,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
|
||||
|
||||
@@ -589,7 +_,7 @@
|
||||
@@ -562,7 +_,7 @@
|
||||
|
||||
final DistanceManager distanceManager = this.world.getChunkSource().chunkMap.distanceManager;
|
||||
if (distanceManager.addPluginRegionTicket(new ChunkPos(x, z), plugin)) {
|
||||
@ -83,7 +74,7 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -643,21 +_,24 @@
|
||||
@@ -616,21 +_,24 @@
|
||||
|
||||
@Override
|
||||
public boolean isChunkForceLoaded(int x, int z) {
|
||||
@ -109,7 +100,7 @@
|
||||
}
|
||||
|
||||
return Collections.unmodifiableCollection(chunks);
|
||||
@@ -777,13 +_,15 @@
|
||||
@@ -750,13 +_,15 @@
|
||||
|
||||
@Override
|
||||
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
|
||||
@ -130,7 +121,7 @@
|
||||
BlockPos position = ((CraftBlockState) blockstate).getPosition();
|
||||
net.minecraft.world.level.block.state.BlockState oldBlock = this.world.getBlockState(position);
|
||||
int flag = ((CraftBlockState) blockstate).getFlag();
|
||||
@@ -791,10 +_,10 @@
|
||||
@@ -764,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 +134,7 @@
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -828,6 +_,7 @@
|
||||
@@ -801,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void setTime(long time) {
|
||||
@ -151,7 +142,7 @@
|
||||
long margin = (time - this.getFullTime()) % 24000;
|
||||
if (margin < 0) margin += 24000;
|
||||
this.setFullTime(this.getFullTime() + margin);
|
||||
@@ -840,6 +_,7 @@
|
||||
@@ -813,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void setFullTime(long time) {
|
||||
@ -159,7 +150,7 @@
|
||||
// Notify anyone who's listening
|
||||
TimeSkipEvent event = new TimeSkipEvent(this, TimeSkipEvent.SkipReason.CUSTOM, time - this.world.getDayTime());
|
||||
this.server.getPluginManager().callEvent(event);
|
||||
@@ -867,7 +_,7 @@
|
||||
@@ -840,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public long getGameTime() {
|
||||
@ -168,7 +159,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -892,6 +_,7 @@
|
||||
@@ -865,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 +167,7 @@
|
||||
net.minecraft.world.level.Level.ExplosionInteraction explosionType;
|
||||
if (!breakBlocks) {
|
||||
explosionType = net.minecraft.world.level.Level.ExplosionInteraction.NONE; // Don't break blocks
|
||||
@@ -901,6 +_,7 @@
|
||||
@@ -874,6 +_,7 @@
|
||||
explosionType = net.minecraft.world.level.Level.ExplosionInteraction.MOB; // Respect mobGriefing gamerule
|
||||
}
|
||||
|
||||
@ -184,7 +175,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
|
||||
}
|
||||
@@ -983,6 +_,7 @@
|
||||
@@ -956,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public int getHighestBlockYAt(int x, int z, org.bukkit.HeightMap heightMap) {
|
||||
@ -192,7 +183,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);
|
||||
@@ -1013,6 +_,7 @@
|
||||
@@ -986,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 +191,7 @@
|
||||
if (this.world.hasChunkAt(pos)) {
|
||||
net.minecraft.world.level.chunk.LevelChunk chunk = this.world.getChunkAt(pos);
|
||||
|
||||
@@ -1343,6 +_,7 @@
|
||||
@@ -1316,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void setStorm(boolean hasStorm) {
|
||||
@ -208,7 +199,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)
|
||||
@@ -1355,6 +_,7 @@
|
||||
@@ -1328,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void setWeatherDuration(int duration) {
|
||||
@ -216,7 +207,7 @@
|
||||
this.world.serverLevelData.setRainTime(duration);
|
||||
}
|
||||
|
||||
@@ -1365,6 +_,7 @@
|
||||
@@ -1338,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void setThundering(boolean thundering) {
|
||||
@ -224,7 +215,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)
|
||||
@@ -1377,6 +_,7 @@
|
||||
@@ -1350,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void setThunderDuration(int duration) {
|
||||
@ -232,7 +223,7 @@
|
||||
this.world.serverLevelData.setThunderTime(duration);
|
||||
}
|
||||
|
||||
@@ -1387,6 +_,7 @@
|
||||
@@ -1360,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void setClearWeatherDuration(int duration) {
|
||||
@ -240,7 +231,7 @@
|
||||
this.world.serverLevelData.setClearWeatherTime(duration);
|
||||
}
|
||||
|
||||
@@ -1585,6 +_,7 @@
|
||||
@@ -1558,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void setKeepSpawnInMemory(boolean keepLoaded) {
|
||||
@ -248,7 +239,7 @@
|
||||
if (keepLoaded) {
|
||||
this.setGameRule(GameRule.SPAWN_CHUNK_RADIUS, this.getGameRuleDefault(GameRule.SPAWN_CHUNK_RADIUS));
|
||||
} else {
|
||||
@@ -1653,6 +_,7 @@
|
||||
@@ -1626,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void setHardcore(boolean hardcore) {
|
||||
@ -256,7 +247,7 @@
|
||||
this.world.serverLevelData.settings.hardcore = hardcore;
|
||||
}
|
||||
|
||||
@@ -1665,6 +_,7 @@
|
||||
@@ -1638,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setTicksPerAnimalSpawns(int ticksPerAnimalSpawns) {
|
||||
@ -264,7 +255,7 @@
|
||||
this.setTicksPerSpawns(SpawnCategory.ANIMAL, ticksPerAnimalSpawns);
|
||||
}
|
||||
|
||||
@@ -1677,6 +_,7 @@
|
||||
@@ -1650,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns) {
|
||||
@ -272,7 +263,7 @@
|
||||
this.setTicksPerSpawns(SpawnCategory.MONSTER, ticksPerMonsterSpawns);
|
||||
}
|
||||
|
||||
@@ -1689,6 +_,7 @@
|
||||
@@ -1662,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setTicksPerWaterSpawns(int ticksPerWaterSpawns) {
|
||||
@ -280,7 +271,7 @@
|
||||
this.setTicksPerSpawns(SpawnCategory.WATER_ANIMAL, ticksPerWaterSpawns);
|
||||
}
|
||||
|
||||
@@ -1701,6 +_,7 @@
|
||||
@@ -1674,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setTicksPerWaterAmbientSpawns(int ticksPerWaterAmbientSpawns) {
|
||||
@ -288,7 +279,7 @@
|
||||
this.setTicksPerSpawns(SpawnCategory.WATER_AMBIENT, ticksPerWaterAmbientSpawns);
|
||||
}
|
||||
|
||||
@@ -1713,6 +_,7 @@
|
||||
@@ -1686,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setTicksPerWaterUndergroundCreatureSpawns(int ticksPerWaterUndergroundCreatureSpawns) {
|
||||
@ -296,7 +287,7 @@
|
||||
this.setTicksPerSpawns(SpawnCategory.WATER_UNDERGROUND_CREATURE, ticksPerWaterUndergroundCreatureSpawns);
|
||||
}
|
||||
|
||||
@@ -1725,11 +_,13 @@
|
||||
@@ -1698,11 +_,13 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setTicksPerAmbientSpawns(int ticksPerAmbientSpawns) {
|
||||
@ -310,7 +301,7 @@
|
||||
Preconditions.checkArgument(spawnCategory != null, "SpawnCategory cannot be null");
|
||||
Preconditions.checkArgument(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory.%s are not supported", spawnCategory);
|
||||
|
||||
@@ -1746,21 +_,25 @@
|
||||
@@ -1719,21 +_,25 @@
|
||||
|
||||
@Override
|
||||
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
|
||||
@ -336,7 +327,7 @@
|
||||
this.server.getWorldMetadata().removeMetadata(this, metadataKey, owningPlugin);
|
||||
}
|
||||
|
||||
@@ -1773,6 +_,7 @@
|
||||
@@ -1746,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setMonsterSpawnLimit(int limit) {
|
||||
@ -344,7 +335,7 @@
|
||||
this.setSpawnLimit(SpawnCategory.MONSTER, limit);
|
||||
}
|
||||
|
||||
@@ -1785,6 +_,7 @@
|
||||
@@ -1758,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setAnimalSpawnLimit(int limit) {
|
||||
@ -352,7 +343,7 @@
|
||||
this.setSpawnLimit(SpawnCategory.ANIMAL, limit);
|
||||
}
|
||||
|
||||
@@ -1797,6 +_,7 @@
|
||||
@@ -1770,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setWaterAnimalSpawnLimit(int limit) {
|
||||
@ -360,7 +351,7 @@
|
||||
this.setSpawnLimit(SpawnCategory.WATER_ANIMAL, limit);
|
||||
}
|
||||
|
||||
@@ -1809,6 +_,7 @@
|
||||
@@ -1782,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setWaterAmbientSpawnLimit(int limit) {
|
||||
@ -368,7 +359,7 @@
|
||||
this.setSpawnLimit(SpawnCategory.WATER_AMBIENT, limit);
|
||||
}
|
||||
|
||||
@@ -1821,6 +_,7 @@
|
||||
@@ -1794,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setWaterUndergroundCreatureSpawnLimit(int limit) {
|
||||
@ -376,7 +367,7 @@
|
||||
this.setSpawnLimit(SpawnCategory.WATER_UNDERGROUND_CREATURE, limit);
|
||||
}
|
||||
|
||||
@@ -1833,6 +_,7 @@
|
||||
@@ -1806,6 +_,7 @@
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setAmbientSpawnLimit(int limit) {
|
||||
@ -384,7 +375,7 @@
|
||||
this.setSpawnLimit(SpawnCategory.AMBIENT, limit);
|
||||
}
|
||||
|
||||
@@ -1855,6 +_,7 @@
|
||||
@@ -1828,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void setSpawnLimit(SpawnCategory spawnCategory, int limit) {
|
||||
@ -392,7 +383,7 @@
|
||||
Preconditions.checkArgument(spawnCategory != null, "SpawnCategory cannot be null");
|
||||
Preconditions.checkArgument(CraftSpawnCategory.isValidForLimits(spawnCategory), "SpawnCategory.%s are not supported", spawnCategory);
|
||||
|
||||
@@ -1937,7 +_,7 @@
|
||||
@@ -1910,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 +392,7 @@
|
||||
if (entityTracker != null) {
|
||||
entityTracker.broadcastAndSend(packet);
|
||||
}
|
||||
@@ -1958,7 +_,7 @@
|
||||
@@ -1931,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 +401,7 @@
|
||||
if (entityTracker != null) {
|
||||
entityTracker.broadcastAndSend(packet);
|
||||
}
|
||||
@@ -2041,6 +_,7 @@
|
||||
@@ -2014,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public boolean setGameRuleValue(String rule, String value) {
|
||||
@ -418,7 +409,7 @@
|
||||
// No null values allowed
|
||||
if (rule == null || value == null) return false;
|
||||
|
||||
@@ -2089,6 +_,7 @@
|
||||
@@ -2062,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public <T> boolean setGameRule(GameRule<T> rule, T newValue) {
|
||||
@ -426,7 +417,7 @@
|
||||
Preconditions.checkArgument(rule != null, "GameRule cannot be null");
|
||||
Preconditions.checkArgument(newValue != null, "GameRule value cannot be null");
|
||||
|
||||
@@ -2316,6 +_,12 @@
|
||||
@@ -2289,6 +_,12 @@
|
||||
|
||||
@Override
|
||||
public void sendGameEvent(Entity sourceEntity, org.bukkit.GameEvent gameEvent, Vector position) {
|
||||
|
@ -18,7 +18,7 @@
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
@@ -2230,7 +_,7 @@
|
||||
@@ -2232,7 +_,7 @@
|
||||
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemStack.copyWithCount(1));
|
||||
|
||||
org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(bukkitBlock, craftItem.clone(), CraftVector.toBukkit(to));
|
||||
|
@ -2,7 +2,7 @@ group=dev.folia
|
||||
version=1.21.4-R0.1-SNAPSHOT
|
||||
mcVersion=1.21.4
|
||||
|
||||
paperRef=46f4fdaae3661941ac86f2157e625d907fdd8e81
|
||||
paperRef=b9023b5dc3dbc2f9d19898f73e503bddde364bcf
|
||||
|
||||
org.gradle.configuration-cache=true
|
||||
org.gradle.caching=true
|
||||
|
Loading…
x
Reference in New Issue
Block a user