Skip to content

Commit

Permalink
Update and make linear work before
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Jun 25, 2024
1 parent befffe0 commit d06a408
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 33 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions patches/server/0004-Leaves-Server-Utils.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Fluid> tag, double speed) {
Expand All @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0045-Return-nether-portal-fix.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0061-Creative-fly-no-clip.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0107-Force-Void-Trade.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
62 changes: 45 additions & 17 deletions patches/server/0117-Linear-region-file-format.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -160,16 +160,24 @@ 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) {
- return "r." + (chunkX >> REGION_SHIFT) + "." + (chunkZ >> REGION_SHIFT) + ".mca";
+ 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
Expand All @@ -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);

Expand All @@ -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;
}

Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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.");
}

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 {
Expand All @@ -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());
Expand All @@ -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<IOException> exceptionCollector = new ExceptionCollector<>();
Expand All @@ -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<IOException> exceptionCollector = new ExceptionCollector<>();
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0127-Fix-falling-block-s-block-location.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit d06a408

Please sign in to comment.