Update to latest Paper 1.20.4

This commit is contained in:
Spottedleaf 2024-05-09 16:36:04 -07:00
parent 25ee657a82
commit 46d3ab50b4
11 changed files with 461 additions and 462 deletions

View File

@ -2,7 +2,7 @@ group=dev.folia
version=1.20.4-R0.1-SNAPSHOT
mcVersion=1.20.4
paperRef=5436d44bf2509ff89129f8790ee4643f09c72871
paperRef=7ac24a18940da12beb39a030113f6e459f348e2f
org.gradle.caching=true
org.gradle.parallel=true

View File

@ -93,7 +93,7 @@ index 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..e2f704c115fd6e00960bb56bb0779f11
).openBufferedStream()) {
JsonObject json = new Gson().fromJson(reader, JsonObject.class);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index c8772c773f9933ed1d1debfe707af4373c458152..50055e362a0de853c169a38c6cbd8681b73fc96d 100644
index 2dc07e5ef249636e85ad9c78e3729e9e066a8fe8..6c42592bfaf85f23f7ff9966d7869aa0237f59c5 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1865,7 +1865,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -5,29 +5,32 @@ Subject: [PATCH] MC-Dev fixes
diff --git a/src/main/java/net/minecraft/world/entity/ai/Brain.java b/src/main/java/net/minecraft/world/entity/ai/Brain.java
index dea20f16ac97402f754c8e47d03e9ef38de73190..21e5d1451f90194aa415cf0a183d1a731854f605 100644
index afbb027021acfbe25d534a84f1750e420bbde6e0..af6f91c66e9cc7e0d491e6efed992a140947155e 100644
--- a/src/main/java/net/minecraft/world/entity/ai/Brain.java
+++ b/src/main/java/net/minecraft/world/entity/ai/Brain.java
@@ -72,15 +72,15 @@ public class Brain<E extends LivingEntity> {
}
@@ -79,7 +79,7 @@ public class Brain<E extends LivingEntity> {
}
public <T> DataResult<Brain<E>> decode(DynamicOps<T> dynamicOps, MapLike<T> mapLike) {
- MutableObject<DataResult<ImmutableList.Builder<Brain.MemoryValue<?>>>> mutableObject = new MutableObject<>(DataResult.success(ImmutableList.builder()));
+ MutableObject<DataResult<ImmutableList.Builder<Brain.MemoryValue<?>>>> mutableObject2 = new MutableObject<>(DataResult.success(ImmutableList.builder())); // Folia - decompile fix
mapLike.entries().forEach((pair) -> {
DataResult<MemoryModuleType<?>> dataResult = BuiltInRegistries.MEMORY_MODULE_TYPE.byNameCodec().parse(dynamicOps, pair.getFirst());
DataResult<? extends Brain.MemoryValue<?>> dataResult2 = dataResult.flatMap((memoryType) -> {
return this.captureRead(memoryType, dynamicOps, (T)pair.getSecond());
});
- mutableObject.setValue(mutableObject.getValue().apply2(ImmutableList.Builder::add, dataResult2));
+ mutableObject2.setValue(mutableObject2.getValue().apply2(ImmutableList.Builder::add, dataResult2)); // Folia - decompile fix
});
- ImmutableList<Brain.MemoryValue<?>> immutableList = mutableObject.getValue().resultOrPartial(Brain.LOGGER::error).map(ImmutableList.Builder::build).orElseGet(ImmutableList::of);
+ ImmutableList<Brain.MemoryValue<?>> immutableList = mutableObject2.getValue().resultOrPartial(Brain.LOGGER::error).map(ImmutableList.Builder::build).orElseGet(ImmutableList::of); // Folia - decompile fix
return DataResult.success(new Brain<>(memoryModules, sensors, immutableList, mutableObject::getValue));
}
@@ -181,14 +181,14 @@ public class Brain<E extends LivingEntity> {
public <T> DataResult<Brain<E>> decode(DynamicOps<T> dynamicOps, MapLike<T> mapLike) {
- MutableObject<DataResult<Builder<Brain.MemoryValue<?>>>> mutableObject = new MutableObject<>(
+ MutableObject<DataResult<Builder<Brain.MemoryValue<?>>>> mutableObject2 = new MutableObject<>( // Folia - decompile fix
DataResult.success(ImmutableList.builder())
);
mapLike.entries()
@@ -91,10 +91,10 @@ public class Brain<E extends LivingEntity> {
DataResult<? extends Brain.MemoryValue<?>> dataResult2 = dataResult.flatMap(
memoryType -> this.captureRead((MemoryModuleType<T>)memoryType, dynamicOps, (T)pair.getSecond())
);
- mutableObject.setValue(mutableObject.getValue().apply2(Builder::add, dataResult2));
+ mutableObject2.setValue(mutableObject2.getValue().apply2(Builder::add, dataResult2)); // Folia - decompile fix
}
);
- ImmutableList<Brain.MemoryValue<?>> immutableList = mutableObject.getValue()
+ ImmutableList<Brain.MemoryValue<?>> immutableList = mutableObject2.getValue() // Folia - decompile fix
.resultOrPartial(Brain.LOGGER::error)
.map(Builder::build)
.orElseGet(ImmutableList::of);
@@ -194,14 +194,14 @@ public class Brain<E extends LivingEntity> {
if (optional == null) {
throw new IllegalStateException("Unregistered memory fetched: " + type);
} else {
@ -44,12 +47,3 @@ index dea20f16ac97402f754c8e47d03e9ef38de73190..21e5d1451f90194aa415cf0a183d1a73
}
public <U> long getTimeUntilExpiry(MemoryModuleType<U> type) {
@@ -483,7 +483,7 @@ public class Brain<E extends LivingEntity> {
private final Optional<? extends ExpirableValue<U>> value;
static <U> Brain.MemoryValue<U> createUnchecked(MemoryModuleType<U> type, Optional<? extends ExpirableValue<?>> data) {
- return new Brain.MemoryValue<>(type, data);
+ return new Brain.MemoryValue<>(type, (Optional<? extends ExpirableValue<U>>)data); // Folia - decompile fix
}
MemoryValue(MemoryModuleType<U> type, Optional<? extends ExpirableValue<U>> data) {

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,7 @@ index 41bf71d116ffc5431586ce54abba7f8def6c1dcf..519da6886613b8460e989767b1a21e31
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 518487d4cd489110bebcf75078935a95b5d3e9cf..1119b6a7f307763c13ef48bcd7643539082aebdc 100644
index fe07f0881f5835974f00c65498a31a19c8ead97c..0e71fa29ebfa649bc23899046396a6b01c4bd131 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2930,6 +2930,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@ -2140,10 +2140,10 @@ index 2638c341bc02f201f7ab17fdebcdbdf3a7ec05bf..0f5c2d31a2dea13a46ba81e353393633
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 8db8ceb161557b9803c3bda80f3e57b8626191c3..b0a70287ff1fc9b3d5eba322d949aaf510b165d2 100644
index 232490c970d67e6bc77a35d5ccfef8fa95646ffe..0ece776a1e281a328e28dc07fb4dc882b19d029c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -580,7 +580,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -582,7 +582,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void kick(net.kyori.adventure.text.Component message, org.bukkit.event.player.PlayerKickEvent.Cause cause) {
@ -2152,7 +2152,7 @@ index 8db8ceb161557b9803c3bda80f3e57b8626191c3..b0a70287ff1fc9b3d5eba322d949aaf5
final ServerGamePacketListenerImpl connection = this.getHandle().connection;
if (connection != null) {
connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message, cause);
@@ -2207,9 +2207,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2209,9 +2209,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this;
}
@ -2170,7 +2170,7 @@ index 8db8ceb161557b9803c3bda80f3e57b8626191c3..b0a70287ff1fc9b3d5eba322d949aaf5
}
public void setHandle(final ServerPlayer entity) {
@@ -3264,7 +3271,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3266,7 +3273,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
{
if ( CraftPlayer.this.getHealth() <= 0 && CraftPlayer.this.isOnline() )
{

View File

@ -10,7 +10,7 @@ the impact from scaling the region threads, but is not a fix
to the underlying issue.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index cf06989ad1ab55bf6836abe4cdeed2fff31ac93f..82b18aebb7c1472efdadc4b2e959fbdb3116fbe3 100644
index 4e94de4a3184fd36119bf39beccff62ac561c1e4..2bd923c61642edf67338471d0578609039a51822 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1476,6 +1476,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

View File

@ -69,7 +69,7 @@ index 7f33db05284a957690eac6eb6f5b3b05586727bb..cdf9434635e6d3d15e003f1f6e6a3be7
BlockState iblockdata1 = world.getBlockState(blockposition_mutableblockposition);
diff --git a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
index de048d920452b04922871eaaafacd1abd0ee21b7..7c3688849eaad93085cd3510a5a62823a19d649f 100644
index 67be58de9f684e440b62541365c079cfffe30e51..a6bc5c5053f1fce822166d0cd1ea67dc490dc0af 100644
--- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
+++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
@@ -119,7 +119,8 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
@ -88,10 +88,10 @@ index de048d920452b04922871eaaafacd1abd0ee21b7..7c3688849eaad93085cd3510a5a62823
// Paper end - Call BlockPhysicsEvent
+ } // Folia - block updates in unloaded chunks
if (this.idx < NeighborUpdater.UPDATE_ORDER.length && NeighborUpdater.UPDATE_ORDER[this.idx] == this.skipDirection) {
++this.idx;
this.idx++;
}
@@ -149,7 +151,9 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
static record ShapeUpdate(Direction direction, BlockState state, BlockPos pos, BlockPos neighborPos, int updateFlags, int updateLimit) implements CollectingNeighborUpdater.NeighborUpdates {
@@ -150,7 +152,9 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
implements CollectingNeighborUpdater.NeighborUpdates {
@Override
public boolean runNext(Level world) {
+ if (io.papermc.paper.util.TickThread.isTickThreadFor((net.minecraft.server.level.ServerLevel)world, this.pos) && world.getChunkIfLoaded(this.pos) != null) { // Folia - block updates in unloaded chunks
@ -100,7 +100,7 @@ index de048d920452b04922871eaaafacd1abd0ee21b7..7c3688849eaad93085cd3510a5a62823
return false;
}
}
@@ -157,8 +161,8 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
@@ -158,8 +162,8 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
static record SimpleNeighborUpdate(BlockPos pos, Block block, BlockPos neighborPos) implements CollectingNeighborUpdater.NeighborUpdates {
@Override
public boolean runNext(Level world) {

View File

@ -7,10 +7,10 @@ The returned TE may be in the world, in which case it is unsafe
for the current thread to modify or access its contents.
diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
index 4a3ac7dedf5cb1e76f16ec4f18e82afc717d0ced..44609fb7965a03283e2bb50e483a8f60254de510 100644
index b4e05ce176dfc6a2e66b294ed461c32020adf203..10429dfb6f2ec6aaffa7d71c4d32666ec6f65636 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
@@ -84,6 +84,11 @@ public class ImposterProtoChunk extends ProtoChunk {
@@ -90,6 +90,11 @@ public class ImposterProtoChunk extends ProtoChunk {
@Nullable
@Override
public BlockEntity getBlockEntity(BlockPos pos) {

View File

@ -9,7 +9,7 @@ engine compared to the POI access. This should make it safe for
off-region access.
diff --git a/src/main/java/net/minecraft/world/item/CompassItem.java b/src/main/java/net/minecraft/world/item/CompassItem.java
index b3c67c954acf7e518d89d6af65a55d6f22dac059..eea1066379805a4bdef9b496a92ad956d0c84ac7 100644
index 0f3621483a6ddcaeeb25eac51dbfaad41933579a..1086652ae74527c71153053c2e079c1c85d8b5ce 100644
--- a/src/main/java/net/minecraft/world/item/CompassItem.java
+++ b/src/main/java/net/minecraft/world/item/CompassItem.java
@@ -77,7 +77,10 @@ public class CompassItem extends Item implements Vanishable {

View File

@ -9,10 +9,10 @@ raid before it's completion, it would throw an exception due to not being on the
same region thread anymore.
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java
index 8fc22de1aa17cd8cb52d3804533d56cbb0e6bfeb..49c0f085756889a176684922206b27ca0c660949 100644
index 2905dab1f9b3dd846261c5b0777d073927882825..488ff78fd704b8a87b7012c3c4f66814dff97e1b 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raid.java
+++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java
@@ -410,14 +410,22 @@ public class Raid {
@@ -420,14 +420,22 @@ public class Raid {
LivingEntity entityliving = (LivingEntity) entity;
if (!entity.isSpectator()) {

View File

@ -1376,7 +1376,7 @@ index 1192503d2729b3f14aa2936c2060df9884870cb4..632c5ba694a37159d5297f6af885408a
label25:
{
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 82b18aebb7c1472efdadc4b2e959fbdb3116fbe3..453bb595d31c6dea1cfb135f43ffe71e4ae44112 100644
index 2bd923c61642edf67338471d0578609039a51822..bcc8a0171f981e2b2e24dd57834701c1899ab4c9 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1592,6 +1592,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -1886,10 +1886,10 @@ index 38ff839aa25fa2b7397f6fc6e3eadda7ae600d48..3cd8573db9dadb2e32f3c107f4812b52
this.timings.tileEntityTick.stopTiming(); // Spigot
regionizedWorldData.seTtickingBlockEntities(false); // Folia - regionised ticking
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java
index 2e110da3502a7ac5ec4cc20510a3fac933569895..5aac65f37a0190c5d6a7175073fb0cc0f129de11 100644
index 86b661de30e134258b6b74a78e8ea05fd8224aed..37938d0e116982915f470b3d2b233c74d501bb0f 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntityType.java
@@ -80,10 +80,17 @@ public class BlockEntityType<T extends BlockEntity> {
@@ -281,10 +281,17 @@ public class BlockEntityType<T extends BlockEntity> {
}
Type<?> type = Util.fetchChoiceType(References.BLOCK_ENTITY, id);
@ -1908,7 +1908,7 @@ index 2e110da3502a7ac5ec4cc20510a3fac933569895..5aac65f37a0190c5d6a7175073fb0cc0
this.factory = factory;
this.validBlocks = blocks;
this.dataType = type;
@@ -128,7 +135,12 @@ public class BlockEntityType<T extends BlockEntity> {
@@ -329,7 +336,12 @@ public class BlockEntityType<T extends BlockEntity> {
}
public BlockEntityType<T> build(Type<?> type) {
@ -1950,10 +1950,10 @@ index ff1a7b78fa010857daab7a306cb9483c98560b79..8c6ade7cf14e367d6390849ef1b2a1bf
gameprofilerfiller.pop();
} catch (Throwable throwable) {
diff --git a/src/main/java/net/minecraft/world/ticks/LevelTicks.java b/src/main/java/net/minecraft/world/ticks/LevelTicks.java
index f3df9c9b6cff85565514f990597f3fe53652812c..860124fdafa8abc280039cbd7cf7968106920b24 100644
index f71661ef4250d3b668fffeea7cd74a28eec95acd..71b13d6b4c1c3db272ccd7c021af00c34c5a0956 100644
--- a/src/main/java/net/minecraft/world/ticks/LevelTicks.java
+++ b/src/main/java/net/minecraft/world/ticks/LevelTicks.java
@@ -255,6 +255,12 @@ public class LevelTicks<T> implements LevelTickAccess<T> {
@@ -250,6 +250,12 @@ public class LevelTicks<T> implements LevelTickAccess<T> {
}
private void runCollectedTicks(BiConsumer<BlockPos, T> ticker) {
@ -1963,6 +1963,6 @@ index f3df9c9b6cff85565514f990597f3fe53652812c..860124fdafa8abc280039cbd7cf79681
+ (long)this.toRunThisTick.size()
+ );
+ // Folia end - profiler
while(!this.toRunThisTick.isEmpty()) {
while (!this.toRunThisTick.isEmpty()) {
ScheduledTick<T> scheduledTick = this.toRunThisTick.poll();
if (!this.toRunThisTickSet.isEmpty()) {