diff --git a/gradle.properties b/gradle.properties index ef9be81d..ae0d6af2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,6 +3,6 @@ version=1.21-R0.1-SNAPSHOT mcVersion=1.21 org.gradle.jvmargs=-Xmx2G -paperRef=76c2f16f577d2e5515482a8dcd3d97aeeec20e1e +paperRef=dd49fba8c534d48c3693a751075ecb5836a9d458 preVersion=true updatingMinecraft=true \ No newline at end of file diff --git a/patches/server/0004-Leaves-Server-Utils.patch b/patches/server/0004-Leaves-Server-Utils.patch index 6341257f..eda11779 100644 --- a/patches/server/0004-Leaves-Server-Utils.patch +++ b/patches/server/0004-Leaves-Server-Utils.patch @@ -31,7 +31,7 @@ index 46954db7ecd35ac4018fdf476df7c8020d7ce6c8..044c51ebb058fc36074fd178929e3279 public PlayerAreaMap() { super(); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 1a40128b06e70e39a82f170fc16dcae1e22c745c..c050b6f432c875cb417ee67727560843f6ff3871 100644 +index 2519c08a45ce3febcf51ac308ad98ac0e2657cf3..bbfe8457119b76abb60653360fc272aa4580b349 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -429,6 +429,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -62,7 +62,7 @@ index 1a40128b06e70e39a82f170fc16dcae1e22c745c..c050b6f432c875cb417ee67727560843 } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT"); -@@ -4819,4 +4826,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4820,4 +4827,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return ((net.minecraft.server.level.ServerChunkCache) level.getChunkSource()).isPositionTicking(this); } // Paper end - Expose entity id counter diff --git a/patches/server/0032-Reduce-entity-fluid-lookups-if-no-fluids.patch b/patches/server/0032-Reduce-entity-fluid-lookups-if-no-fluids.patch index e512df1a..ddeada15 100644 --- a/patches/server/0032-Reduce-entity-fluid-lookups-if-no-fluids.patch +++ b/patches/server/0032-Reduce-entity-fluid-lookups-if-no-fluids.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Reduce entity fluid lookups if no fluids This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index e383b9e97396a2b469a963ef3c246ae31462a537..a753c4817cb50aa4026b7961da93f440c7d11d72 100644 +index 215cb9765bc1f0c5c520757db3e3224ce207b7e1..e65970fbd915cecad1a8820055dbe90a9b5c2199 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -4290,16 +4290,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4291,16 +4291,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public boolean updateFluidHeightAndDoFluidPushing(TagKey tag, double speed) { @@ -35,7 +35,7 @@ index e383b9e97396a2b469a963ef3c246ae31462a537..a753c4817cb50aa4026b7961da93f440 double d1 = 0.0D; boolean flag = this.isPushedByFluid(); boolean flag1 = false; -@@ -4307,38 +4309,123 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4308,38 +4310,123 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess int k1 = 0; BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos(); diff --git a/patches/server/0045-Return-nether-portal-fix.patch b/patches/server/0045-Return-nether-portal-fix.patch index 7951eabb..1f5d5045 100644 --- a/patches/server/0045-Return-nether-portal-fix.patch +++ b/patches/server/0045-Return-nether-portal-fix.patch @@ -83,10 +83,10 @@ index 4c38bfe300fb7da9d2080784b64101f94d77f20c..4f2ce8295977bfb8e9b6e98ca5405ecb @Nullable private DamageSource lastDamageSource; diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java -index a530276b0123dee5680d7e09ad3d2f0414909c91..e9b17c57c7bb8ad70f0e747d43aa0a2999c0c3f5 100644 +index ddab7de1d376e9e486e2f920174397ea8804aa29..73b6e6f24852370268bdcb0b06027daa119b5091 100644 --- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java +++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java -@@ -171,7 +171,18 @@ public class NetherPortalBlock extends Block implements Portal { +@@ -172,7 +172,18 @@ public class NetherPortalBlock extends Block implements Portal { @Nullable private DimensionTransition getExitPortal(ServerLevel worldserver, Entity entity, BlockPos blockposition, BlockPos blockposition1, boolean flag, WorldBorder worldborder, int searchRadius, boolean canCreatePortal, int createRadius) { diff --git a/patches/server/0061-Creative-fly-no-clip.patch b/patches/server/0061-Creative-fly-no-clip.patch index be8c2b6e..44dd0e91 100644 --- a/patches/server/0061-Creative-fly-no-clip.patch +++ b/patches/server/0061-Creative-fly-no-clip.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Creative fly no clip diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 3f397423f023deaf4d8545201088b23ee3cc1cdd..2912f6c787882dece02edc0c2c480c7ff81659ae 100644 +index 54ba25632c2a9e1c93a5b3a0b92e5280864c49d6..eff9284b853f6771b6d44c851643621897e18a17 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -251,8 +251,8 @@ public abstract class Player extends LivingEntity { @@ -37,7 +37,7 @@ index 3f397423f023deaf4d8545201088b23ee3cc1cdd..2912f6c787882dece02edc0c2c480c7f AABB axisalignedbb; if (this.isPassenger() && !this.getVehicle().isRemoved()) { -@@ -2113,6 +2113,21 @@ public abstract class Player extends LivingEntity { +@@ -2110,6 +2110,21 @@ public abstract class Player extends LivingEntity { @Override public abstract boolean isSpectator(); diff --git a/patches/server/0090-Skip-entity-move-if-movement-is-zero.patch b/patches/server/0090-Skip-entity-move-if-movement-is-zero.patch index e6c396bb..1f9377d1 100644 --- a/patches/server/0090-Skip-entity-move-if-movement-is-zero.patch +++ b/patches/server/0090-Skip-entity-move-if-movement-is-zero.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Skip entity move if movement is zero This patch is Powered by Gale(https://github.com/GaleMC/Gale) diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 89303a5c20b48993290665669518e67dbd8eef8f..22fab19ae305f0eb67fb588db68f4ed4839888f8 100644 +index a2316b7e9426a50f01d11b329a365ce9cd56b329..8c99cd9ab1d41c3f1a26d168b58409456e4b5732 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -323,6 +323,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -31,7 +31,7 @@ index 89303a5c20b48993290665669518e67dbd8eef8f..22fab19ae305f0eb67fb588db68f4ed4 final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity if (this.noPhysics) { this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z); -@@ -4000,6 +4008,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4001,6 +4009,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public final void setBoundingBox(AABB boundingBox) { diff --git a/patches/server/0107-Force-Void-Trade.patch b/patches/server/0107-Force-Void-Trade.patch index f6ebaee8..ee878adc 100644 --- a/patches/server/0107-Force-Void-Trade.patch +++ b/patches/server/0107-Force-Void-Trade.patch @@ -178,10 +178,10 @@ index 0efc8d997b34302c3e0a5d7ec73a11a940dbeefe..d246c9932f3f98972124089306d6ed74 public void setToOutOfStock() { diff --git a/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java b/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java -index 11486419dd98a013c7387d3d73f322a95a18c574..811e7d619900e86acb6f1bce33046a9d69e96e8a 100644 +index 3f5bb5c9ceb5b31fcc9ef0a7a6157e1e1cb2a09f..3087c60589de8fc38e12d322e58886ba76749507 100644 --- a/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java +++ b/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java -@@ -114,6 +114,16 @@ public class EndGatewayBlock extends BaseEntityBlock implements Portal { +@@ -118,6 +118,16 @@ public class EndGatewayBlock extends BaseEntityBlock implements Portal { if (tileentity instanceof TheEndGatewayBlockEntity tileentityendgateway) { Vec3 vec3d = tileentityendgateway.getPortalPosition(world, pos); diff --git a/patches/server/0117-Linear-region-file-format.patch b/patches/server/0117-Linear-region-file-format.patch index 76980076..7817b626 100644 --- a/patches/server/0117-Linear-region-file-format.patch +++ b/patches/server/0117-Linear-region-file-format.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Linear region file format This patch is Powered by LinearPurpur(https://github.com/StupidCraft/LinearPurpur) diff --git a/build.gradle.kts b/build.gradle.kts -index 369d3cf80e4f86a7d30c45befd0e10a594236dd5..9a6ed88e2c117dee378dfe8b20c8548a6b56c22c 100644 +index b35bc56ca35e7ada015e011ab4c3136b4803e48c..ce53dd3066bf8cf8812dbdcb660397ba7e9764d0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -30,6 +30,10 @@ dependencies { @@ -148,7 +148,7 @@ index e761b63eebc1e76b2bb1cb887d83d0b63ad6ec90..2fefc69cc1df01a5ede2e5f2642adec6 try (DataInputStream out = new DataInputStream(new java.io.BufferedInputStream(new InflaterInputStream(Files.newInputStream(file))))) { return NbtIo.read((java.io.DataInput) out); diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index 0615fd82b71efb9a397de01615050e6d906c2844..1c83375beea629ebd78d7027fbba81f94f29f994 100644 +index 0615fd82b71efb9a397de01615050e6d906c2844..f400a188b70ea74f986f05861c35671d82e59b32 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java @@ -21,7 +21,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise @@ -160,7 +160,7 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..1c83375beea629ebd78d7027fbba81f9 private final RegionStorageInfo info; private final Path folder; private final boolean sync; -@@ -31,7 +31,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -31,9 +31,15 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise private static final int MAX_NON_EXISTING_CACHE = 1024 * 64; private final it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet nonExistingRegionFiles = new it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet(MAX_NON_EXISTING_CACHE+1); private static String getRegionFileName(final int chunkX, final int chunkZ) { @@ -168,8 +168,16 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..1c83375beea629ebd78d7027fbba81f9 + return "r." + (chunkX >> REGION_SHIFT) + "." + (chunkZ >> REGION_SHIFT) + (org.leavesmc.leaves.LeavesConfig.regionFormatName != org.leavesmc.leaves.region.RegionFileFormat.LINEAR ? ".mca" : ".linear"); // Leaves } ++ // Leaves start ++ private static String getOtherRegionFileName(final int chunkX, final int chunkZ) { ++ return "r." + (chunkX >> REGION_SHIFT) + "." + (chunkZ >> REGION_SHIFT) + (org.leavesmc.leaves.LeavesConfig.regionFormatName == org.leavesmc.leaves.region.RegionFileFormat.LINEAR ? ".mca" : ".linear"); ++ } ++ // Leaves end ++ private boolean doesRegionFilePossiblyExist(final long position) { -@@ -66,15 +66,15 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise + synchronized (this.nonExistingRegionFiles) { + if (this.nonExistingRegionFiles.contains(position)) { +@@ -66,15 +72,15 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise } @Override @@ -188,7 +196,27 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..1c83375beea629ebd78d7027fbba81f9 if (ret != null) { return ret; } -@@ -98,7 +98,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -86,19 +92,23 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise + if (this.regionCache.size() >= io.papermc.paper.configuration.GlobalConfiguration.get().misc.regionFileCacheSize) { // Paper + this.regionCache.removeLast().close(); + } +- +- final Path regionPath = this.folder.resolve(getRegionFileName(chunkX, chunkZ)); ++ // Leaves start ++ Path regionPath = this.folder.resolve(getRegionFileName(chunkX, chunkZ)); + + if (!java.nio.file.Files.exists(regionPath)) { +- this.markNonExisting(key); +- return null; ++ regionPath = this.folder.resolve(getOtherRegionFileName(chunkX, chunkZ)); ++ if (!java.nio.file.Files.exists(regionPath)) { ++ this.markNonExisting(key); ++ return null; ++ } + } ++ // Leaves end + + this.createRegionFile(key); FileUtil.createDirectoriesSafe(this.folder); @@ -197,7 +225,7 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..1c83375beea629ebd78d7027fbba81f9 this.regionCache.putAndMoveToFirst(key, ret); -@@ -112,7 +112,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -112,7 +122,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise this.info = storageKey; } @@ -206,7 +234,7 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..1c83375beea629ebd78d7027fbba81f9 // Paper start - rewrite chunk system if (existingOnly) { return this.moonrise$getRegionFileIfExists(chunkcoordintpair.x, chunkcoordintpair.z); -@@ -120,7 +120,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -120,7 +130,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise synchronized (this) { final long key = ChunkPos.asLong(chunkcoordintpair.x >> REGION_SHIFT, chunkcoordintpair.z >> REGION_SHIFT); @@ -215,7 +243,7 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..1c83375beea629ebd78d7027fbba81f9 if (ret != null) { return ret; } -@@ -135,7 +135,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -135,7 +145,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise FileUtil.createDirectoriesSafe(this.folder); @@ -224,7 +252,7 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..1c83375beea629ebd78d7027fbba81f9 this.regionCache.putAndMoveToFirst(key, ret); -@@ -149,7 +149,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -149,7 +159,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO PAPER - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); } @@ -233,7 +261,7 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..1c83375beea629ebd78d7027fbba81f9 synchronized (regionfile) { try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) { CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z); -@@ -184,7 +184,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -184,7 +194,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise @Nullable public CompoundTag read(ChunkPos pos) throws IOException { // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing @@ -242,7 +270,7 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..1c83375beea629ebd78d7027fbba81f9 if (regionfile == null) { return null; } -@@ -235,7 +235,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -235,7 +245,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise public void scanChunk(ChunkPos chunkPos, StreamTagVisitor scanner) throws IOException { // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing @@ -251,7 +279,7 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..1c83375beea629ebd78d7027fbba81f9 if (regionfile == null) { return; } -@@ -265,7 +265,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -265,7 +275,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise } public void write(ChunkPos pos, @Nullable CompoundTag nbt) throws IOException { // Paper - public @@ -260,7 +288,7 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..1c83375beea629ebd78d7027fbba81f9 // Paper start - rewrite chunk system if (regionfile == null) { // if the RegionFile doesn't exist, no point in deleting from it -@@ -281,8 +281,33 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -281,8 +291,33 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise if (nbt == null) { regionfile.clear(pos); } else { @@ -275,12 +303,12 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..1c83375beea629ebd78d7027fbba81f9 + if (regionDataInputStream == null) { + continue; + } -+ + + CompoundTag compoundTag = NbtIo.read(regionDataInputStream); + try (DataOutputStream linearDataOutputStream = linearRegionFile.getChunkDataOutputStream(pos)) { + NbtIo.write(compoundTag, linearDataOutputStream); + } - ++ + linearRegionFile.flush(); + if(java.nio.file.Files.isRegularFile(regionfile.getPath())) { + java.nio.file.Files.delete(regionfile.getPath()); @@ -295,7 +323,7 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..1c83375beea629ebd78d7027fbba81f9 try { NbtIo.write(nbt, (DataOutput) dataoutputstream); regionfile.setOversized(pos.x, pos.z, false); // Paper - We don't do this anymore, mojang stores differently, but clear old meta flag if it exists to get rid of our own meta file once last oversized is gone -@@ -324,7 +349,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -324,7 +359,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise // Paper start - rewrite chunk system synchronized (this) { final ExceptionCollector exceptionCollector = new ExceptionCollector<>(); @@ -304,7 +332,7 @@ index 0615fd82b71efb9a397de01615050e6d906c2844..1c83375beea629ebd78d7027fbba81f9 try { regionFile.close(); } catch (final IOException ex) { -@@ -341,7 +366,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -341,7 +376,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise // Paper start - rewrite chunk system synchronized (this) { final ExceptionCollector exceptionCollector = new ExceptionCollector<>(); diff --git a/patches/server/0127-Fix-falling-block-s-block-location.patch b/patches/server/0127-Fix-falling-block-s-block-location.patch index 214faafb..d98b5d11 100644 --- a/patches/server/0127-Fix-falling-block-s-block-location.patch +++ b/patches/server/0127-Fix-falling-block-s-block-location.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix falling block's block location diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index e4767aaf0001ed7892a2d1132a051ec8c19a383d..d033a45e1ebe173d13011f5db6c89b4733bc1abe 100644 +index 0b42dc7526e2119cc921d9ed478c6c66c3a13a41..b450c19fbb6cc7266db4ddc4bc86546ca2054d5a 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -4669,6 +4669,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4670,6 +4670,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess int j = Mth.floor(y); int k = Mth.floor(z);