More work

This commit is contained in:
Mariell Hoversholm 2021-03-16 14:04:28 +01:00
parent 1718f61bf8
commit 0f78e95250
310 changed files with 8078 additions and 1303 deletions

View File

@ -3515,10 +3515,18 @@ index 254953c1d8ad80173bcc9ed703bacaf32ca89c9a..7dea5e783ce2a1f8ddd2b3ab7a19e03a
}
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
index b9a0b37ceeeda9f6b1c4c23283e53dcb229f7249..67cae076af338348fdc9c5de51377b32a97ef836 100644
index b9a0b37ceeeda9f6b1c4c23283e53dcb229f7249..0bf95b97140a67682ec2953ccc773f6faad7b7da 100644
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
@@ -146,6 +146,26 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -54,6 +54,7 @@ import net.minecraft.network.protocol.game.PacketPlayOutLightUpdate;
import net.minecraft.network.protocol.game.PacketPlayOutMapChunk;
import net.minecraft.network.protocol.game.PacketPlayOutMount;
import net.minecraft.network.protocol.game.PacketPlayOutViewCentre;
+import net.minecraft.server.MCUtil;
import net.minecraft.server.level.progress.WorldLoadListener;
import net.minecraft.util.CSVWriter;
import net.minecraft.util.EntitySlice;
@@ -146,6 +147,26 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
};
// CraftBukkit end
@ -3545,7 +3553,7 @@ index b9a0b37ceeeda9f6b1c4c23283e53dcb229f7249..67cae076af338348fdc9c5de51377b32
public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler<Runnable> iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, Supplier<WorldPersistentData> supplier, int i, boolean flag) {
super(new File(convertable_conversionsession.a(worldserver.getDimensionKey()), "region"), datafixer, flag);
this.visibleChunks = this.updatingChunks.clone();
@@ -235,6 +255,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -235,6 +256,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
};
}
@ -3560,7 +3568,7 @@ index b9a0b37ceeeda9f6b1c4c23283e53dcb229f7249..67cae076af338348fdc9c5de51377b32
private CompletableFuture<Either<List<IChunkAccess>, PlayerChunk.Failure>> a(ChunkCoordIntPair chunkcoordintpair, int i, IntFunction<ChunkStatus> intfunction) {
List<CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>>> list = Lists.newArrayList();
int j = chunkcoordintpair.x;
@@ -945,6 +973,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -945,6 +974,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
if (!flag1) {
this.chunkDistanceManager.a(SectionPosition.a((Entity) entityplayer), entityplayer);
}
@ -3568,7 +3576,7 @@ index b9a0b37ceeeda9f6b1c4c23283e53dcb229f7249..67cae076af338348fdc9c5de51377b32
} else {
SectionPosition sectionposition = entityplayer.O();
@@ -952,6 +981,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -952,6 +982,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
if (!flag2) {
this.chunkDistanceManager.b(sectionposition, entityplayer);
}
@ -3576,7 +3584,7 @@ index b9a0b37ceeeda9f6b1c4c23283e53dcb229f7249..67cae076af338348fdc9c5de51377b32
}
for (int k = i - this.viewDistance; k <= i + this.viewDistance; ++k) {
@@ -1062,6 +1092,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -1062,6 +1093,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
}
@ -3780,7 +3788,7 @@ index acebee991eca1e19fc1094718dc40822b66756e1..c484e27650364b6537fe6b2e8e14de98
super(entitytypes, world);
this.f = 5;
diff --git a/src/main/java/net/minecraft/world/entity/player/PlayerInventory.java b/src/main/java/net/minecraft/world/entity/player/PlayerInventory.java
index 97db41acf626eec3e587964d0e73c370e5695bf0..bc251c67b2006ea85e890c29fec52dc034298281 100644
index 97db41acf626eec3e587964d0e73c370e5695bf0..2df3ae0b72ccb5f816d55fed15396ba5a1affb7f 100644
--- a/src/main/java/net/minecraft/world/entity/player/PlayerInventory.java
+++ b/src/main/java/net/minecraft/world/entity/player/PlayerInventory.java
@@ -38,7 +38,7 @@ public class PlayerInventory implements IInventory, INamableTileEntity {
@ -3788,7 +3796,7 @@ index 97db41acf626eec3e587964d0e73c370e5695bf0..bc251c67b2006ea85e890c29fec52dc0
public final NonNullList<ItemStack> armor;
public final NonNullList<ItemStack> extraSlots;
- private final List<NonNullList<ItemStack>> f;
+ private final List<NonNullList<ItemStack>> f;List<NonNullList<ItemStack>> getComponents() { return f; } // Paper - OBFHELPER
+ private final List<NonNullList<ItemStack>> f; public final List<NonNullList<ItemStack>> getComponents() { return f; } // Paper - OBFHELPER
public int itemInHandIndex;
public final EntityHuman player;
private ItemStack carried;
@ -3982,10 +3990,22 @@ index 14e55bf842e928d1e8e2137f9efdef0f7c336362..9a88791be443a5b18934e7d752aee6dc
}
diff --git a/src/main/java/net/minecraft/world/level/IBlockAccess.java b/src/main/java/net/minecraft/world/level/IBlockAccess.java
index 25e50b57f42dde156443480d73c6c9985df6f0c6..f0b74dce1e0a3ca150251008247a14b380cde03d 100644
index 25e50b57f42dde156443480d73c6c9985df6f0c6..e799765ecfada1eec78beb71651e52ad355a30aa 100644
--- a/src/main/java/net/minecraft/world/level/IBlockAccess.java
+++ b/src/main/java/net/minecraft/world/level/IBlockAccess.java
@@ -22,6 +22,19 @@ public interface IBlockAccess {
@@ -8,9 +8,11 @@ import javax.annotation.Nullable;
import net.minecraft.core.BlockPosition;
import net.minecraft.core.EnumDirection;
import net.minecraft.util.MathHelper;
+import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.TileEntity;
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.material.Fluid;
+import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.MovingObjectPositionBlock;
import net.minecraft.world.phys.Vec3D;
@@ -22,6 +24,19 @@ public interface IBlockAccess {
TileEntity getTileEntity(BlockPosition blockposition);
IBlockData getType(BlockPosition blockposition);

View File

@ -45,10 +45,18 @@ index ec553e7d7595ef3652bfa3325a07483bb3c32245..9af9d9463e9b50f8a627ffd79dcd3716
private String entityKeyString;
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
index 2b58ae6d91fe0d0f36eedbb78a3c8a8a66d92405..8300bb425f7fc3fa8a5a8832a0bb432a2947793b 100644
index 2b58ae6d91fe0d0f36eedbb78a3c8a8a66d92405..75110c41af3e0097aef65091a2497dd87d08b4b2 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
@@ -63,6 +63,15 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
@@ -11,6 +11,7 @@ import net.minecraft.world.level.World;
import net.minecraft.world.level.block.EnumBlockMirror;
import net.minecraft.world.level.block.EnumBlockRotation;
import net.minecraft.world.level.block.state.IBlockData;
+import net.minecraft.world.level.chunk.Chunk;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.util.Supplier;
@@ -63,6 +64,15 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
getMinecraftKey(); // Try to load if it doesn't exists.
return tileEntityKeyString;
}

View File

@ -546,15 +546,15 @@ index 0000000000000000000000000000000000000000..d4ebcf8f66197299256bd6b65710a148
+}
diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
new file mode 100644
index 0000000000000000000000000000000000000000..944fd203e9f39d6c6fc9e270940c76c98067273a
index 0000000000000000000000000000000000000000..fa154ed68187a2020e814db6345a8cc1119ab4ba
--- /dev/null
+++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
@@ -0,0 +1,119 @@
+package co.aikar.timings;
+
+import net.minecraft.server.World;
+import net.minecraft.server.WorldDataServer;
+import net.minecraft.server.WorldServer;
+import net.minecraft.server.level.WorldServer;
+import net.minecraft.world.level.World;
+import net.minecraft.world.level.storage.WorldDataServer;
+
+/**
+ * Set of timers per world, to track world specific timings.
@ -1154,7 +1154,7 @@ index 3055ef62a054d91a74552f83f7afdfe08c7880db..95af66ebb7849cbf2bcad6bc52aeb85a
private void a(long i, Consumer<Chunk> consumer) {
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
index 67cae076af338348fdc9c5de51377b32a97ef836..8219ffea086a446a682479ae21ca7d56a598751a 100644
index 0bf95b97140a67682ec2953ccc773f6faad7b7da..9eae9d7e9d18d73b1050e1d9b8859802cbd286ed 100644
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
@@ -1,7 +1,9 @@
@ -1167,7 +1167,7 @@ index 67cae076af338348fdc9c5de51377b32a97ef836..8219ffea086a446a682479ae21ca7d56
import com.google.common.collect.Lists;
import com.google.common.collect.Queues;
import com.google.common.collect.Sets;
@@ -553,11 +555,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -554,11 +556,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
private CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> f(ChunkCoordIntPair chunkcoordintpair) {
return CompletableFuture.supplyAsync(() -> {
@ -1185,7 +1185,7 @@ index 67cae076af338348fdc9c5de51377b32a97ef836..8219ffea086a446a682479ae21ca7d56
boolean flag = nbttagcompound.hasKeyOfType("Level", 10) && nbttagcompound.getCompound("Level").hasKeyOfType("Status", 8);
if (flag) {
@@ -569,7 +574,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -570,7 +575,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
PlayerChunkMap.LOGGER.error("Chunk file at {} is missing level data, skipping", chunkcoordintpair);
@ -1194,7 +1194,7 @@ index 67cae076af338348fdc9c5de51377b32a97ef836..8219ffea086a446a682479ae21ca7d56
} catch (ReportedException reportedexception) {
Throwable throwable = reportedexception.getCause();
@@ -606,7 +611,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -607,7 +612,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
return "chunkGenerate " + chunkstatus.d();
});
return completablefuture.thenComposeAsync((either) -> {
@ -1203,7 +1203,7 @@ index 67cae076af338348fdc9c5de51377b32a97ef836..8219ffea086a446a682479ae21ca7d56
try {
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture1 = chunkstatus.a(this.world, this.chunkGenerator, this.definedStructureManager, this.lightEngine, (ichunkaccess) -> {
return this.c(playerchunk);
@@ -659,6 +664,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -660,6 +665,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
ChunkStatus chunkstatus = PlayerChunk.getChunkStatus(playerchunk.getTicketLevel());
return !chunkstatus.b(ChunkStatus.FULL) ? PlayerChunk.UNLOADED_CHUNK_ACCESS : either.mapLeft((ichunkaccess) -> {
@ -1211,7 +1211,7 @@ index 67cae076af338348fdc9c5de51377b32a97ef836..8219ffea086a446a682479ae21ca7d56
ChunkCoordIntPair chunkcoordintpair = playerchunk.i();
Chunk chunk;
@@ -710,6 +716,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -711,6 +717,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
return chunk;
@ -1219,7 +1219,7 @@ index 67cae076af338348fdc9c5de51377b32a97ef836..8219ffea086a446a682479ae21ca7d56
});
}, (runnable) -> {
Mailbox mailbox = this.mailboxMain;
@@ -1168,6 +1175,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -1169,6 +1176,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
PlayerChunkMap.EntityTracker playerchunkmap_entitytracker;
ObjectIterator objectiterator;
@ -1227,7 +1227,7 @@ index 67cae076af338348fdc9c5de51377b32a97ef836..8219ffea086a446a682479ae21ca7d56
for (objectiterator = this.trackedEntities.values().iterator(); objectiterator.hasNext(); playerchunkmap_entitytracker.trackerEntry.a()) {
playerchunkmap_entitytracker = (PlayerChunkMap.EntityTracker) objectiterator.next();
@@ -1185,16 +1193,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -1186,16 +1194,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
playerchunkmap_entitytracker.e = sectionposition1;
}
}
@ -1737,10 +1737,10 @@ index bab55395ba92d0f3788e798ae0e154d62c4ec2fa..d285c4e3d9f938973bf7fb904680044b
private String name;
@Nullable
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
index 8300bb425f7fc3fa8a5a8832a0bb432a2947793b..da39fcb22d7656eedb8bf7d0774f50018b9fb02b 100644
index 75110c41af3e0097aef65091a2497dd87d08b4b2..9ebd91e1309938f81583eb3d4dd97fd39bcc930a 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
@@ -22,10 +22,12 @@ import org.bukkit.inventory.InventoryHolder;
@@ -23,10 +23,12 @@ import org.bukkit.inventory.InventoryHolder;
// CraftBukkit end
import org.spigotmc.CustomTimingsHandler; // Spigot

View File

@ -46,10 +46,10 @@ index 62735e7908f86e31f7a89ce2071ddebe176c0385..87e37c38825ad20fc11f41ea2a451275
}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
index da39fcb22d7656eedb8bf7d0774f50018b9fb02b..b1c220df7e00af79b548895cc9333ba85d5a447f 100644
index 9ebd91e1309938f81583eb3d4dd97fd39bcc930a..58789a6e285c31947508deae37caefe7e182278c 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
@@ -207,7 +207,12 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
@@ -208,7 +208,12 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
return IRegistry.BLOCK_ENTITY_TYPE.getKey(this.getTileType()) + " // " + this.getClass().getCanonicalName();
});
if (this.world != null) {

View File

@ -77,10 +77,10 @@ index a95867c0ba7dec750e07a4ac623ee30b4522fe55..f5227aa761d326376d057eaadcdbef02
this.c();
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
index 8219ffea086a446a682479ae21ca7d56a598751a..21282ce37e55cbca027c7542c148928fd4e69dfc 100644
index 9eae9d7e9d18d73b1050e1d9b8859802cbd286ed..e9657faf0a24aee8444372e6f1ca0d971339ce5a 100644
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
@@ -1294,10 +1294,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -1295,10 +1295,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
private final Entity tracker;
private final int trackingDistance;
private SectionPosition e;
@ -97,7 +97,7 @@ index 8219ffea086a446a682479ae21ca7d56a598751a..21282ce37e55cbca027c7542c148928f
this.tracker = entity;
this.trackingDistance = i;
this.e = SectionPosition.a(entity);
@@ -1379,7 +1383,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -1380,7 +1384,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
entityplayer.removeQueue.remove(Integer.valueOf(this.tracker.getId()));
// CraftBukkit end

View File

@ -49,10 +49,10 @@ index 0000000000000000000000000000000000000000..f699ce18ca044f813e194ef2786b7ea8
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
index 21282ce37e55cbca027c7542c148928fd4e69dfc..7702b0b86a5ccfe6eab81025cfc8c4a83ba52b7c 100644
index e9657faf0a24aee8444372e6f1ca0d971339ce5a..e8150c456efe72a561d6a6a7647eca05fbc8bd94 100644
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
@@ -806,6 +806,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -807,6 +807,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
return true;
} catch (Exception exception) {
PlayerChunkMap.LOGGER.error("Failed to save chunk {},{}", chunkcoordintpair.x, chunkcoordintpair.z, exception);
@ -128,7 +128,7 @@ index 2d02b2fc502a0f7e541f7943ed647ff7177acee8..fd0595fd584046326eccacdf0a6afe40
}
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
index 33469b719d679c65d4bcb8366008e6e107eb3a0b..b0ad55f35285cc1bc339859a8deae65e930082b8 100644
index 33469b719d679c65d4bcb8366008e6e107eb3a0b..01cb0c8dd9875986e0c08371e876f0dba3f0cf5a 100644
--- a/src/main/java/net/minecraft/world/level/World.java
+++ b/src/main/java/net/minecraft/world/level/World.java
@@ -1,5 +1,10 @@
@ -147,7 +147,7 @@ index 33469b719d679c65d4bcb8366008e6e107eb3a0b..b0ad55f35285cc1bc339859a8deae65e
} catch (Throwable throwable) {
// Paper start - Prevent tile entity and entity crashes
- System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ());
+ String msg = "TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ();
+ String msg = "TileEntity threw exception at " + tileentity.getWorld().getWorld().getName() + ":" + tileentity.getPosition().getX() + "," + tileentity.getPosition().getY() + "," + tileentity.getPosition().getZ();
+ System.err.println(msg);
throwable.printStackTrace();
+ getServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable)));

View File

@ -19,10 +19,18 @@ index 7f695f2b49df3400cd263fd6ffff77e753a65ea1..6efbb8a3502f86e105d4dfb9cef114a7
}
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java
index de125077656f249d5cf9b76f07981b55e690e015..44c09e3b8d5abe4fdf9c4a46c21bc82e9dfefa0b 100644
index de125077656f249d5cf9b76f07981b55e690e015..8310dd6bfc04b8ac0a51545baa3a264e6cb42eac 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java
@@ -92,6 +92,7 @@ public final class RegionFileCache implements AutoCloseable {
@@ -11,6 +11,7 @@ import java.io.IOException;
import javax.annotation.Nullable;
import net.minecraft.nbt.NBTCompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ExceptionSuppressor;
import net.minecraft.world.level.ChunkCoordIntPair;
@@ -92,6 +93,7 @@ public final class RegionFileCache implements AutoCloseable {
protected void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException {
RegionFile regionfile = this.getFile(chunkcoordintpair, false); // CraftBukkit
@ -30,7 +38,7 @@ index de125077656f249d5cf9b76f07981b55e690e015..44c09e3b8d5abe4fdf9c4a46c21bc82e
DataOutputStream dataoutputstream = regionfile.c(chunkcoordintpair);
Throwable throwable = null;
@@ -115,6 +116,18 @@ public final class RegionFileCache implements AutoCloseable {
@@ -115,6 +117,18 @@ public final class RegionFileCache implements AutoCloseable {
}

View File

@ -18,19 +18,19 @@ index 2c295e070a0418c7d3bc4a4a531df699acadb0ff..555b99c45e0785750c48b0db2bc0b8da
this.methodProfiler.a(() -> {
return worldserver + " " + worldserver.getDimensionKey().a();
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index 3403ed91e7ec98116438398fb7247e7f05171feb..3b82b358d53454dcde4e64123e6262a68a5ed1b0 100644
index 3403ed91e7ec98116438398fb7247e7f05171feb..addbb868ac43538b9fc468eb2601ffc9f974fa37 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -196,6 +196,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
private int tickPosition;
public final Convertable.ConversionSession convertable;
public final UUID uuid;
+ boolean hasPhysicsEvent = true; // Paper
+ public boolean hasPhysicsEvent = true; // Paper
@Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
return this.chunkProvider.getChunkAt(x, z, false);
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
index 07b5ff3ae319776bc1d85d113007a9afbad1c29a..70db5312ac556ea53247efdbc7759910ba0c9a95 100644
index a22be13b097052b2a88707c9436b88c84298e46b..9236e480d21340d4295caa16dae34363e182f483 100644
--- a/src/main/java/net/minecraft/world/level/World.java
+++ b/src/main/java/net/minecraft/world/level/World.java
@@ -458,7 +458,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {

View File

@ -25,10 +25,10 @@ index 716f285e67019b8a62922d09c15883c99f9421aa..439dcc6effdc91830d2b7ede90639829
+ }
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java
index 44c09e3b8d5abe4fdf9c4a46c21bc82e9dfefa0b..13d0d6e7e03322f20ef5666d5299d26d51d1714c 100644
index 8310dd6bfc04b8ac0a51545baa3a264e6cb42eac..75b10a3755392870d8f5b51239a09a0e7fd75a42 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java
@@ -32,7 +32,7 @@ public final class RegionFileCache implements AutoCloseable {
@@ -33,7 +33,7 @@ public final class RegionFileCache implements AutoCloseable {
if (regionfile != null) {
return regionfile;
} else {

View File

@ -57,10 +57,18 @@ index 555b99c45e0785750c48b0db2bc0b8da98c52295..bea6cd6cf4dceece74de9cbb12a09433
this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP));
this.serverConnection.acceptConnections();
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 152aa38788a21638aab7cfe2dc187671f1143bde..aeda31ccd2829bc7ad60c6941174addc8b02c4eb 100644
index 152aa38788a21638aab7cfe2dc187671f1143bde..95ff827b1d5704d279d258bdfb43fd33ec7a9187 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -145,6 +145,7 @@ public abstract class PlayerList {
@@ -86,6 +86,7 @@ import net.minecraft.world.level.storage.SavedFile;
import net.minecraft.world.level.storage.WorldData;
import net.minecraft.world.level.storage.WorldNBTStorage;
import net.minecraft.world.phys.Vec3D;
+import net.minecraft.world.scores.Scoreboard;
import net.minecraft.world.scores.ScoreboardObjective;
import net.minecraft.world.scores.ScoreboardTeam;
import net.minecraft.world.scores.ScoreboardTeamBase;
@@ -145,6 +146,7 @@ public abstract class PlayerList {
// CraftBukkit start
private CraftServer cserver;
private final Map<String,EntityPlayer> playersByName = new java.util.HashMap<>();
@ -68,7 +76,7 @@ index 152aa38788a21638aab7cfe2dc187671f1143bde..aeda31ccd2829bc7ad60c6941174addc
public PlayerList(MinecraftServer minecraftserver, IRegistryCustom.Dimension iregistrycustom_dimension, WorldNBTStorage worldnbtstorage, int i) {
this.cserver = minecraftserver.server = new CraftServer((DedicatedServer) minecraftserver, this);
@@ -376,6 +377,13 @@ public abstract class PlayerList {
@@ -376,6 +378,13 @@ public abstract class PlayerList {
}
entityplayer.syncInventory();
@ -82,7 +90,7 @@ index 152aa38788a21638aab7cfe2dc187671f1143bde..aeda31ccd2829bc7ad60c6941174addc
// CraftBukkit - Moved from above, added world
PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), worldserver1.worldDataServer.getName(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ());
}
@@ -496,6 +504,16 @@ public abstract class PlayerList {
@@ -496,6 +505,16 @@ public abstract class PlayerList {
entityplayer.playerTick(); // SPIGOT-924
// CraftBukkit end
@ -99,7 +107,7 @@ index 152aa38788a21638aab7cfe2dc187671f1143bde..aeda31ccd2829bc7ad60c6941174addc
this.savePlayerFile(entityplayer);
if (entityplayer.isPassenger()) {
Entity entity = entityplayer.getRootVehicle();
@@ -1144,6 +1162,13 @@ public abstract class PlayerList {
@@ -1144,6 +1163,13 @@ public abstract class PlayerList {
}
// CraftBukkit end

View File

@ -13,7 +13,7 @@ custom renderers are in use, defaulting to the much simpler Vanilla system.
Additionally, numerous issues to player position tracking on maps has been fixed.
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index e96a92119dce25c34509e502e8dce8596af6fd67..62430c61047f288ce6df6f77302c3bfb2817b299 100644
index 5ac96a25a9010ab3ddbd4a2b30cef0bba2a02054..de95ff06f2eedd8f812d7e2a83955642c1f9bba9 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -1168,6 +1168,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
@ -25,10 +25,26 @@ index e96a92119dce25c34509e502e8dce8596af6fd67..62430c61047f288ce6df6f77302c3bfb
}
}
diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
index f42e16589476c1bd10b13214dda5ac7bb3e52131..291bd9b70a8404a09511fd902b6f376c3d5ca0d4 100644
index f42e16589476c1bd10b13214dda5ac7bb3e52131..e3e3426a00128b56d523bb43a59b814b915ad0ff 100644
--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
+++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
@@ -689,6 +689,12 @@ public abstract class EntityHuman extends EntityLiving {
@@ -86,6 +86,7 @@ import net.minecraft.world.item.ItemElytra;
import net.minecraft.world.item.ItemProjectileWeapon;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.ItemSword;
+import net.minecraft.world.item.ItemWorldMap;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.IRecipe;
import net.minecraft.world.item.enchantment.EnchantmentManager;
@@ -104,6 +105,7 @@ import net.minecraft.world.level.block.entity.TileEntitySign;
import net.minecraft.world.level.block.entity.TileEntityStructure;
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.block.state.pattern.ShapeDetectorBlock;
+import net.minecraft.world.level.saveddata.maps.WorldMap;
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
import net.minecraft.world.scores.Scoreboard;
@@ -689,6 +691,12 @@ public abstract class EntityHuman extends EntityLiving {
return null;
}
// CraftBukkit end

View File

@ -6,10 +6,18 @@ Subject: [PATCH] Faster redstone torch rapid clock removal
Only resize the the redstone torch list once, since resizing arrays / lists is costly
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
index 2bb85896df999675d33f70a90f1c68865099ee83..b954b2f3c6e2d6725f9a134699f0d218f8ce1d05 100644
index cad86b0273c05767f78bcb3bdfaa9ea01e26af4e..d8ab2e22a5c0144decb5c657a123cc61722fcbf5 100644
--- a/src/main/java/net/minecraft/world/level/World.java
+++ b/src/main/java/net/minecraft/world/level/World.java
@@ -142,6 +142,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -44,6 +44,7 @@ import net.minecraft.world.level.biome.BiomeBase;
import net.minecraft.world.level.biome.BiomeManager;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.BlockFireAbstract;
+import net.minecraft.world.level.block.BlockRedstoneTorch;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.ITickable;
import net.minecraft.world.level.block.entity.TileEntity;
@@ -142,6 +143,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
private org.spigotmc.TickLimiter tileLimiter;
private int tileTickPosition;
public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions

View File

@ -9,10 +9,10 @@ Subject: [PATCH] Fix Old Sign Conversion
This causes Igloos and such to render broken signs. We fix this by ignoring sign conversion for Defined Structures
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
index b1c220df7e00af79b548895cc9333ba85d5a447f..2e1ce36fedac351f4320c6379ce73f8ffb0f5918 100644
index 58789a6e285c31947508deae37caefe7e182278c..fd6364dfc68c2eb9f560e7bc403dea874193828e 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
@@ -33,6 +33,7 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
@@ -34,6 +34,7 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
public CraftPersistentDataContainer persistentDataContainer;
// CraftBukkit end
private static final Logger LOGGER = LogManager.getLogger();

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z
Reduce method invocations for World.isLoaded(BlockPosition)Z
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
index b954b2f3c6e2d6725f9a134699f0d218f8ce1d05..edc760be0a3e58d2a917b70337b24b67ec5c5c1e 100644
index d8ab2e22a5c0144decb5c657a123cc61722fcbf5..bd08ff18d8d7dbe63ed33c1efb6099b58aa02caa 100644
--- a/src/main/java/net/minecraft/world/level/World.java
+++ b/src/main/java/net/minecraft/world/level/World.java
@@ -304,6 +304,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -305,6 +305,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
return chunk == null ? null : chunk.getFluid(blockposition);
}

View File

@ -4,11 +4,40 @@ Date: Wed, 21 Dec 2016 11:47:25 -0600
Subject: [PATCH] Add API methods to control if armour stands can move
diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
index 0631cd531647239858b2a7298f58cc770720f69a..6ee5e1b0bb34ba490a130fbcbdb7a2706c5ecf86 100644
--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java
+++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
@@ -38,6 +38,7 @@ import net.minecraft.world.entity.ai.control.ControllerLook;
import net.minecraft.world.entity.ai.control.ControllerMove;
import net.minecraft.world.entity.ai.control.EntityAIBodyControl;
import net.minecraft.world.entity.ai.goal.PathfinderGoal;
+import net.minecraft.world.entity.ai.goal.PathfinderGoalFloat;
import net.minecraft.world.entity.ai.goal.PathfinderGoalSelector;
import net.minecraft.world.entity.ai.navigation.Navigation;
import net.minecraft.world.entity.ai.navigation.NavigationAbstract;
@@ -45,6 +46,8 @@ import net.minecraft.world.entity.ai.sensing.EntitySenses;
import net.minecraft.world.entity.decoration.EntityHanging;
import net.minecraft.world.entity.decoration.EntityLeash;
import net.minecraft.world.entity.item.EntityItem;
+import net.minecraft.world.entity.monster.EntityBlaze;
+import net.minecraft.world.entity.monster.EntityEnderman;
import net.minecraft.world.entity.monster.IMonster;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.entity.vehicle.EntityBoat;
diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
index 72e53968c5fb03301ddec7a0cf937ac2f8cf0901..f0f93b3ff0b98f916b5f63b37b0f9b5c7fa03c2e 100644
index 72e53968c5fb03301ddec7a0cf937ac2f8cf0901..2ef991aa7f739d3577fbbf4386064557e8f7c904 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
@@ -79,6 +79,7 @@ public class EntityArmorStand extends EntityLiving {
@@ -28,6 +28,7 @@ import net.minecraft.world.entity.EntitySize;
import net.minecraft.world.entity.EntityTypes;
import net.minecraft.world.entity.EnumItemSlot;
import net.minecraft.world.entity.EnumMainHand;
+import net.minecraft.world.entity.EnumMoveType;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.entity.projectile.EntityArrow;
import net.minecraft.world.entity.vehicle.EntityMinecartAbstract;
@@ -79,6 +80,7 @@ public class EntityArmorStand extends EntityLiving {
public Vector3f rightArmPose;
public Vector3f leftLegPose;
public Vector3f rightLegPose;
@ -16,7 +45,7 @@ index 72e53968c5fb03301ddec7a0cf937ac2f8cf0901..f0f93b3ff0b98f916b5f63b37b0f9b5c
public EntityArmorStand(EntityTypes<? extends EntityArmorStand> entitytypes, World world) {
super(entitytypes, world);
@@ -862,4 +863,13 @@ public class EntityArmorStand extends EntityLiving {
@@ -862,4 +864,13 @@ public class EntityArmorStand extends EntityLiving {
private EntitySize s(boolean flag) {
return flag ? EntityArmorStand.bp : (this.isBaby() ? EntityArmorStand.bq : this.getEntityType().l());
}

View File

@ -7,10 +7,10 @@ Saving players async is extremely dangerous. This will force it to main
the same way we handle async chunk loads.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index aeda31ccd2829bc7ad60c6941174addc8b02c4eb..f044f735a51dcec91f6166179fb1b21eb8229cd0 100644
index 95ff827b1d5704d279d258bdfb43fd33ec7a9187..d7cf89f4603779ce9a2e9a6f837a81684f209826 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1046,11 +1046,13 @@ public abstract class PlayerList {
@@ -1047,11 +1047,13 @@ public abstract class PlayerList {
}
public void savePlayers() {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Make targetSize more aggressive in the chunk unload queue
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
index 7702b0b86a5ccfe6eab81025cfc8c4a83ba52b7c..146227ecfe654c36da958ddc2cfb9b67738de4a0 100644
index e8150c456efe72a561d6a6a7647eca05fbc8bd94..56f83a930c3dad1a1de366bff530131d92b4893c 100644
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
@@ -120,7 +120,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -121,7 +121,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
private final PlayerMap playerMap;
public final Int2ObjectMap<PlayerChunkMap.EntityTracker> trackedEntities;
private final Long2ByteMap z;
@ -17,7 +17,7 @@ index 7702b0b86a5ccfe6eab81025cfc8c4a83ba52b7c..146227ecfe654c36da958ddc2cfb9b67
private int viewDistance;
// CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback()
@@ -178,7 +178,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -179,7 +179,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
this.playerMap = new PlayerMap();
this.trackedEntities = new Int2ObjectOpenHashMap();
this.z = new Long2ByteOpenHashMap();
@ -26,7 +26,7 @@ index 7702b0b86a5ccfe6eab81025cfc8c4a83ba52b7c..146227ecfe654c36da958ddc2cfb9b67
this.definedStructureManager = definedstructuremanager;
this.w = convertable_conversionsession.a(worldserver.getDimensionKey());
this.world = worldserver;
@@ -436,7 +436,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -437,7 +437,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
// Spigot start
org.spigotmc.SlackActivityAccountant activityAccountant = this.world.getMinecraftServer().slackActivityAccountant;
activityAccountant.startActivity(0.5);
@ -35,7 +35,7 @@ index 7702b0b86a5ccfe6eab81025cfc8c4a83ba52b7c..146227ecfe654c36da958ddc2cfb9b67
// Spigot end
while (longiterator.hasNext()) { // Spigot
long j = longiterator.nextLong();
@@ -458,7 +458,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -459,7 +459,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
Runnable runnable;

View File

@ -26,10 +26,10 @@ index 2eee92f74a7c82ec7df05db6df79743b4345cc86..3d6b8fd09c07e78c0d786dff9658eb00
if (this.getAirTicks() == -20) {
this.setAirTicks(0);
diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
index f0f93b3ff0b98f916b5f63b37b0f9b5c7fa03c2e..e9ea670248eb0680cdff9a72412e9331fc57ff8a 100644
index 2ef991aa7f739d3577fbbf4386064557e8f7c904..57e0ea95df34fab22d6c5868ab839d56a3fa85fc 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
@@ -871,5 +871,10 @@ public class EntityArmorStand extends EntityLiving {
@@ -872,5 +872,10 @@ public class EntityArmorStand extends EntityLiving {
super.move(moveType, vec3d);
}
}

View File

@ -73,10 +73,10 @@ index c6ab645397911d984a28e40583bdb8f782a4f934..42ff9c57a6107c0cf22a204cf7cabf37
// Spigot Start
private static double calcTps(double avg, double exp, double tps)
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index f044f735a51dcec91f6166179fb1b21eb8229cd0..80c558fadd1e6a8dab6f8ba63979c98efa258c5a 100644
index d7cf89f4603779ce9a2e9a6f837a81684f209826..488e33cfc4887e602c897c9a94c0d824af7672ff 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1157,9 +1157,15 @@ public abstract class PlayerList {
@@ -1158,9 +1158,15 @@ public abstract class PlayerList {
entityplayer.playerInteractManager.b(worldserver.worldDataServer.getGameType()); // CraftBukkit
}
@ -92,7 +92,7 @@ index f044f735a51dcec91f6166179fb1b21eb8229cd0..80c558fadd1e6a8dab6f8ba63979c98e
player.playerConnection.disconnect(PaperAdventure.asVanilla(this.server.server.shutdownMessage())); // CraftBukkit - add custom shutdown message // Paper - Adventure
}
// CraftBukkit end
@@ -1172,6 +1178,7 @@ public abstract class PlayerList {
@@ -1173,6 +1179,7 @@ public abstract class PlayerList {
}
// Paper end
}

View File

@ -44,10 +44,10 @@ index bc0b1d0cc9c54d53c68ee59b0a707e0335297441..62fb502adf8cd7095e4826eb72ab39cf
case RELEASE_SHIFT_KEY:
this.player.setSneaking(false);
diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
index 291bd9b70a8404a09511fd902b6f376c3d5ca0d4..1a62ea103bb827ffcf0b3fd18a26ac72c0a5ba5c 100644
index e3e3426a00128b56d523bb43a59b814b915ad0ff..ba26fc2405e17d582da971d03147fb1865e9b546 100644
--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
+++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
@@ -530,7 +530,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -532,7 +532,7 @@ public abstract class EntityHuman extends EntityLiving {
this.j(this.getShoulderEntityLeft());
this.j(this.getShoulderEntityRight());
if (!this.world.isClientSide && (this.fallDistance > 0.5F || this.isInWater()) || this.abilities.isFlying || this.isSleeping()) {

View File

@ -75,13 +75,13 @@ index 2559c83c1b811177ade56537aeab1982ac53ee67..26e59ca76d856cc37222963fd14cb6ea
<groupId>org.apache.maven.plugins</groupId>
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
new file mode 100644
index 0000000000000000000000000000000000000000..74ed02fa9296583977bb721014b10ff8b708b43c
index 0000000000000000000000000000000000000000..89eeb9d202405747409e65fcf226d95379987e29
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
@@ -0,0 +1,41 @@
+package com.destroystokyo.paper.console;
+
+import net.minecraft.server.DedicatedServer;
+import net.minecraft.server.dedicated.DedicatedServer;
+import net.minecrell.terminalconsole.SimpleTerminalConsole;
+import org.bukkit.craftbukkit.command.ConsoleCommandCompleter;
+import org.jline.reader.LineReader;
@ -245,10 +245,10 @@ index 8ae72e8c8325d9b03803f29fcdd83a0ce8d34450..a0804c4df6f047cf913ae70970219617
System.setOut(IoBuilder.forLogger(logger).setLevel(Level.INFO).buildPrintStream());
System.setErr(IoBuilder.forLogger(logger).setLevel(Level.WARN).buildPrintStream());
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 80c558fadd1e6a8dab6f8ba63979c98efa258c5a..398fd08341eae503d53dcca42bbbd1c27c60cc17 100644
index 488e33cfc4887e602c897c9a94c0d824af7672ff..9db65b9d8f66ff83dcf32274fec98a425e7353d8 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -149,8 +149,7 @@ public abstract class PlayerList {
@@ -150,8 +150,7 @@ public abstract class PlayerList {
public PlayerList(MinecraftServer minecraftserver, IRegistryCustom.Dimension iregistrycustom_dimension, WorldNBTStorage worldnbtstorage, int i) {
this.cserver = minecraftserver.server = new CraftServer((DedicatedServer) minecraftserver, this);
@ -372,7 +372,7 @@ index 4580642e0ee79e6d9c9bef0344e643bbc551205c..829c62b6d55cb5706be3ce6bdc758d6b
+ }*/ // Paper
}
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
index befcc19f9b56df9096b98a23b0020f1db793ea5b..5510266fb114954322823b72e3199f33c4d7a9a7 100644
index befcc19f9b56df9096b98a23b0020f1db793ea5b..a957695457cf3252848ce6ef37069692841b8e28 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
@@ -4,20 +4,31 @@ import java.util.Collections;
@ -380,11 +380,11 @@ index befcc19f9b56df9096b98a23b0020f1db793ea5b..5510266fb114954322823b72e3199f33
import java.util.concurrent.ExecutionException;
import java.util.logging.Level;
-import jline.console.completer.Completer;
+import net.minecraft.server.dedicated.DedicatedServer;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.util.Waitable;
+
+// Paper start - JLine update
+import net.minecraft.server.DedicatedServer; // Paper
+import org.jline.reader.Candidate;
+import org.jline.reader.Completer;
+import org.jline.reader.LineReader;

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Item#canEntityPickup
diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
index 0631cd531647239858b2a7298f58cc770720f69a..0387052b45cdc849d9e67113532a7591f05e5531 100644
index 6ee5e1b0bb34ba490a130fbcbdb7a2706c5ecf86..c22b5f8fcdd4aa7dac242f634ef73edcd8745fc6 100644
--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java
+++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
@@ -604,6 +604,11 @@ public abstract class EntityInsentient extends EntityLiving {
@@ -607,6 +607,11 @@ public abstract class EntityInsentient extends EntityLiving {
EntityItem entityitem = (EntityItem) iterator.next();
if (!entityitem.dead && !entityitem.getItemStack().isEmpty() && !entityitem.p() && this.i(entityitem.getItemStack())) {

View File

@ -7,7 +7,7 @@ Establishes base extension of profile systems for future edits too
diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
new file mode 100644
index 0000000000000000000000000000000000000000..6ae316109c8e35fbb6b0aebdee3075beb1445f1b
index 0000000000000000000000000000000000000000..040fd0c3fc4bc3a04fe5dff919a41fe9b474708e
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
@@ -0,0 +1,301 @@
@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..6ae316109c8e35fbb6b0aebdee3075be
+import com.mojang.authlib.properties.Property;
+import com.mojang.authlib.properties.PropertyMap;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.UserCache;
+import net.minecraft.server.players.UserCache;
+import org.apache.commons.lang3.Validate;
+import org.bukkit.craftbukkit.entity.CraftPlayer;
+import org.spigotmc.SpigotConfig;

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Shoulder Entities Release API
diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
index 1a62ea103bb827ffcf0b3fd18a26ac72c0a5ba5c..2afd8ccb03ebae94d99995d383f55744bd58df0a 100644
index ba26fc2405e17d582da971d03147fb1865e9b546..63e8062ae3f3407b92b72b5fccaa958c39282fb8 100644
--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
+++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
@@ -1878,20 +1878,44 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1880,20 +1880,44 @@ public abstract class EntityHuman extends EntityLiving {
}

View File

@ -41,16 +41,13 @@ index c3599b29c0b32d6fcf18a4a0adfbe8454c37834d..0389d15f8e0b6bb68316eaed0cf91aca
super(inventory);
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSaddledInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSaddledInventory.java
new file mode 100644
index 0000000000000000000000000000000000000000..99cfbaf90b5ccd828834b33b3c658206efd6ac21
index 0000000000000000000000000000000000000000..8c2674ca1be1346ea84bcd7c9c5d6ea540802a5f
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSaddledInventory.java
@@ -0,0 +1,15 @@
@@ -0,0 +1,12 @@
+package org.bukkit.craftbukkit.inventory;
+
+import net.minecraft.server.IInventory;
+
+import org.bukkit.inventory.AbstractHorseInventory;
+import org.bukkit.inventory.ItemStack;
+import net.minecraft.world.IInventory;
+import org.bukkit.inventory.SaddledHorseInventory;
+
+public class CraftSaddledInventory extends CraftInventoryAbstractHorse implements SaddledHorseInventory {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] ProfileWhitelistVerifyEvent
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 398fd08341eae503d53dcca42bbbd1c27c60cc17..41b63da42067397122897d23fd7fb0e517d7c552 100644
index 9db65b9d8f66ff83dcf32274fec98a425e7353d8..738a69a1a5765897fb3ca3b4ceb07cddade0d27f 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -614,9 +614,9 @@ public abstract class PlayerList {
@@ -615,9 +615,9 @@ public abstract class PlayerList {
// return chatmessage;
if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(chatmessage)); // Spigot // Paper - Adventure
@ -21,7 +21,7 @@ index 398fd08341eae503d53dcca42bbbd1c27c60cc17..41b63da42067397122897d23fd7fb0e5
} else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) {
IpBanEntry ipbanentry = this.l.get(socketaddress);
@@ -1008,9 +1008,25 @@ public abstract class PlayerList {
@@ -1009,9 +1009,25 @@ public abstract class PlayerList {
this.server.getCommandDispatcher().a(entityplayer);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
index edc760be0a3e58d2a917b70337b24b67ec5c5c1e..651547aa823c6c922c1741dde99c0ccf153edf45 100644
index bd08ff18d8d7dbe63ed33c1efb6099b58aa02caa..8d4a28f98bd9c8a2dd1262f0f640909a456897fa 100644
--- a/src/main/java/net/minecraft/world/level/World.java
+++ b/src/main/java/net/minecraft/world/level/World.java
@@ -725,7 +725,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -726,7 +726,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
gameprofilerfiller.enter("blockEntities");
timings.tileEntityTick.startTiming(); // Spigot
if (!this.tileEntityListUnload.isEmpty()) {

View File

@ -18,17 +18,25 @@ index 3d6b8fd09c07e78c0d786dff9658eb0089f853cf..851aed157a233ab690a57e5736fa01be
protected int ticksFarFromPlayer;
protected float aJ;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index c654026587bc9bf77b39f59a0c89991ac581da1e..49247437c91f1d8f24c2bf506d2de200758bad88 100644
index c654026587bc9bf77b39f59a0c89991ac581da1e..c43c300963bae9bca6ab9c9389dd53e42318715c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -344,6 +344,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -8,6 +8,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.UUID;
+import net.minecraft.server.level.EntityPlayer;
import net.minecraft.world.EnumHand;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.effect.MobEffect;
@@ -344,6 +345,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return getHandle().killer == null ? null : (Player) getHandle().killer.getBukkitEntity();
}
+ // Paper start
+ @Override
+ public void setKiller(Player killer) {
+ net.minecraft.server.EntityPlayer entityPlayer = killer == null ? null : ((CraftPlayer) killer).getHandle();
+ EntityPlayer entityPlayer = killer == null ? null : ((CraftPlayer) killer).getHandle();
+ getHandle().killer = entityPlayer;
+ getHandle().lastDamager = entityPlayer;
+ getHandle().lastDamageByPlayerTime = entityPlayer == null ? 0 : 100; // 100 value taken from EntityLiving#damageEntity

View File

@ -6,13 +6,13 @@ Subject: [PATCH] Expose client protocol version and virtual host
diff --git a/src/main/java/com/destroystokyo/paper/network/PaperNetworkClient.java b/src/main/java/com/destroystokyo/paper/network/PaperNetworkClient.java
new file mode 100644
index 0000000000000000000000000000000000000000..5caca6439d2135e34880d501397fe2ea197d7249
index 0000000000000000000000000000000000000000..8a716c1647aa29906be26ac262e93ebd2c1adfaa
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/network/PaperNetworkClient.java
@@ -0,0 +1,50 @@
+package com.destroystokyo.paper.network;
+
+import net.minecraft.server.NetworkManager;
+import net.minecraft.network.NetworkManager;
+
+import java.net.InetSocketAddress;
+

View File

@ -6,10 +6,18 @@ Subject: [PATCH] Send attack SoundEffects only to players who can see the
diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
index 2afd8ccb03ebae94d99995d383f55744bd58df0a..266c4bb75ceaf57b66bb1e4d4deb3e4bfec3fd4e 100644
index 63e8062ae3f3407b92b72b5fccaa958c39282fb8..f9d0623a3ed5f49758cd5e97fe9f63a5b3198e58 100644
--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
+++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
@@ -1124,7 +1124,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -28,6 +28,7 @@ import net.minecraft.network.chat.ChatMessage;
import net.minecraft.network.chat.IChatBaseComponent;
import net.minecraft.network.chat.IChatMutableComponent;
import net.minecraft.network.protocol.game.PacketPlayOutEntityVelocity;
+import net.minecraft.network.protocol.game.PacketPlayOutNamedSoundEffect;
import net.minecraft.network.syncher.DataWatcher;
import net.minecraft.network.syncher.DataWatcherObject;
import net.minecraft.network.syncher.DataWatcherRegistry;
@@ -1126,7 +1127,7 @@ public abstract class EntityHuman extends EntityLiving {
int i = b0 + EnchantmentManager.b((EntityLiving) this);
if (this.isSprinting() && flag) {
@ -18,7 +26,7 @@ index 2afd8ccb03ebae94d99995d383f55744bd58df0a..266c4bb75ceaf57b66bb1e4d4deb3e4b
++i;
flag1 = true;
}
@@ -1199,7 +1199,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1201,7 +1202,7 @@ public abstract class EntityHuman extends EntityLiving {
}
}
@ -27,7 +35,7 @@ index 2afd8ccb03ebae94d99995d383f55744bd58df0a..266c4bb75ceaf57b66bb1e4d4deb3e4b
this.ex();
}
@@ -1227,15 +1227,15 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1229,15 +1230,15 @@ public abstract class EntityHuman extends EntityLiving {
}
if (flag2) {
@ -46,7 +54,7 @@ index 2afd8ccb03ebae94d99995d383f55744bd58df0a..266c4bb75ceaf57b66bb1e4d4deb3e4b
}
}
@@ -1287,7 +1287,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1289,7 +1290,7 @@ public abstract class EntityHuman extends EntityLiving {
this.applyExhaustion(world.spigotConfig.combatExhaustion, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent // Spigot - Change to use configurable value
} else {
@ -55,7 +63,7 @@ index 2afd8ccb03ebae94d99995d383f55744bd58df0a..266c4bb75ceaf57b66bb1e4d4deb3e4b
if (flag4) {
entity.extinguish();
}
@@ -1722,6 +1722,14 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1724,6 +1725,14 @@ public abstract class EntityHuman extends EntityLiving {
public int getExpToLevel() {
return this.expLevel >= 30 ? 112 + (this.expLevel - 30) * 9 : (this.expLevel >= 15 ? 37 + (this.expLevel - 15) * 5 : 7 + this.expLevel * 2);
}

View File

@ -18,10 +18,10 @@ the blockstate that will be valid for restoration, as opposed to dropping
information on restoration when the event is cancelled.
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
index 651547aa823c6c922c1741dde99c0ccf153edf45..f7df55cf3da909c253bab106cdb7149ee9c297d9 100644
index 8d4a28f98bd9c8a2dd1262f0f640909a456897fa..a9e7da1c848a6fe08fc112e445ceec1b7715d682 100644
--- a/src/main/java/net/minecraft/world/level/World.java
+++ b/src/main/java/net/minecraft/world/level/World.java
@@ -123,7 +123,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -124,7 +124,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public boolean captureBlockStates = false;
public boolean captureTreeGeneration = false;
@ -30,7 +30,7 @@ index 651547aa823c6c922c1741dde99c0ccf153edf45..f7df55cf3da909c253bab106cdb7149e
public Map<BlockPosition, TileEntity> capturedTileEntities = new HashMap<>();
public List<EntityItem> captureDrops;
public long ticksPerAnimalSpawns;
@@ -345,7 +345,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -346,7 +346,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public boolean a(BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
// CraftBukkit start - tree generation
if (this.captureTreeGeneration) {
@ -39,7 +39,7 @@ index 651547aa823c6c922c1741dde99c0ccf153edf45..f7df55cf3da909c253bab106cdb7149e
if (blockstate == null) {
blockstate = CapturedBlockState.getTreeBlockState(this, blockposition, i);
this.capturedBlockStates.put(blockposition.immutableCopy(), blockstate);
@@ -365,7 +365,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -366,7 +366,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
// CraftBukkit start - capture blockstates
boolean captured = false;
if (this.captureBlockStates && !this.capturedBlockStates.containsKey(blockposition)) {
@ -49,7 +49,7 @@ index 651547aa823c6c922c1741dde99c0ccf153edf45..f7df55cf3da909c253bab106cdb7149e
this.capturedBlockStates.put(blockposition.immutableCopy(), blockstate);
captured = true;
}
@@ -623,7 +624,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -624,7 +625,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public IBlockData getType(BlockPosition blockposition) {
// CraftBukkit start - tree generation
if (captureTreeGeneration) {

View File

@ -13,10 +13,10 @@ also Avoid NPE during CraftBlockEntityState load if could not get TE
If Tile Entity was null, correct Sign to return empty lines instead of null
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
index 2e1ce36fedac351f4320c6379ce73f8ffb0f5918..642ed6e5788a79f7bc7d6185564bdf0df07e492c 100644
index fd6364dfc68c2eb9f560e7bc403dea874193828e..3ff9e389fcf15044c2740fb884c9438428d7a681 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
@@ -46,6 +46,7 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
@@ -47,6 +47,7 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
public TileEntity(TileEntityTypes<?> tileentitytypes) {
this.position = BlockPosition.ZERO;
this.tileType = tileentitytypes;
@ -24,7 +24,7 @@ index 2e1ce36fedac351f4320c6379ce73f8ffb0f5918..642ed6e5788a79f7bc7d6185564bdf0d
}
// Paper start
@@ -94,7 +95,7 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
@@ -95,7 +96,7 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
public void load(IBlockData iblockdata, NBTTagCompound nbttagcompound) {
this.position = new BlockPosition(nbttagcompound.getInt("x"), nbttagcompound.getInt("y"), nbttagcompound.getInt("z"));
// CraftBukkit start - read container
@ -33,7 +33,7 @@ index 2e1ce36fedac351f4320c6379ce73f8ffb0f5918..642ed6e5788a79f7bc7d6185564bdf0d
net.minecraft.nbt.NBTBase persistentDataTag = nbttagcompound.get("PublicBukkitValues");
if (persistentDataTag instanceof NBTTagCompound) {
@@ -244,7 +245,12 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
@@ -245,7 +246,12 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
}
// CraftBukkit start - add method
@ -46,7 +46,7 @@ index 2e1ce36fedac351f4320c6379ce73f8ffb0f5918..642ed6e5788a79f7bc7d6185564bdf0d
if (world == null) return null;
// Spigot start
org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
@@ -253,7 +259,7 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
@@ -254,7 +260,7 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
return null;
}
// Spigot end

View File

@ -15,10 +15,18 @@ instead and save a lot of server resources.
See: https://github.com/PaperMC/Paper/issues/917
diff --git a/src/main/java/net/minecraft/world/entity/EntityTypes.java b/src/main/java/net/minecraft/world/entity/EntityTypes.java
index a707ba365e25ea15e2e9d22110696b6136aa0c6f..8ba75c847efa0633e7b8cb718e3a9b55e0b8ad77 100644
index a707ba365e25ea15e2e9d22110696b6136aa0c6f..1355c074353611669c947cb0f06c67be0ab418aa 100644
--- a/src/main/java/net/minecraft/world/entity/EntityTypes.java
+++ b/src/main/java/net/minecraft/world/entity/EntityTypes.java
@@ -317,6 +317,20 @@ public class EntityTypes<T extends Entity> {
@@ -17,6 +17,7 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.chat.ChatMessage;
import net.minecraft.network.chat.IChatBaseComponent;
import net.minecraft.resources.MinecraftKey;
+import net.minecraft.server.MCUtil;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.WorldServer;
import net.minecraft.tags.Tag;
@@ -317,6 +318,20 @@ public class EntityTypes<T extends Entity> {
@Nullable
public T spawnCreature(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {

View File

@ -48,10 +48,10 @@ index afa87cf70ad978161853771c59f5a4906733cab3..8b79d547a3296f056731cbb66508494d
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<EntityPlayer> cachedSingleHashSet; // Paper
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
index 146227ecfe654c36da958ddc2cfb9b67738de4a0..88e7fe1d50e644a107aa76c84b7fd1b9b43cd94b 100644
index 56f83a930c3dad1a1de366bff530131d92b4893c..c6b9b02e6d31bebb3f8c0cadd68e4b5c47fab090 100644
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
@@ -957,12 +957,23 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -958,12 +958,23 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
chunkRange = (chunkRange > world.spigotConfig.viewDistance) ? (byte) world.spigotConfig.viewDistance : chunkRange;
chunkRange = (chunkRange > 8) ? 8 : chunkRange;

View File

@ -21,10 +21,10 @@ index 3c39f1bb3d88baaaed4dd43c51faeef89bb5c6c2..48f0385c7203c7955de5a015f3dc42be
private void allChunksAreSlimeChunks() {
allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false);
diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
index 266c4bb75ceaf57b66bb1e4d4deb3e4bfec3fd4e..5bbb47eea88c068d0e4d22fd87a6dad46255ebe7 100644
index f9d0623a3ed5f49758cd5e97fe9f63a5b3198e58..18b0020d184e46c8957e82100681c8c66b1c3b62 100644
--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
+++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
@@ -1131,6 +1131,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1134,6 +1134,7 @@ public abstract class EntityHuman extends EntityLiving {
boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.isClimbing() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && entity instanceof EntityLiving;

View File

@ -6,15 +6,15 @@ Subject: [PATCH] Implement extended PaperServerListPingEvent
diff --git a/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..c1a8e295b66501e0580bcfc041bca51e69109062
index 0000000000000000000000000000000000000000..e7f1efd0466a5d7bb9584ffbd6fbac1ecc6153a5
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java
@@ -0,0 +1,31 @@
+package com.destroystokyo.paper.network;
+
+import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
+import net.minecraft.server.EntityPlayer;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.EntityPlayer;
+import org.bukkit.entity.Player;
+import org.bukkit.util.CachedServerIcon;
+
@ -43,13 +43,13 @@ index 0000000000000000000000000000000000000000..c1a8e295b66501e0580bcfc041bca51e
+}
diff --git a/src/main/java/com/destroystokyo/paper/network/PaperStatusClient.java b/src/main/java/com/destroystokyo/paper/network/PaperStatusClient.java
new file mode 100644
index 0000000000000000000000000000000000000000..a2a409e635dde08f7c53e67164b967a000511e94
index 0000000000000000000000000000000000000000..46e84ac6ba5d32d030267fb0c991c281a673c716
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/network/PaperStatusClient.java
@@ -0,0 +1,11 @@
+package com.destroystokyo.paper.network;
+
+import net.minecraft.server.NetworkManager;
+import net.minecraft.network.NetworkManager;
+
+class PaperStatusClient extends PaperNetworkClient implements StatusClient {
+
@ -60,7 +60,7 @@ index 0000000000000000000000000000000000000000..a2a409e635dde08f7c53e67164b967a0
+}
diff --git a/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..39b236a6319b1f44fbe28bbe43f064be3073e725
index 0000000000000000000000000000000000000000..174326871df9b61beec51ef6a1e5f26932404b6a
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java
@@ -0,0 +1,110 @@
@ -75,10 +75,10 @@ index 0000000000000000000000000000000000000000..39b236a6319b1f44fbe28bbe43f064be
+import java.util.List;
+import java.util.UUID;
+import javax.annotation.Nonnull;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.protocol.status.PacketStatusOutServerInfo;
+import net.minecraft.network.protocol.status.ServerPing;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.NetworkManager;
+import net.minecraft.network.protocol.game.PacketStatusOutServerInfo;
+import net.minecraft.server.ServerPing;
+
+public final class StandardPaperServerListPingEventImpl extends PaperServerListPingEventImpl {
+

View File

@ -35,10 +35,10 @@ index a903a073e6f5e8ae6ea383b786d930af69a966c5..2ce081e68fe27381d3e7f851b685cc54
uniqueId = i.getId();
// Paper end
diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
index 5bbb47eea88c068d0e4d22fd87a6dad46255ebe7..c7b2032fb677822c8352fabb29c881f609435cb8 100644
index 18b0020d184e46c8957e82100681c8c66b1c3b62..41dd46c6ef95f7dc41d9ca36a5f0b85f5608fdeb 100644
--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
+++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
@@ -159,7 +159,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -162,7 +162,7 @@ public abstract class EntityHuman extends EntityLiving {
protected int bG;
protected final float bH = 0.02F;
private int g;
@ -48,7 +48,7 @@ index 5bbb47eea88c068d0e4d22fd87a6dad46255ebe7..c7b2032fb677822c8352fabb29c881f6
private final ItemCooldown bM;
@Nullable
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index f8780db8f376ee71a35ebe1c2ab84a6117d0d74e..08ef5d2a275f8bf295501b22c5b743f60ac0d465 100644
index f8780db8f376ee71a35ebe1c2ab84a6117d0d74e..87d00559fb54ed93a374ce827d2d99b4a11c73d7 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1308,8 +1308,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@ -20,10 +20,10 @@ index 48f0385c7203c7955de5a015f3dc42be2ab7b681..cebf1a623a9bec72d60fdd23dda01868
+ }
}
diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
index c7b2032fb677822c8352fabb29c881f609435cb8..e6b75b6a493f91ccdd67fa507c9869b4007fb907 100644
index 41dd46c6ef95f7dc41d9ca36a5f0b85f5608fdeb..7839553662d7f1f378969d42fb7a560e489852f4 100644
--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
+++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
@@ -1180,7 +1180,11 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1183,7 +1183,11 @@ public abstract class EntityHuman extends EntityLiving {
}
this.setMot(this.getMot().d(0.6D, 1.0D, 0.6D));

View File

@ -48,10 +48,10 @@ index 1dcdf9e328670b42d656e8ab65cb3da8a2312fe6..9f6f6ac15688a1010d466e6f0cc3ac5b
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 49247437c91f1d8f24c2bf506d2de200758bad88..279de5299483d3fa2f0878d9fafb471d0b5c78a8 100644
index c43c300963bae9bca6ab9c9389dd53e42318715c..2d1c54eed8fa6885837d63014ff1f4b33dd35bd7 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -710,5 +710,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -711,5 +711,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public void setArrowsStuck(int arrows) {
getHandle().setArrowCount(arrows);
}

View File

@ -7,10 +7,10 @@ Called when a player is firing a bow and the server is choosing an arrow to use.
Plugins can skip selection of certain arrows and control which is used.
diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
index e6b75b6a493f91ccdd67fa507c9869b4007fb907..5a5d6b867d985b55a1bc7286606f73ee5874245f 100644
index 7839553662d7f1f378969d42fb7a560e489852f4..408732c59ed817c056671a78e43a734b048a818e 100644
--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
+++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
@@ -2139,6 +2139,17 @@ public abstract class EntityHuman extends EntityLiving {
@@ -2142,6 +2142,17 @@ public abstract class EntityHuman extends EntityLiving {
return ImmutableList.of(EntityPose.STANDING, EntityPose.CROUCHING, EntityPose.SWIMMING);
}
@ -28,7 +28,7 @@ index e6b75b6a493f91ccdd67fa507c9869b4007fb907..5a5d6b867d985b55a1bc7286606f73ee
@Override
public ItemStack f(ItemStack itemstack) {
if (!(itemstack.getItem() instanceof ItemProjectileWeapon)) {
@@ -2155,7 +2166,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -2158,7 +2169,7 @@ public abstract class EntityHuman extends EntityLiving {
for (int i = 0; i < this.inventory.getSize(); ++i) {
ItemStack itemstack2 = this.inventory.getItem(i);

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Implement EntityKnockbackByEntityEvent
This event is called when an entity receives knockback by another entity.
diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
index 0387052b45cdc849d9e67113532a7591f05e5531..486f4727dbcb7955103f854baed9b571fb3b9f3e 100644
index c22b5f8fcdd4aa7dac242f634ef73edcd8745fc6..41566398f5eee6cf93376f2e2200728bb6d2181c 100644
--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java
+++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
@@ -1565,7 +1565,7 @@ public abstract class EntityInsentient extends EntityLiving {
@@ -1568,7 +1568,7 @@ public abstract class EntityInsentient extends EntityLiving {
if (flag) {
if (f1 > 0.0F && entity instanceof EntityLiving) {
@ -70,10 +70,10 @@ index 9f6f6ac15688a1010d466e6f0cc3ac5b8297eb21..61bd7afdafc77725c24c6af978578df0
}
diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
index 5a5d6b867d985b55a1bc7286606f73ee5874245f..e9dd1ee6dbc8baff395c69e2cb1d7b3a4551f90a 100644
index 408732c59ed817c056671a78e43a734b048a818e..3c49d7acd4ad0717886adf6c469e8a49a58e859b 100644
--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
+++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
@@ -1174,7 +1174,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1177,7 +1177,7 @@ public abstract class EntityHuman extends EntityLiving {
if (flag5) {
if (i > 0) {
if (entity instanceof EntityLiving) {
@ -82,7 +82,7 @@ index 5a5d6b867d985b55a1bc7286606f73ee5874245f..e9dd1ee6dbc8baff395c69e2cb1d7b3a
} else {
entity.i((double) (-MathHelper.sin(this.yaw * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 0.017453292F) * (float) i * 0.5F));
}
@@ -1198,7 +1198,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1201,7 +1201,7 @@ public abstract class EntityHuman extends EntityLiving {
if (entityliving != this && entityliving != entity && !this.r(entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.h((Entity) entityliving) < 9.0D) {
// CraftBukkit start - Only apply knockback if the damage hits
if (entityliving.damageEntity(DamageSource.playerAttack(this).sweep(), f4)) {

View File

@ -32,10 +32,10 @@ index 61bd7afdafc77725c24c6af978578df0b2d8ca0f..189a00cb68ce9a9060117b79c5356ebb
return this.isHandRaised() ? this.activeItem.k() - this.dZ() : 0;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 279de5299483d3fa2f0878d9fafb471d0b5c78a8..db58175ac8972a4a9f5b7b312c6301f87e943a0e 100644
index 2d1c54eed8fa6885837d63014ff1f4b33dd35bd7..bd24b9865f37c34ffd63cd411ddc84abe5ab30d0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -720,5 +720,25 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -721,5 +721,25 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public void setShieldBlockingDelay(int delay) {
getHandle().setShieldBlockingDelay(delay);
}

View File

@ -61,7 +61,7 @@ index 8b79d547a3296f056731cbb66508494d84809e94..b3c5a22bf2eb360399ebfbf90fc74843
this.o();
}
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index 3876958f20e675c4c8fd505c5fb333ccb9cdc8c9..eb909ef3a34045480034bd7d7f3e5ac674f664b5 100644
index 32ad210daf61b6c43fc60f3140dc46529d14ec27..95cd4855cf577d9ceac8c3b45ac54705bea00ea9 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -1123,7 +1123,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
@ -112,10 +112,10 @@ index 415f34109019e68638f76fefa52bd8d40c449e12..c4f14fabc83a9cb13f8f82b651119e0a
this.player.o();
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 41b63da42067397122897d23fd7fb0e517d7c552..2939a8186254a39ef20d778421b0ed984bb20a32 100644
index 738a69a1a5765897fb3ca3b4ceb07cddade0d27f..349bd74e7e4d1dea9587e55cb6afc1968628ca01 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -493,7 +493,7 @@ public abstract class PlayerList {
@@ -494,7 +494,7 @@ public abstract class PlayerList {
// CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it
// See SPIGOT-5799, SPIGOT-6145
if (entityplayer.activeContainer != entityplayer.defaultContainer) {
@ -125,10 +125,10 @@ index 41b63da42067397122897d23fd7fb0e517d7c552..2939a8186254a39ef20d778421b0ed98
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getName())));
diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
index e9dd1ee6dbc8baff395c69e2cb1d7b3a4551f90a..5f92ba350658c7f1cac9111f06d95e6ffc5600c3 100644
index 3c49d7acd4ad0717886adf6c469e8a49a58e859b..b6effe1037f3ae59e6faa5f5d039b6ad54bca5d4 100644
--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
+++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
@@ -249,7 +249,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -252,7 +252,7 @@ public abstract class EntityHuman extends EntityLiving {
this.et();
super.tick();
if (!this.world.isClientSide && this.activeContainer != null && !this.activeContainer.canUse(this)) {
@ -137,7 +137,7 @@ index e9dd1ee6dbc8baff395c69e2cb1d7b3a4551f90a..5f92ba350658c7f1cac9111f06d95e6f
this.activeContainer = this.defaultContainer;
}
@@ -444,6 +444,13 @@ public abstract class EntityHuman extends EntityLiving {
@@ -447,6 +447,13 @@ public abstract class EntityHuman extends EntityLiving {
return 20;
}
@ -180,7 +180,7 @@ index a3396a19ba60daeb7240f23831e4bc28631098cc..2ca9d061ec951fb0563959620f0e9959
@Override
public boolean isBlocking() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 5a9b23fd4a414c52ce4b1ccb8696a4408b0b7c90..1851f261ce8e454cbe4012c0c4ea6a69e926daa0 100644
index 89476782c71a0c54ff140a501a97fdfc4c8f4b81..b4c763d2935aad0038128a61ed09c4904975f0ef 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -895,7 +895,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Add Debug Entities option to debug dupe uuid issues
Add -Ddebug.entities=true to your JVM flags to gain more information
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
index 88e7fe1d50e644a107aa76c84b7fd1b9b43cd94b..f0347a71b5937f9b68a4024fd0595a2d3e98eef5 100644
index c6b9b02e6d31bebb3f8c0cadd68e4b5c47fab090..c4dd2bac48bb93117925b35dcd753d0fbb22e3cf 100644
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
@@ -1138,6 +1138,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -1139,6 +1139,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
} else {
PlayerChunkMap.EntityTracker playerchunkmap_entitytracker = new PlayerChunkMap.EntityTracker(entity, i, j, entitytypes.isDeltaTracking());
@ -17,7 +17,7 @@ index 88e7fe1d50e644a107aa76c84b7fd1b9b43cd94b..f0347a71b5937f9b68a4024fd0595a2d
this.trackedEntities.put(entity.getId(), playerchunkmap_entitytracker);
playerchunkmap_entitytracker.track(this.world.getPlayers());
if (entity instanceof EntityPlayer) {
@@ -1179,7 +1180,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -1180,7 +1181,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
if (playerchunkmap_entitytracker1 != null) {
playerchunkmap_entitytracker1.a();
}
@ -27,13 +27,13 @@ index 88e7fe1d50e644a107aa76c84b7fd1b9b43cd94b..f0347a71b5937f9b68a4024fd0595a2d
protected void g() {
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index 4d3e3a4496ab28e0865f2ad871915fcb2ae57e36..70b837ef82dfe46eb24625b96f9bdbe2e7f2cc2d 100644
index 24563d21ce2a77b47300cca00e07658a014be96c..04b708e776f277985340f329dc8cb3c16a6100a7 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -197,6 +197,9 @@ public class WorldServer extends World implements GeneratorAccessSeed {
public final Convertable.ConversionSession convertable;
public final UUID uuid;
boolean hasPhysicsEvent = true; // Paper
public boolean hasPhysicsEvent = true; // Paper
+ private static Throwable getAddToWorldStackTrace(Entity entity) {
+ return new Throwable(entity + " Added to world at " + new java.util.Date());
+ }
@ -97,23 +97,31 @@ index 4d3e3a4496ab28e0865f2ad871915fcb2ae57e36..70b837ef82dfe46eb24625b96f9bdbe2
// CraftBukkit start - SPIGOT-5278
if (entity instanceof EntityDrowned) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index a4915d330d9df8773ce2643a17f353045fff7965..94c77ea291b13206c726725def2ecf4e6441bf3f 100644
index a4915d330d9df8773ce2643a17f353045fff7965..36ac9ba19b3bbcab40b5d4339ba9c297d4b5a65b 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -161,6 +161,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
@@ -48,6 +48,7 @@ import net.minecraft.resources.MinecraftKey;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.EntityPlayer;
+import net.minecraft.server.level.PlayerChunkMap;
import net.minecraft.server.level.TicketType;
import net.minecraft.server.level.WorldServer;
import net.minecraft.sounds.SoundCategory;
@@ -161,6 +162,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
private CraftEntity bukkitEntity;
+ PlayerChunkMap.EntityTracker tracker; // Paper
+ Throwable addedToWorldStack; // Paper - entity debug
+ public Throwable addedToWorldStack; // Paper - entity debug
public CraftEntity getBukkitEntity() {
if (bukkitEntity == null) {
bukkitEntity = CraftEntity.getEntity(world.getServer(), this);
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
index f7df55cf3da909c253bab106cdb7149ee9c297d9..6b81392010c216a1c478cae170388d6836e4206e 100644
index a9e7da1c848a6fe08fc112e445ceec1b7715d682..0d375af209e9768f430e08bd7a4bde1863b14da5 100644
--- a/src/main/java/net/minecraft/world/level/World.java
+++ b/src/main/java/net/minecraft/world/level/World.java
@@ -120,6 +120,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -121,6 +121,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public boolean pvpMode;
public boolean keepSpawnInMemory = true;
public org.bukkit.generator.ChunkGenerator generator;

View File

@ -19,10 +19,10 @@ index 4813f62d1e382d5ac6971b2244df3f13c80d1950..3562950df4868b1393790b1a1ff1fe0d
+ }
}
diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
index e9ea670248eb0680cdff9a72412e9331fc57ff8a..0936924707306204c06064ee796413159835bfa9 100644
index 57e0ea95df34fab22d6c5868ab839d56a3fa85fc..829013f57128cc6c92a45098c6883f2305cf4ea5 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
@@ -355,6 +355,7 @@ public class EntityArmorStand extends EntityLiving {
@@ -356,6 +356,7 @@ public class EntityArmorStand extends EntityLiving {
@Override
protected void collideNearby() {
@ -31,10 +31,18 @@ index e9ea670248eb0680cdff9a72412e9331fc57ff8a..0936924707306204c06064ee79641315
for (int i = 0; i < list.size(); ++i) {
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
index 6b81392010c216a1c478cae170388d6836e4206e..06ec41f816bc75ee0fa6418c21ff5a416c834518 100644
index 0d375af209e9768f430e08bd7a4bde1863b14da5..8c7263f9dbb00cf6484e7f70b8d97639bab0cefc 100644
--- a/src/main/java/net/minecraft/world/level/World.java
+++ b/src/main/java/net/minecraft/world/level/World.java
@@ -853,6 +853,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -37,6 +37,7 @@ import net.minecraft.world.DifficultyDamageScaler;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityTypes;
+import net.minecraft.world.entity.decoration.EntityArmorStand;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.CraftingManager;
@@ -854,6 +855,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
// Paper end
}
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Vanished players don't have rights
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 94c77ea291b13206c726725def2ecf4e6441bf3f..d9dac0420fff1ae06ebbe6cf0d9c9fb2b71eb673 100644
index 36ac9ba19b3bbcab40b5d4339ba9c297d4b5a65b..e243aa01d59c3e1b6c813922bcf6e04db0693d20 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -183,7 +183,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
@@ -184,7 +184,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
private static double e = 1.0D;
private final EntityTypes<?> f;
private int id;
@ -52,10 +52,29 @@ index ec12bea9de910824927ba31628b49f6713f31a29..59d52c252b2e59923b8e513dd4d2e1ec
BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()), player, CraftBlockData.fromData(iblockdata), defaultReturn);
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
index 06ec41f816bc75ee0fa6418c21ff5a416c834518..7b552e4e71c82833da2114604de98350567128f0 100644
index 8c7263f9dbb00cf6484e7f70b8d97639bab0cefc..07c5cdd00930a55fd412ef95f71f55ee908189a1 100644
--- a/src/main/java/net/minecraft/world/level/World.java
+++ b/src/main/java/net/minecraft/world/level/World.java
@@ -230,6 +230,46 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -27,6 +27,7 @@ import net.minecraft.network.protocol.Packet;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.level.PlayerChunk;
import net.minecraft.sounds.SoundCategory;
import net.minecraft.sounds.SoundEffect;
@@ -65,6 +66,10 @@ import net.minecraft.world.level.saveddata.maps.WorldMap;
import net.minecraft.world.level.storage.WorldData;
import net.minecraft.world.level.storage.WorldDataMutable;
import net.minecraft.world.phys.AxisAlignedBB;
+import net.minecraft.world.phys.shapes.OperatorBoolean;
+import net.minecraft.world.phys.shapes.VoxelShape;
+import net.minecraft.world.phys.shapes.VoxelShapeCollision;
+import net.minecraft.world.phys.shapes.VoxelShapes;
import net.minecraft.world.scores.Scoreboard;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -232,6 +237,46 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
}

View File

@ -9,10 +9,10 @@ This should hopefully avoid duplicate entities ever being created
if the entity was to end up in 2 different chunk slices
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index d9dac0420fff1ae06ebbe6cf0d9c9fb2b71eb673..398c1f223d25931fb4de65582ab162bfc4be5050 100644
index e243aa01d59c3e1b6c813922bcf6e04db0693d20..6c6171175b1f9cd4471162d070f668263f900dc0 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -156,6 +156,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
@@ -157,6 +157,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
}
}
};

View File

@ -23,7 +23,7 @@ index 6943524c2dd8b12691b8ac5b08daee823ce50c3d..b67bd98cca4a06bc0ebaed577195dffc
MutablePair<Integer, Map<ChunkCoordIntPair, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap()));
ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.chunkX, e.chunkZ);
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index b121d404f3afb69fa1d0eae727c1dba92eadb0e5..7db20b7d8582595bc40f585104db21e04550d43d 100644
index c59bcb6e19b712e007c7bf66bf70a4ffa3c6c2cd..8452b4f62689b231d38f4608c2d72b41164078b3 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -1307,6 +1307,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
@ -43,10 +43,10 @@ index b121d404f3afb69fa1d0eae727c1dba92eadb0e5..7db20b7d8582595bc40f585104db21e0
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 398c1f223d25931fb4de65582ab162bfc4be5050..110b88a098de307ed02b7f72c02c333cd32ec531 100644
index 6c6171175b1f9cd4471162d070f668263f900dc0..a7115fb1fc6fadb38c7cc9f23629473a7173982e 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -275,6 +275,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
@@ -276,6 +276,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
protected int numCollisions = 0; // Paper
public void inactiveTick() { }
// Spigot end

View File

@ -8,10 +8,10 @@ Add the following:
- Enable/Disable slot interactions
diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
index 0936924707306204c06064ee796413159835bfa9..94cb66e0651d918ad984e2056602c70335ce2032 100644
index 829013f57128cc6c92a45098c6883f2305cf4ea5..e97d25339b37a70f91022dcb021bbe82fb8f5eda 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
@@ -429,6 +429,7 @@ public class EntityArmorStand extends EntityLiving {
@@ -430,6 +430,7 @@ public class EntityArmorStand extends EntityLiving {
return enumitemslot;
}

View File

@ -29,7 +29,7 @@ index 97ef4c65c8cc569a99d9697f56bd44d32b151328..51993191e01f55e16667c25b8b57d6a6
this.world.a(blockposition, false);
diff --git a/src/main/java/net/minecraft/world/level/block/BlockFire.java b/src/main/java/net/minecraft/world/level/block/BlockFire.java
index c22fad0038fdb0769e23db782e3341206fbd80f9..d2d59cc1acc7f67de62ac8d765f2b6b491b69053 100644
index c22fad0038fdb0769e23db782e3341206fbd80f9..5ef38414d87fbce453e3ab11579c89a8ff089ae0 100644
--- a/src/main/java/net/minecraft/world/level/block/BlockFire.java
+++ b/src/main/java/net/minecraft/world/level/block/BlockFire.java
@@ -3,6 +3,7 @@ package net.minecraft.world.level.block;
@ -40,7 +40,15 @@ index c22fad0038fdb0769e23db782e3341206fbd80f9..d2d59cc1acc7f67de62ac8d765f2b6b4
import java.util.Map;
import java.util.Random;
import java.util.function.Function;
@@ -289,7 +290,7 @@ public class BlockFire extends BlockFireAbstract {
@@ -11,6 +12,7 @@ import net.minecraft.SystemUtils;
import net.minecraft.core.BaseBlockPosition;
import net.minecraft.core.BlockPosition;
import net.minecraft.core.EnumDirection;
+import net.minecraft.server.MCUtil;
import net.minecraft.server.level.WorldServer;
import net.minecraft.world.item.context.BlockActionContext;
import net.minecraft.world.level.GameRules;
@@ -289,7 +291,7 @@ public class BlockFire extends BlockFireAbstract {
world.setTypeAndData(blockposition, this.a(world, blockposition, l), 3);
} else {
@ -49,7 +57,7 @@ index c22fad0038fdb0769e23db782e3341206fbd80f9..d2d59cc1acc7f67de62ac8d765f2b6b4
}
Block block = iblockdata.getBlock();
@@ -297,6 +298,13 @@ public class BlockFire extends BlockFireAbstract {
@@ -297,6 +299,13 @@ public class BlockFire extends BlockFireAbstract {
if (block instanceof BlockTNT) {
BlockTNT blocktnt = (BlockTNT) block;

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add hand to bucket events
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index 7db20b7d8582595bc40f585104db21e04550d43d..690e40aeed96a8d83e86c9aff0e910f6aa97c1c9 100644
index 8452b4f62689b231d38f4608c2d72b41164078b3..ab18969083e89eb2016c6a6bffc06f4e83c9f753 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -1656,15 +1656,17 @@ public class WorldServer extends World implements GeneratorAccessSeed {
@ -104,10 +104,10 @@ index 4bcac8defeaa146713cce43e04a51c1c9afddb1f..d126f668828e0788e369294c0b376ef5
int i = blockposition.getX();
int j = blockposition.getY();
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
index 7b552e4e71c82833da2114604de98350567128f0..b0044d97afca1f658c193278eed542a743f20668 100644
index 07c5cdd00930a55fd412ef95f71f55ee908189a1..88b1a0235bfc0b41ae1855f8900632e425730d1c 100644
--- a/src/main/java/net/minecraft/world/level/World.java
+++ b/src/main/java/net/minecraft/world/level/World.java
@@ -270,6 +270,17 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -277,6 +277,17 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
}
// Paper end

View File

@ -54,10 +54,18 @@ index df459918c14589155a574730205cb35d463b8079..4fc06bc5ef630b07fc8462cf835e6f92
// CraftBukkit end
return itemstack;
diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java
index b6b55d5baa5e8a6b69a3e4865c06bc8a4d61a4f3..7b47d4f1cbf9f8646e0b1af9277cf341ea28a2b3 100644
index b6b55d5baa5e8a6b69a3e4865c06bc8a4d61a4f3..152118729b1a95dcae05d32aa4289034ba394226 100644
--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java
+++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java
@@ -69,6 +69,7 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
@@ -15,6 +15,7 @@ import net.minecraft.network.PacketDataSerializer;
import net.minecraft.network.protocol.Packet;
import net.minecraft.world.level.ChunkCoordIntPair;
import net.minecraft.world.level.block.entity.TileEntity;
+import net.minecraft.world.level.block.entity.TileEntitySkull;
import net.minecraft.world.level.chunk.BiomeStorage;
import net.minecraft.world.level.chunk.Chunk;
import net.minecraft.world.level.chunk.ChunkSection;
@@ -69,6 +70,7 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
if (this.f() || (i & 1 << j) != 0) {
NBTTagCompound nbttagcompound = tileentity.b();
@ -79,10 +87,18 @@ index c525afbc7d73488db2cae1501cdbe80ec05aeb7c..de171e18fbc6cc5ee06e75f4a3c60fd4
private Entity k;
private ShapeDetectorBlock l;
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java
index 06ab45e0927403beb6b5e11d2b5ea93d4786f1d3..fcc393bcf3e40c347a0320544cc93eb84a4d0b90 100644
index 06ab45e0927403beb6b5e11d2b5ea93d4786f1d3..0c95465cdc29418063a960033fe80de6932c8aa8 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java
@@ -153,9 +153,37 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa
@@ -8,6 +8,7 @@ import java.util.UUID;
import javax.annotation.Nullable;
import net.minecraft.nbt.GameProfileSerializer;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.protocol.game.PacketPlayOutTileEntityData;
import net.minecraft.server.players.UserCache;
import net.minecraft.util.UtilColor;
@@ -153,9 +154,37 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa
@Nullable
@Override
public PacketPlayOutTileEntityData getUpdatePacket() {
@ -91,7 +107,7 @@ index 06ab45e0927403beb6b5e11d2b5ea93d4786f1d3..fcc393bcf3e40c347a0320544cc93eb8
}
+ // Paper start
+ static NBTTagCompound sanitizeTileEntityUUID(NBTTagCompound cmp) {
+ public static NBTTagCompound sanitizeTileEntityUUID(NBTTagCompound cmp) {
+ NBTTagCompound owner = cmp.getCompound("Owner");
+ if (!owner.isEmpty()) {
+ sanitizeUUID(owner);

View File

@ -122,10 +122,10 @@ index 52256f72b00d3b868ef1a60e15a3836197c769d9..cd35b833d3047a38be980ee550641e87
this.d.values().stream().map((jsonlistentry) -> {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 2939a8186254a39ef20d778421b0ed984bb20a32..1dfa84dfb7b62c50081ad32b012d108a0b77b83c 100644
index 349bd74e7e4d1dea9587e55cb6afc1968628ca01..3aaa6313a33865b9823aa38e5d0cce7edce04592 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -617,7 +617,7 @@ public abstract class PlayerList {
@@ -618,7 +618,7 @@ public abstract class PlayerList {
} else if (!this.isWhitelisted(gameprofile, event)) { // Paper
//chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted"); // Paper
//event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot // Paper - moved to isWhitelisted

View File

@ -20,10 +20,10 @@ index 3562950df4868b1393790b1a1ff1fe0dc589c155..5ab0e7183e48134b7a0f736462516b1a
+ }
}
diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
index 94cb66e0651d918ad984e2056602c70335ce2032..b2a661ddcf13f7d7758cc1cac1f4d2c3fa6c4635 100644
index e97d25339b37a70f91022dcb021bbe82fb8f5eda..8d35240405d7f7245f3c7b0b611973d58fa4384f 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
@@ -80,9 +80,16 @@ public class EntityArmorStand extends EntityLiving {
@@ -81,9 +81,16 @@ public class EntityArmorStand extends EntityLiving {
public Vector3f leftLegPose;
public Vector3f rightLegPose;
public boolean canMove = true; // Paper
@ -40,7 +40,7 @@ index 94cb66e0651d918ad984e2056602c70335ce2032..b2a661ddcf13f7d7758cc1cac1f4d2c3
this.handItems = NonNullList.a(2, ItemStack.b);
this.armorItems = NonNullList.a(4, ItemStack.b);
this.headPose = EntityArmorStand.bj;
@@ -178,6 +185,7 @@ public class EntityArmorStand extends EntityLiving {
@@ -179,6 +186,7 @@ public class EntityArmorStand extends EntityLiving {
this.armorItems.set(enumitemslot.b(), itemstack);
}
@ -48,7 +48,7 @@ index 94cb66e0651d918ad984e2056602c70335ce2032..b2a661ddcf13f7d7758cc1cac1f4d2c3
}
@Override
@@ -258,6 +266,7 @@ public class EntityArmorStand extends EntityLiving {
@@ -259,6 +267,7 @@ public class EntityArmorStand extends EntityLiving {
}
nbttagcompound.set("Pose", this.B());
@ -56,7 +56,7 @@ index 94cb66e0651d918ad984e2056602c70335ce2032..b2a661ddcf13f7d7758cc1cac1f4d2c3
}
@Override
@@ -289,6 +298,12 @@ public class EntityArmorStand extends EntityLiving {
@@ -290,6 +299,12 @@ public class EntityArmorStand extends EntityLiving {
this.setBasePlate(nbttagcompound.getBoolean("NoBasePlate"));
this.setMarker(nbttagcompound.getBoolean("Marker"));
this.noclip = !this.A();
@ -69,7 +69,7 @@ index 94cb66e0651d918ad984e2056602c70335ce2032..b2a661ddcf13f7d7758cc1cac1f4d2c3
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Pose");
this.g(nbttagcompound1);
@@ -644,7 +659,29 @@ public class EntityArmorStand extends EntityLiving {
@@ -645,7 +660,29 @@ public class EntityArmorStand extends EntityLiving {
@Override
public void tick() {
@ -99,7 +99,7 @@ index 94cb66e0651d918ad984e2056602c70335ce2032..b2a661ddcf13f7d7758cc1cac1f4d2c3
Vector3f vector3f = (Vector3f) this.datawatcher.get(EntityArmorStand.c);
if (!this.headPose.equals(vector3f)) {
@@ -767,29 +804,36 @@ public class EntityArmorStand extends EntityLiving {
@@ -768,29 +805,36 @@ public class EntityArmorStand extends EntityLiving {
public void setHeadPose(Vector3f vector3f) {
this.headPose = vector3f;
this.datawatcher.set(EntityArmorStand.c, vector3f);

View File

@ -33,32 +33,64 @@ index 189a00cb68ce9a9060117b79c5356ebb93d7fa62..9d8f92c313829bb32c17907bf2ef23d0
public int getShieldBlockingDelay() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index db58175ac8972a4a9f5b7b312c6301f87e943a0e..a60a12a7705be29b6f318c587e1c6149b89d86c3 100644
index bd24b9865f37c34ffd63cd411ddc84abe5ab30d0..c692626b747008a5418ecabf550fc67e3b676f5b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -201,6 +201,28 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -1,5 +1,6 @@
package org.bukkit.craftbukkit.entity;
+import com.destroystokyo.paper.block.TargetBlockInfo;
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
import java.util.ArrayList;
@@ -8,6 +9,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.UUID;
+import net.minecraft.server.MCUtil;
import net.minecraft.server.level.EntityPlayer;
import net.minecraft.world.EnumHand;
import net.minecraft.world.damagesource.DamageSource;
@@ -40,6 +42,8 @@ import net.minecraft.world.entity.projectile.EntityThrownExpBottle;
import net.minecraft.world.entity.projectile.EntityThrownTrident;
import net.minecraft.world.entity.projectile.EntityTippedArrow;
import net.minecraft.world.entity.projectile.EntityWitherSkull;
+import net.minecraft.world.phys.MovingObjectPosition;
+import net.minecraft.world.phys.MovingObjectPositionBlock;
import org.apache.commons.lang.Validate;
import org.bukkit.FluidCollisionMode;
import org.bukkit.Location;
@@ -49,6 +53,7 @@ import org.bukkit.attribute.AttributeInstance;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
+import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.entity.memory.CraftMemoryKey;
import org.bukkit.craftbukkit.entity.memory.CraftMemoryMapper;
import org.bukkit.craftbukkit.inventory.CraftEntityEquipment;
@@ -202,6 +207,28 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return blocks.get(0);
}
+ // Paper start
+ @Override
+ public Block getTargetBlock(int maxDistance, com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode) {
+ net.minecraft.server.MovingObjectPosition rayTrace = getHandle().getRayTrace(maxDistance, net.minecraft.server.MCUtil.getNMSFluidCollisionOption(fluidMode));
+ return !(rayTrace instanceof net.minecraft.server.MovingObjectPositionBlock) ? null : org.bukkit.craftbukkit.block.CraftBlock.at(getHandle().world, ((net.minecraft.server.MovingObjectPositionBlock)rayTrace).getBlockPosition());
+ public Block getTargetBlock(int maxDistance, TargetBlockInfo.FluidMode fluidMode) {
+ MovingObjectPosition rayTrace = getHandle().getRayTrace(maxDistance, MCUtil.getNMSFluidCollisionOption(fluidMode));
+ return !(rayTrace instanceof MovingObjectPositionBlock) ? null : CraftBlock.at(getHandle().world, ((MovingObjectPositionBlock)rayTrace).getBlockPosition());
+ }
+
+ @Override
+ public org.bukkit.block.BlockFace getTargetBlockFace(int maxDistance, com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode) {
+ net.minecraft.server.MovingObjectPosition rayTrace = getHandle().getRayTrace(maxDistance, net.minecraft.server.MCUtil.getNMSFluidCollisionOption(fluidMode));
+ return !(rayTrace instanceof net.minecraft.server.MovingObjectPositionBlock) ? null : net.minecraft.server.MCUtil.toBukkitBlockFace(((net.minecraft.server.MovingObjectPositionBlock)rayTrace).getDirection());
+ public org.bukkit.block.BlockFace getTargetBlockFace(int maxDistance, TargetBlockInfo.FluidMode fluidMode) {
+ MovingObjectPosition rayTrace = getHandle().getRayTrace(maxDistance, MCUtil.getNMSFluidCollisionOption(fluidMode));
+ return !(rayTrace instanceof MovingObjectPositionBlock) ? null : MCUtil.toBukkitBlockFace(((MovingObjectPositionBlock)rayTrace).getDirection());
+ }
+
+ @Override
+ public com.destroystokyo.paper.block.TargetBlockInfo getTargetBlockInfo(int maxDistance, com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode) {
+ net.minecraft.server.MovingObjectPosition rayTrace = getHandle().getRayTrace(maxDistance, net.minecraft.server.MCUtil.getNMSFluidCollisionOption(fluidMode));
+ return !(rayTrace instanceof net.minecraft.server.MovingObjectPositionBlock) ? null :
+ new com.destroystokyo.paper.block.TargetBlockInfo(org.bukkit.craftbukkit.block.CraftBlock.at(getHandle().world, ((net.minecraft.server.MovingObjectPositionBlock)rayTrace).getBlockPosition()),
+ net.minecraft.server.MCUtil.toBukkitBlockFace(((net.minecraft.server.MovingObjectPositionBlock)rayTrace).getDirection()));
+ public TargetBlockInfo getTargetBlockInfo(int maxDistance, TargetBlockInfo.FluidMode fluidMode) {
+ MovingObjectPosition rayTrace = getHandle().getRayTrace(maxDistance, MCUtil.getNMSFluidCollisionOption(fluidMode));
+ return !(rayTrace instanceof MovingObjectPositionBlock) ? null :
+ new TargetBlockInfo(CraftBlock.at(getHandle().world, ((MovingObjectPositionBlock)rayTrace).getBlockPosition()),
+ MCUtil.toBukkitBlockFace(((MovingObjectPositionBlock)rayTrace).getDirection()));
+ }
+ // Paper end
+

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Expose attack cooldown methods for Player
diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
index 5f92ba350658c7f1cac9111f06d95e6ffc5600c3..bed54f9732bbfe9edab81744276643da482785d3 100644
index b6effe1037f3ae59e6faa5f5d039b6ad54bca5d4..87374174dcbf9e7ee448a1cdd9a3528557c3a2ea 100644
--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
+++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
@@ -2100,6 +2100,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -2103,6 +2103,7 @@ public abstract class EntityHuman extends EntityLiving {
this.datawatcher.set(EntityHuman.bl, nbttagcompound);
}
@ -17,7 +17,7 @@ index 5f92ba350658c7f1cac9111f06d95e6ffc5600c3..bed54f9732bbfe9edab81744276643da
return (float) (1.0D / this.b(GenericAttributes.ATTACK_SPEED) * 20.0D);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 1851f261ce8e454cbe4012c0c4ea6a69e926daa0..c763f2bbd10ce6b62d703d3eabb894f24be91b11 100644
index b4c763d2935aad0038128a61ed09c4904975f0ef..330ea2ea346867fc9005352e87cca892a1d33e03 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2181,6 +2181,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@ -15,7 +15,7 @@ items and experience which is otherwise only properly possible by using
internal code.
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
index b3c5a22bf2eb360399ebfbf90fc74843dcd78509..b1e45c326b27d640337fc69bd0e107f5db3eb4cf 100644
index b3c5a22bf2eb360399ebfbf90fc74843dcd78509..1198de213b3809ddf7b7d6f1696d9f07bb4dc42e 100644
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
@@ -213,6 +213,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -78,10 +78,10 @@ index f6f79ed9c38206cc6a4feb5504e854a476868aec..7d2b947b3c2b255c01241f2c4a6d7377
int i = this.f ? 300 : 100;
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 110b88a098de307ed02b7f72c02c333cd32ec531..4d7bb023092ee118d68ecce1918e220f541b33c1 100644
index a7115fb1fc6fadb38c7cc9f23629473a7173982e..2fc25a13a554174d2b5f415c910c4a26e37b30e1 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1537,6 +1537,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
@@ -1538,6 +1538,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
}
// CraftBukkit end
@ -89,7 +89,7 @@ index 110b88a098de307ed02b7f72c02c333cd32ec531..4d7bb023092ee118d68ecce1918e220f
public void a(Entity entity, int i, DamageSource damagesource) {
if (entity instanceof EntityPlayer) {
CriterionTriggers.c.a((EntityPlayer) entity, this, damagesource);
@@ -2436,6 +2437,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
@@ -2437,6 +2438,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
this.fallDistance = 0.0F;
}
@ -311,10 +311,10 @@ index aa12a0c9f30cd2b8a6de75ff9822843da808ae64..3daa1780a332128bd472fa80039112f3
public void saveData(NBTTagCompound nbttagcompound) {
super.saveData(nbttagcompound);
diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
index b2a661ddcf13f7d7758cc1cac1f4d2c3fa6c4635..b93d04cd23a3a3616d1594c69174ea1271a204fb 100644
index 8d35240405d7f7245f3c7b0b611973d58fa4384f..69361caebf0d3caa5195b519a16691705ac5e16a 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
@@ -745,7 +745,8 @@ public class EntityArmorStand extends EntityLiving {
@@ -746,7 +746,8 @@ public class EntityArmorStand extends EntityLiving {
@Override
public void killEntity() {
@ -325,7 +325,7 @@ index b2a661ddcf13f7d7758cc1cac1f4d2c3fa6c4635..b93d04cd23a3a3616d1594c69174ea12
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index c763f2bbd10ce6b62d703d3eabb894f24be91b11..5c3b83244e77c54d3de5cf56171a88c2952fcd13 100644
index 330ea2ea346867fc9005352e87cca892a1d33e03..91da1f4d933b991c73e04e077722382d02487e07 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1836,7 +1836,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -346,10 +346,19 @@ index c763f2bbd10ce6b62d703d3eabb894f24be91b11..5c3b83244e77c54d3de5cf56171a88c2
public void injectScaledMaxHealth(Collection<AttributeModifiable> collection, boolean force) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index ecd3b31216616b0ffe239785e3942cfb4bfebcf8..e408f30da80a4f1450d6ac659e25e511190b1c7b 100644
index ecd3b31216616b0ffe239785e3942cfb4bfebcf8..0f8764f16b0719e9e370731dc02627e1a55e9708 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -784,9 +784,16 @@ public class CraftEventFactory {
@@ -18,6 +18,8 @@ import net.minecraft.network.protocol.game.PacketPlayInCloseWindow;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.level.WorldServer;
+import net.minecraft.sounds.SoundCategory;
+import net.minecraft.sounds.SoundEffect;
import net.minecraft.util.Unit;
import net.minecraft.world.EnumHand;
import net.minecraft.world.IInventory;
@@ -784,9 +786,16 @@ public class CraftEventFactory {
public static EntityDeathEvent callEntityDeathEvent(EntityLiving victim, List<org.bukkit.inventory.ItemStack> drops) {
CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity();
EntityDeathEvent event = new EntityDeathEvent(entity, drops, victim.getExpReward());
@ -366,7 +375,7 @@ index ecd3b31216616b0ffe239785e3942cfb4bfebcf8..e408f30da80a4f1450d6ac659e25e511
victim.expToDrop = event.getDroppedExp();
for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
@@ -802,8 +809,15 @@ public class CraftEventFactory {
@@ -802,8 +811,15 @@ public class CraftEventFactory {
CraftPlayer entity = victim.getBukkitEntity();
PlayerDeathEvent event = new PlayerDeathEvent(entity, drops, victim.getExpReward(), 0, deathMessage, stringDeathMessage); // Paper - Adventure
event.setKeepInventory(keepInventory);
@ -382,7 +391,7 @@ index ecd3b31216616b0ffe239785e3942cfb4bfebcf8..e408f30da80a4f1450d6ac659e25e511
victim.keepLevel = event.getKeepLevel();
victim.newLevel = event.getNewLevel();
@@ -820,6 +834,31 @@ public class CraftEventFactory {
@@ -820,6 +836,31 @@ public class CraftEventFactory {
return event;
}
@ -391,7 +400,7 @@ index ecd3b31216616b0ffe239785e3942cfb4bfebcf8..e408f30da80a4f1450d6ac659e25e511
+ private static void populateFields(EntityLiving victim, EntityDeathEvent event) {
+ event.setReviveHealth(event.getEntity().getAttribute(org.bukkit.attribute.Attribute.GENERIC_MAX_HEALTH).getValue());
+ event.setShouldPlayDeathSound(!victim.silentDeath && !victim.isSilent());
+ net.minecraft.server.SoundEffect soundEffect = victim.getDeathSoundEffect();
+ SoundEffect soundEffect = victim.getDeathSoundEffect();
+ event.setDeathSound(soundEffect != null ? org.bukkit.craftbukkit.CraftSound.getBukkit(soundEffect) : null);
+ event.setDeathSoundCategory(org.bukkit.SoundCategory.valueOf(victim.getSoundCategory().name()));
+ event.setDeathSoundVolume(victim.getDeathSoundVolume());
@ -405,8 +414,8 @@ index ecd3b31216616b0ffe239785e3942cfb4bfebcf8..e408f30da80a4f1450d6ac659e25e511
+ double x = event.getEntity().getLocation().getX();
+ double y = event.getEntity().getLocation().getY();
+ double z = event.getEntity().getLocation().getZ();
+ net.minecraft.server.SoundEffect soundEffect = org.bukkit.craftbukkit.CraftSound.getSoundEffect(event.getDeathSound());
+ net.minecraft.server.SoundCategory soundCategory = net.minecraft.server.SoundCategory.valueOf(event.getDeathSoundCategory().name());
+ SoundEffect soundEffect = org.bukkit.craftbukkit.CraftSound.getSoundEffect(event.getDeathSound());
+ SoundCategory soundCategory = SoundCategory.valueOf(event.getDeathSoundCategory().name());
+ victim.world.playSound(source, x, y, z, soundEffect, soundCategory, event.getDeathSoundVolume(), event.getDeathSoundPitch());
+ }
+ }

View File

@ -7,15 +7,15 @@ Implements Pathfinding API for mobs
diff --git a/src/main/java/com/destroystokyo/paper/entity/PaperPathfinder.java b/src/main/java/com/destroystokyo/paper/entity/PaperPathfinder.java
new file mode 100644
index 0000000000000000000000000000000000000000..af1bac9680028130e99c5e7130f258c196b33275
index 0000000000000000000000000000000000000000..9a3edd114c4736b1843844c6ca49da7aea7983d1
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/PaperPathfinder.java
@@ -0,0 +1,141 @@
+package com.destroystokyo.paper.entity;
+
+import net.minecraft.server.EntityInsentient;
+import net.minecraft.server.PathEntity;
+import net.minecraft.server.PathPoint;
+import net.minecraft.world.entity.EntityInsentient;
+import net.minecraft.world.level.pathfinder.PathEntity;
+import net.minecraft.world.level.pathfinder.PathPoint;
+import org.apache.commons.lang.Validate;
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;

View File

@ -13,10 +13,19 @@ Shulkers) may need to be changed in order for it to re-save properly
No more crashing though.
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
index cd7dc7d90efddb8a1bb50cd964b43d18cf9c83d1..67806eaab081e938cd99a0d74225b1b7744ff2d7 100644
index cd7dc7d90efddb8a1bb50cd964b43d18cf9c83d1..35d1444c5b75d9a3a6cface5dd70aea0a08ac89d 100644
--- a/src/main/java/net/minecraft/server/MCUtil.java
+++ b/src/main/java/net/minecraft/server/MCUtil.java
@@ -514,4 +514,19 @@ public final class MCUtil {
@@ -7,6 +7,8 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet;
import net.minecraft.core.BlockPosition;
import net.minecraft.core.EnumDirection;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.chat.IChatBaseComponent;
import net.minecraft.server.level.WorldServer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.ChunkCoordIntPair;
@@ -514,4 +516,19 @@ public final class MCUtil {
return null;
}
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add sun related API
diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
index 486f4727dbcb7955103f854baed9b571fb3b9f3e..a0857de5a14db5580bc047c401a006c9466c49b2 100644
index 41566398f5eee6cf93376f2e2200728bb6d2181c..db72b685f4a4b95f345f1d34f9eeb83b8731120a 100644
--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java
+++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
@@ -1594,6 +1594,7 @@ public abstract class EntityInsentient extends EntityLiving {
@@ -1597,6 +1597,7 @@ public abstract class EntityInsentient extends EntityLiving {
}

View File

@ -55,7 +55,7 @@ index 7178b37f7978c7e9031a22726005c5099fd78fe0..3139c194f9b1bc3510d51a81f13ae43d
}
diff --git a/src/main/java/com/destroystokyo/paper/proxy/VelocityProxy.java b/src/main/java/com/destroystokyo/paper/proxy/VelocityProxy.java
new file mode 100644
index 0000000000000000000000000000000000000000..fdd8708f974700c7cde6e436c2f189d94d336f1f
index 0000000000000000000000000000000000000000..e6afaa41df086b1eb3950ce870c91dd5bf5a663b
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/proxy/VelocityProxy.java
@@ -0,0 +1,67 @@
@ -65,8 +65,8 @@ index 0000000000000000000000000000000000000000..fdd8708f974700c7cde6e436c2f189d9
+import com.google.common.net.InetAddresses;
+import com.mojang.authlib.GameProfile;
+import com.mojang.authlib.properties.Property;
+import net.minecraft.server.MinecraftKey;
+import net.minecraft.network.protocol.game.PacketDataSerializer;
+import net.minecraft.network.PacketDataSerializer;
+import net.minecraft.resources.MinecraftKey;
+
+import java.net.InetAddress;
+import java.security.InvalidKeyException;
@ -189,10 +189,25 @@ index eb970c1e954cb0aa83aa12e83c471778809e69b2..2d8c917509f10a96fc82404908b452cb
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = packetdataserializer.i();
diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java
index 2ce081e68fe27381d3e7f851b685cc547de35eb7..240fac47dedb726d86f5dd68cad35b91b8117be4 100644
index 2ce081e68fe27381d3e7f851b685cc547de35eb7..a3c989ef850919fa90590b942f037c1f6d519608 100644
--- a/src/main/java/net/minecraft/server/network/LoginListener.java
+++ b/src/main/java/net/minecraft/server/network/LoginListener.java
@@ -45,6 +45,7 @@ import org.bukkit.craftbukkit.util.Waitable;
@@ -18,12 +18,14 @@ import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import net.minecraft.DefaultUncaughtExceptionHandler;
import net.minecraft.network.NetworkManager;
+import net.minecraft.network.PacketDataSerializer;
import net.minecraft.network.chat.ChatMessage;
import net.minecraft.network.chat.IChatBaseComponent;
import net.minecraft.network.protocol.login.PacketLoginInCustomPayload;
import net.minecraft.network.protocol.login.PacketLoginInEncryptionBegin;
import net.minecraft.network.protocol.login.PacketLoginInListener;
import net.minecraft.network.protocol.login.PacketLoginInStart;
+import net.minecraft.network.protocol.login.PacketLoginOutCustomPayload;
import net.minecraft.network.protocol.login.PacketLoginOutDisconnect;
import net.minecraft.network.protocol.login.PacketLoginOutEncryptionBegin;
import net.minecraft.network.protocol.login.PacketLoginOutSetCompression;
@@ -45,6 +47,7 @@ import org.bukkit.craftbukkit.util.Waitable;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import org.bukkit.event.player.PlayerPreLoginEvent;
// CraftBukkit end
@ -200,7 +215,7 @@ index 2ce081e68fe27381d3e7f851b685cc547de35eb7..240fac47dedb726d86f5dd68cad35b91
public class LoginListener implements PacketLoginInListener {
@@ -61,6 +62,7 @@ public class LoginListener implements PacketLoginInListener {
@@ -61,6 +64,7 @@ public class LoginListener implements PacketLoginInListener {
private SecretKey loginKey;
private EntityPlayer l;
public String hostname = ""; // CraftBukkit - add field
@ -208,7 +223,7 @@ index 2ce081e68fe27381d3e7f851b685cc547de35eb7..240fac47dedb726d86f5dd68cad35b91
public LoginListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
this.g = LoginListener.EnumProtocolState.HELLO;
@@ -212,6 +214,14 @@ public class LoginListener implements PacketLoginInListener {
@@ -212,6 +216,14 @@ public class LoginListener implements PacketLoginInListener {
this.g = LoginListener.EnumProtocolState.KEY;
this.networkManager.sendPacket(new PacketLoginOutEncryptionBegin("", this.server.getKeyPair().getPublic().getEncoded(), this.e));
} else {
@ -223,7 +238,7 @@ index 2ce081e68fe27381d3e7f851b685cc547de35eb7..240fac47dedb726d86f5dd68cad35b91
// Spigot start
// Paper start - Cache authenticator threads
authenticatorPool.execute(new Runnable() {
@@ -313,6 +323,12 @@ public class LoginListener implements PacketLoginInListener {
@@ -313,6 +325,12 @@ public class LoginListener implements PacketLoginInListener {
public class LoginHandler {
public void fireEvents() throws Exception {
@ -236,7 +251,7 @@ index 2ce081e68fe27381d3e7f851b685cc547de35eb7..240fac47dedb726d86f5dd68cad35b91
String playerName = i.getName();
java.net.InetAddress address = ((java.net.InetSocketAddress) networkManager.getSocketAddress()).getAddress();
java.util.UUID uniqueId = i.getId();
@@ -360,6 +376,35 @@ public class LoginListener implements PacketLoginInListener {
@@ -360,6 +378,35 @@ public class LoginListener implements PacketLoginInListener {
// Spigot end
public void a(PacketLoginInCustomPayload packetloginincustompayload) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Reset players airTicks on respawn
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
index b63a8ac9bae50494fd8e093ff163df961d779c2d..f05f24f2a5c4ba8dbb8572d113afc404259e73ed 100644
index d750c814ca3b7dc7df7f87de3e360235849c000b..ae5fe4f71ea1cc231e5d87920c2243f4f4f581f1 100644
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
@@ -2152,6 +2152,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -17,10 +17,10 @@ index b63a8ac9bae50494fd8e093ff163df961d779c2d..f05f24f2a5c4ba8dbb8572d113afc404
this.fallDistance = 0;
this.foodData = new FoodMetaData(this);
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 4d7bb023092ee118d68ecce1918e220f541b33c1..1f5ab7d43315fa3a67297eabea3bda257ed24a44 100644
index 2fc25a13a554174d2b5f415c910c4a26e37b30e1..f102ecb56ac04a5b840fa52e6d1ff9604598d58d 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2349,6 +2349,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
@@ -2350,6 +2350,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
}

View File

@ -12,10 +12,18 @@ server threads
Allow usage of a single thread executor by not using ForkJoin so single core CPU's.
diff --git a/src/main/java/net/minecraft/SystemUtils.java b/src/main/java/net/minecraft/SystemUtils.java
index 68ce7605bd63ea280b96db8230463d2afb0a6cb1..c7cbf132bfcb5c5e49b269ebfe5ef9a049ff327f 100644
index 68ce7605bd63ea280b96db8230463d2afb0a6cb1..46d82c1548088b8305f758699388edf0d5d4d050 100644
--- a/src/main/java/net/minecraft/SystemUtils.java
+++ b/src/main/java/net/minecraft/SystemUtils.java
@@ -54,8 +54,8 @@ import org.apache.logging.log4j.Logger;
@@ -45,6 +45,7 @@ import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.server.DispenserRegistry;
+import net.minecraft.server.ServerWorkerThread;
import net.minecraft.util.MathHelper;
import net.minecraft.util.datafix.DataConverterRegistry;
import net.minecraft.world.level.block.state.properties.IBlockState;
@@ -54,8 +55,8 @@ import org.apache.logging.log4j.Logger;
public class SystemUtils {
private static final AtomicInteger c = new AtomicInteger(1);
@ -26,7 +34,7 @@ index 68ce7605bd63ea280b96db8230463d2afb0a6cb1..c7cbf132bfcb5c5e49b269ebfe5ef9a0
private static final ExecutorService f = n();
public static LongSupplier a = System::nanoTime;
public static final UUID b = new UUID(0L, 0L); public static final UUID getNullUUID() {return b;} // Paper OBFHELPER
@@ -85,15 +85,18 @@ public class SystemUtils {
@@ -85,15 +86,18 @@ public class SystemUtils {
return Instant.now().toEpochMilli();
}
@ -50,7 +58,7 @@ index 68ce7605bd63ea280b96db8230463d2afb0a6cb1..c7cbf132bfcb5c5e49b269ebfe5ef9a0
protected void onTermination(Throwable throwable) {
if (throwable != null) {
SystemUtils.LOGGER.warn("{} died", this.getName(), throwable);
@@ -109,6 +112,7 @@ public class SystemUtils {
@@ -109,6 +113,7 @@ public class SystemUtils {
return forkjoinworkerthread;
}, SystemUtils::a, true);
}
@ -58,7 +66,7 @@ index 68ce7605bd63ea280b96db8230463d2afb0a6cb1..c7cbf132bfcb5c5e49b269ebfe5ef9a0
return (ExecutorService) object;
}
@@ -157,6 +161,7 @@ public class SystemUtils {
@@ -157,6 +162,7 @@ public class SystemUtils {
});
}

View File

@ -7,10 +7,10 @@ ray tracing into an unloaded chunk should be treated as a miss
this saves a ton of lag for when AI tries to raytrace near unloaded chunks.
diff --git a/src/main/java/net/minecraft/world/level/IBlockAccess.java b/src/main/java/net/minecraft/world/level/IBlockAccess.java
index f0b74dce1e0a3ca150251008247a14b380cde03d..b9b2764090134cba5fc3b9edca4e71f1ce772448 100644
index e799765ecfada1eec78beb71651e52ad355a30aa..21ce19b9caf3150535a3f84027242a93bdd0d263 100644
--- a/src/main/java/net/minecraft/world/level/IBlockAccess.java
+++ b/src/main/java/net/minecraft/world/level/IBlockAccess.java
@@ -56,7 +56,15 @@ public interface IBlockAccess {
@@ -58,7 +58,15 @@ public interface IBlockAccess {
// CraftBukkit start - moved block handling into separate method for use by Block#rayTrace
default MovingObjectPositionBlock rayTraceBlock(RayTrace raytrace1, BlockPosition blockposition) {

View File

@ -88,10 +88,10 @@ index cd4493a023748264748d4e892815f14d8a7bd7f6..0783b0777c8d7788bbf6780b464b709b
return false;
}
diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java
index 7b47d4f1cbf9f8646e0b1af9277cf341ea28a2b3..1119ee4f69a153852219b4e985e97a6b3175a8be 100644
index 152118729b1a95dcae05d32aa4289034ba394226..0059ede4ba3ff271d47dd38ea87fddc2399aa008 100644
--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java
+++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java
@@ -90,7 +90,7 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
@@ -91,7 +91,7 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
int i = packetdataserializer.i();
@ -101,10 +101,18 @@ index 7b47d4f1cbf9f8646e0b1af9277cf341ea28a2b3..1119ee4f69a153852219b4e985e97a6b
} else {
this.f = new byte[i];
diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutWindowItems.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutWindowItems.java
index b90e35a0099a2482f8fc2998bd079fc2fe6439e6..c8c03532982c4d69ea1b070692bbc459f2b83b89 100644
index b90e35a0099a2482f8fc2998bd079fc2fe6439e6..e540f95a370c627d3d81e0d3670049d01923559d 100644
--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutWindowItems.java
+++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutWindowItems.java
@@ -13,6 +13,15 @@ public class PacketPlayOutWindowItems implements Packet<PacketListenerPlayOut> {
@@ -4,6 +4,7 @@ import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import net.minecraft.core.NonNullList;
+import net.minecraft.network.NetworkManager;
import net.minecraft.network.PacketDataSerializer;
import net.minecraft.network.protocol.Packet;
import net.minecraft.world.item.ItemStack;
@@ -13,6 +14,15 @@ public class PacketPlayOutWindowItems implements Packet<PacketListenerPlayOut> {
private int a;
private List<ItemStack> b;

View File

@ -20,7 +20,7 @@ this is going to be the best soultion all around.
Improvements/suggestions welcome!
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
index f05f24f2a5c4ba8dbb8572d113afc404259e73ed..cf63703f5f38b1531912d413b0ac16c23627ca34 100644
index ae5fe4f71ea1cc231e5d87920c2243f4f4f581f1..bea8dd578cfd5532dd1b679a4ee4e6c74a416bba 100644
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
@@ -1252,11 +1252,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -41,10 +41,10 @@ index f05f24f2a5c4ba8dbb8572d113afc404259e73ed..cf63703f5f38b1531912d413b0ac16c2
if (entity1 != entity && this.playerConnection != null) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 1f5ab7d43315fa3a67297eabea3bda257ed24a44..dca0bab93b5a1460c4741b0517b41490eb62703e 100644
index f102ecb56ac04a5b840fa52e6d1ff9604598d58d..f0c18a55900774ba67eaf094f175a9e37c16e56c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2039,12 +2039,15 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
@@ -2040,12 +2040,15 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
}
@ -62,7 +62,7 @@ index 1f5ab7d43315fa3a67297eabea3bda257ed24a44..dca0bab93b5a1460c4741b0517b41490
}
}
@@ -2099,7 +2102,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
@@ -2100,7 +2103,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
return true; // CraftBukkit
}
@ -74,7 +74,7 @@ index 1f5ab7d43315fa3a67297eabea3bda257ed24a44..dca0bab93b5a1460c4741b0517b41490
if (entity.getVehicle() == this) {
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
} else {
@@ -2109,7 +2115,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
@@ -2110,7 +2116,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
VehicleExitEvent event = new VehicleExitEvent(
(Vehicle) getBukkitEntity(),
@ -83,7 +83,7 @@ index 1f5ab7d43315fa3a67297eabea3bda257ed24a44..dca0bab93b5a1460c4741b0517b41490
);
// Suppress during worldgen
if (this.valid) {
@@ -2123,7 +2129,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
@@ -2124,7 +2130,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
}
// CraftBukkit end
// Spigot start
@ -114,10 +114,10 @@ index c189a7051240bb357acf5075c98206a258409b0c..58270f45de665b5c1cfd9fc548eadb26
this.a(entity);
}
diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
index bed54f9732bbfe9edab81744276643da482785d3..6dc1d03e755cd4c268de71ebba7e771a640938c2 100644
index 87374174dcbf9e7ee448a1cdd9a3528557c3a2ea..564dfa98c166fde509044e6e1938efb321ece53d 100644
--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
+++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
@@ -1036,9 +1036,11 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1039,9 +1039,11 @@ public abstract class EntityHuman extends EntityLiving {
return -0.35D;
}

View File

@ -34,7 +34,7 @@ how PlayerPreLoginEvent interacts with PlayerConnectionCloseEvent
is undefined.
diff --git a/src/main/java/net/minecraft/network/NetworkManager.java b/src/main/java/net/minecraft/network/NetworkManager.java
index dc788d75a6a34fbbae990609bfbbd13ca6cdee5a..2eefa21531c991ae76bf026087eb07280fbc939e 100644
index dc788d75a6a34fbbae990609bfbbd13ca6cdee5a..6d40ade5a52383ed86d28d272c3dc83dbdcbd218 100644
--- a/src/main/java/net/minecraft/network/NetworkManager.java
+++ b/src/main/java/net/minecraft/network/NetworkManager.java
@@ -350,6 +350,26 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@ -46,7 +46,7 @@ index dc788d75a6a34fbbae990609bfbbd13ca6cdee5a..2eefa21531c991ae76bf026087eb0728
+ if (packetListener instanceof PlayerConnection) {
+ /* Player was logged in */
+ final PlayerConnection playerConnection = (PlayerConnection) packetListener;
+ new com.destroystokyo.paper.event.player.PlayerConnectionCloseEvent(playerConnection.player.uniqueID,
+ new com.destroystokyo.paper.event.player.PlayerConnectionCloseEvent(playerConnection.player.getUniqueID(),
+ playerConnection.player.getName(), ((java.net.InetSocketAddress)socketAddress).getAddress(), false).callEvent();
+ } else if (packetListener instanceof LoginListener) {
+ /* Player is login stage */
@ -65,10 +65,10 @@ index dc788d75a6a34fbbae990609bfbbd13ca6cdee5a..2eefa21531c991ae76bf026087eb0728
}
diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java
index 240fac47dedb726d86f5dd68cad35b91b8117be4..98ae77269b5aaad951b0e26da61e6f5eb7ec2818 100644
index a3c989ef850919fa90590b942f037c1f6d519608..4dd2f7fb32b8618d752e0988acadcb41223c0e4c 100644
--- a/src/main/java/net/minecraft/server/network/LoginListener.java
+++ b/src/main/java/net/minecraft/server/network/LoginListener.java
@@ -55,9 +55,9 @@ public class LoginListener implements PacketLoginInListener {
@@ -57,9 +57,9 @@ public class LoginListener implements PacketLoginInListener {
private final byte[] e = new byte[4];
private final MinecraftServer server;
public final NetworkManager networkManager;

View File

@ -16,7 +16,7 @@ intent to remove) and replace it with two new methods, clearly named and
documented as to their purpose.
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
index cf63703f5f38b1531912d413b0ac16c23627ca34..66749184ec24d15af3aaa71e79475d2a3f51c843 100644
index bea8dd578cfd5532dd1b679a4ee4e6c74a416bba..e3cc64e837fa9b9c1f1d95037b1a59f1d1f4e6ef 100644
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
@@ -213,6 +213,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -28,10 +28,10 @@ index cf63703f5f38b1531912d413b0ac16c23627ca34..66749184ec24d15af3aaa71e79475d2a
public boolean queueHealthUpdatePacket = false;
public net.minecraft.network.protocol.game.PacketPlayOutUpdateHealth queuedHealthUpdatePacket;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 1dfa84dfb7b62c50081ad32b012d108a0b77b83c..e4be75fd348357de05cf3710e5643d74cd1d8123 100644
index 3aaa6313a33865b9823aa38e5d0cce7edce04592..3ef632928bf93a8af5eccada3b1cc76354ed5617 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -167,6 +167,7 @@ public abstract class PlayerList {
@@ -168,6 +168,7 @@ public abstract class PlayerList {
}
public void a(NetworkManager networkmanager, EntityPlayer entityplayer) {
@ -106,7 +106,7 @@ index 9b8d7b176e288fa715177196e7aff92900d8567a..1e741158bbcc0991259436bec549b32d
public Location getBedSpawnLocation() {
NBTTagCompound data = getData();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 5c3b83244e77c54d3de5cf56171a88c2952fcd13..515bd5a7512774d52d1e89afb7306a1f834b537a 100644
index 91da1f4d933b991c73e04e077722382d02487e07..cd3987ec7569f4a2de1f66fc73b1ca6c19fa82aa 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -142,6 +142,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@ -11,10 +11,18 @@ floating in the air.
This can replace many uses of BlockPhysicsEvent
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
index b0044d97afca1f658c193278eed542a743f20668..a8899f2ff7c71e62cdbd8eefdca0c3a9905cdc98 100644
index 88b1a0235bfc0b41ae1855f8900632e425730d1c..3b5ddc083719608e944bdefa38e1fd3909e8e200 100644
--- a/src/main/java/net/minecraft/world/level/World.java
+++ b/src/main/java/net/minecraft/world/level/World.java
@@ -552,8 +552,20 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -26,6 +26,7 @@ import net.minecraft.core.particles.ParticleParam;
import net.minecraft.network.protocol.Packet;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.resources.ResourceKey;
+import net.minecraft.server.MCUtil;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.level.PlayerChunk;
@@ -559,8 +560,20 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
return false;
} else {
Fluid fluid = this.getFluid(blockposition);

View File

@ -28,10 +28,26 @@ and then catch exceptions and close if they fire.
Part of this commit was authored by: Spottedleaf
diff --git a/src/main/java/net/minecraft/network/NetworkManager.java b/src/main/java/net/minecraft/network/NetworkManager.java
index 2eefa21531c991ae76bf026087eb07280fbc939e..54a90c51f3090d0d2d6ea72b152829bc11d3ffbc 100644
index 6d40ade5a52383ed86d28d272c3dc83dbdcbd218..8e591f75b2c80fdb7e012574e9d7c348f1ffc90d 100644
--- a/src/main/java/net/minecraft/network/NetworkManager.java
+++ b/src/main/java/net/minecraft/network/NetworkManager.java
@@ -75,6 +75,10 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@@ -25,8 +25,15 @@ import net.minecraft.network.chat.ChatMessage;
import net.minecraft.network.chat.IChatBaseComponent;
import net.minecraft.network.protocol.EnumProtocolDirection;
import net.minecraft.network.protocol.Packet;
+import net.minecraft.network.protocol.game.PacketPlayOutBoss;
+import net.minecraft.network.protocol.game.PacketPlayOutChat;
+import net.minecraft.network.protocol.game.PacketPlayOutKeepAlive;
import net.minecraft.network.protocol.game.PacketPlayOutKickDisconnect;
+import net.minecraft.network.protocol.game.PacketPlayOutTabComplete;
+import net.minecraft.network.protocol.game.PacketPlayOutTitle;
import net.minecraft.server.CancelledPacketHandleException;
+import net.minecraft.server.MCUtil;
+import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.network.LoginListener;
import net.minecraft.server.network.PlayerConnection;
import net.minecraft.util.LazyInitVar;
@@ -75,6 +82,10 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
public int protocolVersion;
public java.net.InetSocketAddress virtualHost;
private static boolean enableExplicitFlush = Boolean.getBoolean("paper.explicit-flush");
@ -42,7 +58,7 @@ index 2eefa21531c991ae76bf026087eb07280fbc939e..54a90c51f3090d0d2d6ea72b152829bc
// Paper end
public NetworkManager(EnumProtocolDirection enumprotocoldirection) {
@@ -98,6 +102,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@@ -98,6 +109,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
public void setProtocol(EnumProtocol enumprotocol) {
@ -50,7 +66,7 @@ index 2eefa21531c991ae76bf026087eb07280fbc939e..54a90c51f3090d0d2d6ea72b152829bc
this.channel.attr(NetworkManager.c).set(enumprotocol);
this.channel.config().setAutoRead(true);
NetworkManager.LOGGER.debug("Enabled auto read");
@@ -168,19 +173,84 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@@ -168,19 +180,84 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
Validate.notNull(packetlistener, "packetListener", new Object[0]);
this.packetListener = packetlistener;
}
@ -140,7 +156,7 @@ index 2eefa21531c991ae76bf026087eb07280fbc939e..54a90c51f3090d0d2d6ea72b152829bc
}
private void dispatchPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericFutureListener) { this.b(packet, genericFutureListener); } // Paper - OBFHELPER
@@ -194,51 +264,116 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@@ -194,51 +271,116 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
this.channel.config().setAutoRead(false);
}
@ -267,7 +283,7 @@ index 2eefa21531c991ae76bf026087eb07280fbc939e..54a90c51f3090d0d2d6ea72b152829bc
public void a() {
this.p();
@@ -271,9 +406,21 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@@ -271,9 +413,21 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
return this.socketAddress;
}
@ -289,7 +305,7 @@ index 2eefa21531c991ae76bf026087eb07280fbc939e..54a90c51f3090d0d2d6ea72b152829bc
// Spigot End
if (this.channel.isOpen()) {
this.channel.close(); // We can't wait as this may be called from an event loop.
@@ -341,7 +488,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@@ -341,7 +495,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
public void handleDisconnection() {
if (this.channel != null && !this.channel.isOpen()) {
if (this.o) {
@ -298,7 +314,7 @@ index 2eefa21531c991ae76bf026087eb07280fbc939e..54a90c51f3090d0d2d6ea72b152829bc
} else {
this.o = true;
if (this.k() != null) {
@@ -349,7 +496,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@@ -349,7 +503,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
} else if (this.j() != null) {
this.j().a(new ChatMessage("multiplayer.disconnect.generic"));
}

View File

@ -9,10 +9,10 @@ creating too large of a packet to sed.
Co authored by Spottedleaf
diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java
index 1119ee4f69a153852219b4e985e97a6b3175a8be..31a6f687a8a75b055a32a686c870d3898aae54c3 100644
index 0059ede4ba3ff271d47dd38ea87fddc2399aa008..a7d10d124021f3427f23fcd533f885367b64515c 100644
--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java
+++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java
@@ -33,7 +33,15 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
@@ -34,7 +34,15 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
private boolean h;
public PacketPlayOutMapChunk() {}
@ -28,7 +28,7 @@ index 1119ee4f69a153852219b4e985e97a6b3175a8be..31a6f687a8a75b055a32a686c870d389
public PacketPlayOutMapChunk(Chunk chunk, int i) {
ChunkCoordIntPair chunkcoordintpair = chunk.getPos();
@@ -60,6 +68,7 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
@@ -61,6 +69,7 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
this.c = this.a(new PacketDataSerializer(this.j()), chunk, i);
this.g = Lists.newArrayList();
iterator = chunk.getTileEntities().entrySet().iterator();
@ -36,7 +36,7 @@ index 1119ee4f69a153852219b4e985e97a6b3175a8be..31a6f687a8a75b055a32a686c870d389
while (iterator.hasNext()) {
entry = (Entry) iterator.next();
@@ -68,6 +77,15 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
@@ -69,6 +78,15 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
int j = blockposition.getY() >> 4;
if (this.f() || (i & 1 << j) != 0) {

View File

@ -11,10 +11,18 @@ everything to the Whitelist object.
https://github.com/PaperMC/Paper/issues/1880
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index e4be75fd348357de05cf3710e5643d74cd1d8123..1bbb846e2671fce67c79357f82a7fc42cc619c8a 100644
index 3ef632928bf93a8af5eccada3b1cc76354ed5617..317c921eaf734e890706f962b29233e3306a13be 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1015,9 +1015,9 @@ public abstract class PlayerList {
@@ -55,6 +55,7 @@ import net.minecraft.network.protocol.game.PacketPlayOutViewDistance;
import net.minecraft.network.protocol.game.PacketPlayOutWorldBorder;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.AdvancementDataPlayer;
+import net.minecraft.server.MCUtil;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.ScoreboardServer;
import net.minecraft.server.level.DemoPlayerInteractManager;
@@ -1016,9 +1017,9 @@ public abstract class PlayerList {
}
public boolean isWhitelisted(GameProfile gameprofile, org.bukkit.event.player.PlayerLoginEvent loginEvent) {
boolean isOp = this.operators.d(gameprofile);

View File

@ -51,10 +51,10 @@ index f792ac1639e16522695082caed754b1c2cb333b9..9da608c9dde183ad813fa5b7643314ce
a((NBTBase) nbttagcompound, dataoutput);
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
index 6efbb8a3502f86e105d4dfb9cef114a790966e95..7491c09b3d8fdd27fa83d850ff097e44e1bb0eee 100644
index 6efbb8a3502f86e105d4dfb9cef114a790966e95..a9cbe17f6ccf0ce4ace97ba4b951b3fd7415d71b 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -19,6 +19,8 @@ import java.nio.file.LinkOption;
@@ -19,8 +19,12 @@ import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
@ -62,8 +62,12 @@ index 6efbb8a3502f86e105d4dfb9cef114a790966e95..7491c09b3d8fdd27fa83d850ff097e44
+
import javax.annotation.Nullable;
import net.minecraft.SystemUtils;
+import net.minecraft.nbt.NBTCompressedStreamTools;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.level.ChunkCoordIntPair;
@@ -37,6 +39,7 @@ public class RegionFile implements AutoCloseable {
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -37,6 +41,7 @@ public class RegionFile implements AutoCloseable {
private final IntBuffer i;
@VisibleForTesting
protected final RegionFileBitSet freeSectors;
@ -71,16 +75,16 @@ index 6efbb8a3502f86e105d4dfb9cef114a790966e95..7491c09b3d8fdd27fa83d850ff097e44
public RegionFile(File file, File file1, boolean flag) throws IOException {
this(file.toPath(), file1.toPath(), RegionFileCompression.b, flag);
@@ -44,6 +47,8 @@ public class RegionFile implements AutoCloseable {
@@ -44,6 +49,8 @@ public class RegionFile implements AutoCloseable {
public RegionFile(Path path, Path path1, RegionFileCompression regionfilecompression, boolean flag) throws IOException {
this.g = ByteBuffer.allocateDirect(8192);
+ this.file = java_nio_file_path.toFile(); // Paper
+ this.file = path.toFile(); // Paper
+ initOversizedState(); // Paper
this.freeSectors = new RegionFileBitSet();
this.f = regionfilecompression;
if (!Files.isDirectory(path1, new LinkOption[0])) {
@@ -407,6 +412,74 @@ public class RegionFile implements AutoCloseable {
@@ -407,6 +414,74 @@ public class RegionFile implements AutoCloseable {
void run() throws IOException;
}
@ -156,10 +160,21 @@ index 6efbb8a3502f86e105d4dfb9cef114a790966e95..7491c09b3d8fdd27fa83d850ff097e44
private final ChunkCoordIntPair b;
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java
index 13d0d6e7e03322f20ef5666d5299d26d51d1714c..571b34cd30bb76dcfac928e29a1cafd5824d4772 100644
index 75b10a3755392870d8f5b51239a09a0e7fd75a42..ab9f4d40fd1126a3d7ba5b16fdc6ab09de4a7fdb 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java
@@ -49,6 +49,74 @@ public final class RegionFileCache implements AutoCloseable {
@@ -9,8 +9,10 @@ import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import javax.annotation.Nullable;
+import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTCompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ExceptionSuppressor;
import net.minecraft.world.level.ChunkCoordIntPair;
@@ -50,6 +52,74 @@ public final class RegionFileCache implements AutoCloseable {
}
}
@ -234,7 +249,7 @@ index 13d0d6e7e03322f20ef5666d5299d26d51d1714c..571b34cd30bb76dcfac928e29a1cafd5
@Nullable
public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException {
// CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
@@ -58,6 +126,12 @@ public final class RegionFileCache implements AutoCloseable {
@@ -59,6 +129,12 @@ public final class RegionFileCache implements AutoCloseable {
}
// CraftBukkit end
DataInputStream datainputstream = regionfile.a(chunkcoordintpair);
@ -247,7 +262,7 @@ index 13d0d6e7e03322f20ef5666d5299d26d51d1714c..571b34cd30bb76dcfac928e29a1cafd5
Throwable throwable = null;
NBTTagCompound nbttagcompound;
@@ -98,6 +172,7 @@ public final class RegionFileCache implements AutoCloseable {
@@ -99,6 +175,7 @@ public final class RegionFileCache implements AutoCloseable {
try {
NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) dataoutputstream);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 1bbb846e2671fce67c79357f82a7fc42cc619c8a..587fb2246b1ede6d292afe42b826e32423ca3a56 100644
index 317c921eaf734e890706f962b29233e3306a13be..aebde5e6ec24aff073dfd4eae1ce5a008134658a 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1133,6 +1133,7 @@ public abstract class PlayerList {
@@ -1135,6 +1135,7 @@ public abstract class PlayerList {
}
public void setHasWhitelist(boolean flag) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add LivingEntity#getTargetEntity
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index dca0bab93b5a1460c4741b0517b41490eb62703e..6f4dd6226a23323c1af95380a8d38ee6d19caf60 100644
index f0c18a55900774ba67eaf094f175a9e37c16e56c..36e9a33d22fc2572e23e457adf62bd2bcebd10d3 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1503,6 +1503,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
@@ -1504,6 +1504,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
return this.c(f - 90.0F, f1);
}
@ -16,7 +16,7 @@ index dca0bab93b5a1460c4741b0517b41490eb62703e..6f4dd6226a23323c1af95380a8d38ee6
public final Vec3D j(float f) {
if (f == 1.0F) {
return new Vec3D(this.locX(), this.getHeadY(), this.locZ());
@@ -2148,6 +2149,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
@@ -2149,6 +2150,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
return this.getPassengers().size() < 1;
}
@ -25,10 +25,18 @@ index dca0bab93b5a1460c4741b0517b41490eb62703e..6f4dd6226a23323c1af95380a8d38ee6
return 0.0F;
}
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
index 58270f45de665b5c1cfd9fc548eadb263ad230e9..8a0d125bc1cf3a75141a286f0c9fb553827e556f 100644
index 58270f45de665b5c1cfd9fc548eadb263ad230e9..ecceb272028e1ae1dd40c0c39d6f687fccfabb58 100644
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
@@ -3637,6 +3637,37 @@ public abstract class EntityLiving extends Entity {
@@ -108,6 +108,7 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParameterSet
import net.minecraft.world.level.storage.loot.parameters.LootContextParameters;
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.MovingObjectPosition;
+import net.minecraft.world.phys.MovingObjectPositionEntity;
import net.minecraft.world.phys.Vec3D;
import net.minecraft.world.scores.ScoreboardTeam;
import org.apache.logging.log4j.Logger;
@@ -3637,6 +3638,37 @@ public abstract class EntityLiving extends Entity {
return world.rayTrace(raytrace);
}
@ -120,33 +128,53 @@ index 3941dd33da4b5c09d0087143f1d8a2d76fc18792..62513c812b497bb9d8dafe1d9c2f5740
double[] adouble = new double[]{1.0D};
double d0 = vec3d1.x - vec3d.x;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index a60a12a7705be29b6f318c587e1c6149b89d86c3..aa08ca83a105627b7e257ac664c29d899b557e9e 100644
index c692626b747008a5418ecabf550fc67e3b676f5b..ff586b8366a6298f1906551b068e8abb26fcabc7 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -221,6 +221,33 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
new com.destroystokyo.paper.block.TargetBlockInfo(org.bukkit.craftbukkit.block.CraftBlock.at(getHandle().world, ((net.minecraft.server.MovingObjectPositionBlock)rayTrace).getBlockPosition()),
net.minecraft.server.MCUtil.toBukkitBlockFace(((net.minecraft.server.MovingObjectPositionBlock)rayTrace).getDirection()));
@@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.entity;
import com.destroystokyo.paper.block.TargetBlockInfo;
+import com.destroystokyo.paper.entity.TargetEntityInfo;
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
import java.util.ArrayList;
@@ -42,8 +43,11 @@ import net.minecraft.world.entity.projectile.EntityThrownExpBottle;
import net.minecraft.world.entity.projectile.EntityThrownTrident;
import net.minecraft.world.entity.projectile.EntityTippedArrow;
import net.minecraft.world.entity.projectile.EntityWitherSkull;
+import net.minecraft.world.level.RayTrace;
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.MovingObjectPositionBlock;
+import net.minecraft.world.phys.MovingObjectPositionEntity;
+import net.minecraft.world.phys.Vec3D;
import org.apache.commons.lang.Validate;
import org.bukkit.FluidCollisionMode;
import org.bukkit.Location;
@@ -227,6 +231,33 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
new TargetBlockInfo(CraftBlock.at(getHandle().world, ((MovingObjectPositionBlock)rayTrace).getBlockPosition()),
MCUtil.toBukkitBlockFace(((MovingObjectPositionBlock)rayTrace).getDirection()));
}
+
+ public Entity getTargetEntity(int maxDistance, boolean ignoreBlocks) {
+ net.minecraft.server.MovingObjectPositionEntity rayTrace = rayTraceEntity(maxDistance, ignoreBlocks);
+ MovingObjectPositionEntity rayTrace = rayTraceEntity(maxDistance, ignoreBlocks);
+ return rayTrace == null ? null : rayTrace.getEntity().getBukkitEntity();
+ }
+
+ public com.destroystokyo.paper.entity.TargetEntityInfo getTargetEntityInfo(int maxDistance, boolean ignoreBlocks) {
+ net.minecraft.server.MovingObjectPositionEntity rayTrace = rayTraceEntity(maxDistance, ignoreBlocks);
+ return rayTrace == null ? null : new com.destroystokyo.paper.entity.TargetEntityInfo(rayTrace.getEntity().getBukkitEntity(), new org.bukkit.util.Vector(rayTrace.getPos().x, rayTrace.getPos().y, rayTrace.getPos().z));
+ public TargetEntityInfo getTargetEntityInfo(int maxDistance, boolean ignoreBlocks) {
+ MovingObjectPositionEntity rayTrace = rayTraceEntity(maxDistance, ignoreBlocks);
+ return rayTrace == null ? null : new TargetEntityInfo(rayTrace.getEntity().getBukkitEntity(), new org.bukkit.util.Vector(rayTrace.getPos().x, rayTrace.getPos().y, rayTrace.getPos().z));
+ }
+
+ public net.minecraft.server.MovingObjectPositionEntity rayTraceEntity(int maxDistance, boolean ignoreBlocks) {
+ net.minecraft.server.MovingObjectPositionEntity rayTrace = getHandle().getTargetEntity(maxDistance);
+ public MovingObjectPositionEntity rayTraceEntity(int maxDistance, boolean ignoreBlocks) {
+ MovingObjectPositionEntity rayTrace = getHandle().getTargetEntity(maxDistance);
+ if (rayTrace == null) {
+ return null;
+ }
+ if (!ignoreBlocks) {
+ net.minecraft.server.MovingObjectPosition rayTraceBlocks = getHandle().getRayTrace(maxDistance, net.minecraft.server.RayTrace.FluidCollisionOption.NONE);
+ MovingObjectPosition rayTraceBlocks = getHandle().getRayTrace(maxDistance, RayTrace.FluidCollisionOption.NONE);
+ if (rayTraceBlocks != null) {
+ net.minecraft.server.Vec3D eye = getHandle().getEyePosition(1.0F);
+ Vec3D eye = getHandle().getEyePosition(1.0F);
+ if (eye.distanceSquared(rayTraceBlocks.getPos()) <= eye.distanceSquared(rayTrace.getPos())) {
+ return null;
+ }

View File

@ -10,7 +10,7 @@ persistenting Living Entity, SPAWNER for spawners,
or DEFAULT since data was not stored.
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index 690e40aeed96a8d83e86c9aff0e910f6aa97c1c9..2a510940525fda83707e2a587e18ce34e5822af1 100644
index ab18969083e89eb2016c6a6bffc06f4e83c9f753..53359f5ca7a1098f78e683ebad142d5bcca51782 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -1039,6 +1039,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
@ -22,10 +22,10 @@ index 690e40aeed96a8d83e86c9aff0e910f6aa97c1c9..2a510940525fda83707e2a587e18ce34
if (entity.valid) {
MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable());
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 587fb2246b1ede6d292afe42b826e32423ca3a56..59155d9b39ed6b27dd46ea586ab07360840db5e7 100644
index aebde5e6ec24aff073dfd4eae1ce5a008134658a..ea6c5c9305994e64831c5444666c22a96f9d36da 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -333,7 +333,7 @@ public abstract class PlayerList {
@@ -335,7 +335,7 @@ public abstract class PlayerList {
// CraftBukkit start
WorldServer finalWorldServer = worldserver1;
Entity entity = EntityTypes.a(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> {
@ -35,10 +35,19 @@ index 587fb2246b1ede6d292afe42b826e32423ca3a56..59155d9b39ed6b27dd46ea586ab07360
});
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 6f4dd6226a23323c1af95380a8d38ee6d19caf60..f024db3fe2a9fb9af536fe144b9e871712ae327a 100644
index 36e9a33d22fc2572e23e457adf62bd2bcebd10d3..37b9915e6c25458e9ec2d0beb40be51991276b8d 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -157,6 +157,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
@@ -63,6 +63,8 @@ import net.minecraft.world.EnumHand;
import net.minecraft.world.EnumInteractionResult;
import net.minecraft.world.INamableTileEntity;
import net.minecraft.world.damagesource.DamageSource;
+import net.minecraft.world.entity.animal.EntityAnimal;
+import net.minecraft.world.entity.animal.EntityFish;
import net.minecraft.world.entity.item.EntityItem;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.entity.vehicle.EntityBoat;
@@ -158,6 +160,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
}
};
List<Entity> entitySlice = null;
@ -46,7 +55,7 @@ index 6f4dd6226a23323c1af95380a8d38ee6d19caf60..f024db3fe2a9fb9af536fe144b9e8717
// Paper end
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
@@ -1672,6 +1673,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
@@ -1673,6 +1676,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
if (this.origin != null) {
nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ()));
}
@ -56,7 +65,7 @@ index 6f4dd6226a23323c1af95380a8d38ee6d19caf60..f024db3fe2a9fb9af536fe144b9e8717
// Save entity's from mob spawner status
if (spawnedViaMobSpawner) {
nbttagcompound.setBoolean("Paper.FromMobSpawner", true);
@@ -1806,6 +1810,26 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
@@ -1807,6 +1813,26 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
}
spawnedViaMobSpawner = nbttagcompound.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status

View File

@ -22,7 +22,7 @@ index 44b79c97d5cc7570683e1b7f025b4f3ad65beb81..bcc1103e21cc10d5b405a2b89f3dfe78
this.f.accept(packet);
if (this.tracker instanceof EntityPlayer) {
diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java
index 8f442eae6519c3d0658e6ed77ecfa7aa8161a0f2..b207f4056a274d4115e96d88def3eea7fdf6c0d4 100644
index 8f442eae6519c3d0658e6ed77ecfa7aa8161a0f2..5d4ab95ca7498671888580f68382667c2282d604 100644
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
@@ -2285,7 +2285,14 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -31,7 +31,7 @@ index 8f442eae6519c3d0658e6ed77ecfa7aa8161a0f2..b207f4056a274d4115e96d88def3eea7
// Refresh the current entity metadata
- this.sendPacket(new PacketPlayOutEntityMetadata(entity.getId(), entity.getDataWatcher(), true));
+ // Paper start - update entity for all players
+ PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(entity.getId(), entity.datawatcher, true);
+ PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(entity.getId(), entity.getDataWatcher(), true);
+ if (entity.tracker != null) {
+ entity.tracker.broadcast(packet);
+ } else {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Implement PlayerPostRespawnEvent
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 59155d9b39ed6b27dd46ea586ab07360840db5e7..85bb7fc6d4b65ffb2923d5a6776ebe7a89605024 100644
index ea6c5c9305994e64831c5444666c22a96f9d36da..ae0aaaf129c44901ac72c67e50c663333ab57f9d 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -739,9 +739,14 @@ public abstract class PlayerList {
@@ -741,9 +741,14 @@ public abstract class PlayerList {
// this.a(entityplayer1, entityplayer, worldserver1); // CraftBukkit - removed
boolean flag2 = false;
@ -24,7 +24,7 @@ index 59155d9b39ed6b27dd46ea586ab07360840db5e7..85bb7fc6d4b65ffb2923d5a6776ebe7a
WorldServer worldserver1 = this.server.getWorldServer(entityplayer.getSpawnDimension());
if (worldserver1 != null) {
Optional optional;
@@ -792,6 +797,7 @@ public abstract class PlayerList {
@@ -794,6 +799,7 @@ public abstract class PlayerList {
location = respawnEvent.getRespawnLocation();
if (!flag) entityplayer.reset(); // SPIGOT-4785
@ -32,7 +32,7 @@ index 59155d9b39ed6b27dd46ea586ab07360840db5e7..85bb7fc6d4b65ffb2923d5a6776ebe7a
} else {
location.setWorld(worldserver.getWorld());
}
@@ -849,6 +855,13 @@ public abstract class PlayerList {
@@ -851,6 +857,13 @@ public abstract class PlayerList {
if (entityplayer.playerConnection.isDisconnected()) {
this.savePlayerFile(entityplayer);
}

View File

@ -10,10 +10,10 @@ Optimize to check if the captured list even has values in it, and also to
just do a get call since the value can never be null.
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
index a8899f2ff7c71e62cdbd8eefdca0c3a9905cdc98..7a432d94607e5f7394c493cce69c4957b7f8a01e 100644
index 3b5ddc083719608e944bdefa38e1fd3909e8e200..b6b9a471426ddf911a1f6bf38543c0304bfc31f6 100644
--- a/src/main/java/net/minecraft/world/level/World.java
+++ b/src/main/java/net/minecraft/world/level/World.java
@@ -960,12 +960,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -968,12 +968,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
return null;
} else {
// CraftBukkit start

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add Heightmap API
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
index 7a432d94607e5f7394c493cce69c4957b7f8a01e..12330f20a8550ec044562e2135c465a9fc8e1d60 100644
index b6b9a471426ddf911a1f6bf38543c0304bfc31f6..12ac3608736b45447afe6b0d35ead1441390be5e 100644
--- a/src/main/java/net/minecraft/world/level/World.java
+++ b/src/main/java/net/minecraft/world/level/World.java
@@ -662,8 +662,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -670,8 +670,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
}
}

View File

@ -82,17 +82,24 @@ index ca753267a06643b6f7224140950aa7f47cea64ad..bd4c7dbfad80b65c1350e93bb8303bf1
nbttagcompound.setShort("MaxNearbyEntities", (short) this.maxNearbyEntities);
nbttagcompound.setShort("RequiredPlayerRange", (short) this.requiredPlayerRange);
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
index 28295ebd338806a35cbef164cb014abfe7dae769..e1a6048899e82184ac1a2d3480b65e6d0df163ad 100644
index 28295ebd338806a35cbef164cb014abfe7dae769..3d29be926e36b9a5a981eea1f2a1ec54a4c43393 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
@@ -8,6 +8,14 @@ import org.bukkit.Material;
@@ -1,13 +1,21 @@
package org.bukkit.craftbukkit.block;
import com.google.common.base.Preconditions;
+import net.minecraft.core.IRegistry;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.world.entity.EntityTypes;
+import net.minecraft.world.level.MobSpawnerData;
import net.minecraft.world.level.block.entity.TileEntityMobSpawner;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.entity.EntityType;
+// Paper start
+import net.minecraft.server.IRegistry;
+import net.minecraft.server.MobSpawnerData;
+import net.minecraft.server.NBTTagCompound;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
+import org.bukkit.inventory.ItemStack;
@ -119,7 +126,7 @@ index 28295ebd338806a35cbef164cb014abfe7dae769..e1a6048899e82184ac1a2d3480b65e6d
+ @Override
+ public void setSpawnedItem(ItemStack itemStack) {
+ Preconditions.checkArgument(itemStack != null && !itemStack.getType().isAir(), "spawners cannot spawn air");
+ net.minecraft.server.ItemStack item = CraftItemStack.asNMSCopy(itemStack);
+ net.minecraft.world.item.ItemStack item = CraftItemStack.asNMSCopy(itemStack);
+ NBTTagCompound compound = new NBTTagCompound();
+ NBTTagCompound entity = new NBTTagCompound();
+ entity.setString("id", IRegistry.ENTITY_TYPE.getKey(EntityTypes.ITEM).toString());

View File

@ -81,7 +81,7 @@ index fbf3ccfb347a5ba6e895339e9576629d940d1aa4..38d25a12c6a52d8a83214e2a0f43a218
+ }
}
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
index f0347a71b5937f9b68a4024fd0595a2d3e98eef5..90a3ca4e92fefc1f20b2878686030e9123238384 100644
index c4dd2bac48bb93117925b35dcd753d0fbb22e3cf..aeed11cfee42fbde2c2e5731f46ac24de6469e0e 100644
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
@@ -1,6 +1,7 @@
@ -110,7 +110,15 @@ index f0347a71b5937f9b68a4024fd0595a2d3e98eef5..90a3ca4e92fefc1f20b2878686030e91
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.Executor;
@@ -696,12 +700,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -73,6 +77,7 @@ import net.minecraft.world.entity.boss.EntityComplexPart;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.level.ChunkCoordIntPair;
import net.minecraft.world.level.GameRules;
+import net.minecraft.world.level.World;
import net.minecraft.world.level.chunk.Chunk;
import net.minecraft.world.level.chunk.ChunkConverter;
import net.minecraft.world.level.chunk.ChunkGenerator;
@@ -697,12 +702,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
// CraftBukkit start - these are spawned serialized (DefinedStructure) and we don't call an add event below at the moment due to ordering complexities
boolean needsRemoval = false;
if (chunk.needsDecoration && !this.world.getServer().getServer().getSpawnNPCs() && entity instanceof net.minecraft.world.entity.npc.NPC) {
@ -127,7 +135,7 @@ index f0347a71b5937f9b68a4024fd0595a2d3e98eef5..90a3ca4e92fefc1f20b2878686030e91
if (list == null) {
list = Lists.newArrayList(new Entity[]{entity});
} else {
@@ -728,6 +732,44 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -729,6 +734,44 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
});
}
@ -139,7 +147,7 @@ index f0347a71b5937f9b68a4024fd0595a2d3e98eef5..90a3ca4e92fefc1f20b2878686030e91
+ && mode != PaperWorldConfig.DuplicateUUIDMode.SAFE_REGEN) {
+ return;
+ }
+ Entity other = world.getEntity(entity.uniqueID);
+ Entity other = world.getEntity(entity.getUniqueID());
+
+ if (mode == PaperWorldConfig.DuplicateUUIDMode.SAFE_REGEN && other != null && !other.dead
+ && Objects.equals(other.getSaveID(), entity.getSaveID())
@ -173,7 +181,7 @@ index f0347a71b5937f9b68a4024fd0595a2d3e98eef5..90a3ca4e92fefc1f20b2878686030e91
ChunkCoordIntPair chunkcoordintpair = playerchunk.i();
CompletableFuture<Either<List<IChunkAccess>, PlayerChunk.Failure>> completablefuture = this.a(chunkcoordintpair, 1, (i) -> {
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index b8f0ea863b89bf9ddeef8104d09fe7f00b91f711..a6f3f773a2fbbf98f9ef1eb03a6b392fb9082d25 100644
index edae7ff7d181a5d28e083e714112dc3188b2461f..44611304d5bf222900866319a02a333e0f56218d 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -4,6 +4,8 @@ import com.google.common.annotations.VisibleForTesting;
@ -209,10 +217,10 @@ index b8f0ea863b89bf9ddeef8104d09fe7f00b91f711..a6f3f773a2fbbf98f9ef1eb03a6b392f
}
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index f024db3fe2a9fb9af536fe144b9e871712ae327a..abfda88ab1d0353bbb14ae99dea212941ab2e899 100644
index 37b9915e6c25458e9ec2d0beb40be51991276b8d..63268bc3e04ef334a750f83a8e39acc0919f7906 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2796,6 +2796,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
@@ -2799,6 +2799,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
});
}

View File

@ -75,10 +75,18 @@ index 00dbb5382aa6efec0038a45049716cd44c1f4c79..e4b7bd30117e0a3af50ec28aada604df
if (true) {
WorldServer worldserver1 = worldserver;
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index a6f3f773a2fbbf98f9ef1eb03a6b392fb9082d25..bfcd40c0cf7f3b41601d4c422e75690a20860bf0 100644
index 44611304d5bf222900866319a02a333e0f56218d..16441006736abdea0120570557348be4919c82ad 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -1672,12 +1672,88 @@ public class WorldServer extends World implements GeneratorAccessSeed {
@@ -67,6 +67,7 @@ import net.minecraft.network.protocol.game.PacketPlayOutWorldEvent;
import net.minecraft.network.protocol.game.PacketPlayOutWorldParticles;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.resources.ResourceKey;
+import net.minecraft.server.MCUtil;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.ScoreboardServer;
import net.minecraft.server.level.progress.WorldLoadListener;
@@ -1672,12 +1673,88 @@ public class WorldServer extends World implements GeneratorAccessSeed {
return ((PersistentIdCounts) this.getMinecraftServer().E().getWorldPersistentData().a(PersistentIdCounts::new, "idcounts")).a();
}

View File

@ -208,12 +208,26 @@ index b67bd98cca4a06bc0ebaed577195dffc3b3251ec..a7a02072e5c7ce62cbecbb638fcc74ab
* Ported from MinecraftForge - author: LexManos <LexManos@gmail.com> - License: LGPLv2.1
*/
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
index 67806eaab081e938cd99a0d74225b1b7744ff2d7..5f8b8b5fac14983fbeb64ce3f09bf9a885179e8c 100644
index 35d1444c5b75d9a3a6cface5dd70aea0a08ac89d..fbd33aef21b4539d249c367609a36491530fb7ca 100644
--- a/src/main/java/net/minecraft/server/MCUtil.java
+++ b/src/main/java/net/minecraft/server/MCUtil.java
@@ -13,7 +13,13 @@ import net.minecraft.world.level.ChunkCoordIntPair;
@@ -9,13 +9,27 @@ import net.minecraft.core.BlockPosition;
import net.minecraft.core.EnumDirection;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.chat.IChatBaseComponent;
+import net.minecraft.server.level.ChunkMapDistance;
+import net.minecraft.server.level.ChunkProviderServer;
+import net.minecraft.server.level.EntityPlayer;
+import net.minecraft.server.level.PlayerChunk;
+import net.minecraft.server.level.PlayerChunkMap;
+import net.minecraft.server.level.Ticket;
import net.minecraft.server.level.WorldServer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.ChunkCoordIntPair;
import net.minecraft.world.level.RayTrace;
import net.minecraft.world.level.World;
+import net.minecraft.world.level.chunk.ChunkStatus;
+import net.minecraft.world.level.chunk.IChunkAccess;
import org.apache.commons.lang.exception.ExceptionUtils;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
@ -225,7 +239,7 @@ index 67806eaab081e938cd99a0d74225b1b7744ff2d7..5f8b8b5fac14983fbeb64ce3f09bf9a8
import org.bukkit.Location;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.CraftWorld;
@@ -22,8 +28,11 @@ import org.spigotmc.AsyncCatcher;
@@ -24,8 +38,11 @@ import org.spigotmc.AsyncCatcher;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ -237,7 +251,7 @@ index 67806eaab081e938cd99a0d74225b1b7744ff2d7..5f8b8b5fac14983fbeb64ce3f09bf9a8
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.LinkedBlockingQueue;
@@ -529,4 +538,170 @@ public final class MCUtil {
@@ -531,4 +548,170 @@ public final class MCUtil {
return null;
}
@ -409,7 +423,7 @@ index 67806eaab081e938cd99a0d74225b1b7744ff2d7..5f8b8b5fac14983fbeb64ce3f09bf9a8
+ }
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
index eb576566708d50c002e73aa746d2bc58b9b04c2b..0b2973a7272890ebee205bd74e7d75c174ceeb9a 100644
index eb576566708d50c002e73aa746d2bc58b9b04c2b..b80c3bd702141ca4a88078386845d731b3ecc539 100644
--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
@@ -46,7 +46,7 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; // Paper
@ -417,7 +431,7 @@ index eb576566708d50c002e73aa746d2bc58b9b04c2b..0b2973a7272890ebee205bd74e7d75c1
public class ChunkProviderServer extends IChunkProvider {
- private static final List<ChunkStatus> b = ChunkStatus.a();
+ private static final List<ChunkStatus> b = ChunkStatus.a(); static final List<ChunkStatus> getPossibleChunkStatuses() { return ChunkProviderServer.b; } // Paper - OBFHELPER
+ private static final List<ChunkStatus> b = ChunkStatus.a(); public static final List<ChunkStatus> getPossibleChunkStatuses() { return ChunkProviderServer.b; } // Paper - OBFHELPER
private final ChunkMapDistance chunkMapDistance;
public final ChunkGenerator chunkGenerator;
private final WorldServer world;
@ -435,15 +449,15 @@ index 2c3d9a5d118cc4f3b5e78daf943911bb7386488a..9891cf98f8c740f84f9135ee8176e67a
private final ShortSet[] dirtyBlocks;
private int r;
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
index 90a3ca4e92fefc1f20b2878686030e9123238384..bdcc4542eb5da0a80f00a1d41d4773bb3be3996a 100644
index aeed11cfee42fbde2c2e5731f46ac24de6469e0e..a0fcd20d4a7e951437756edb60a44c627612e04c 100644
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
@@ -104,7 +104,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -106,7 +106,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
public final Long2ObjectLinkedOpenHashMap<PlayerChunk> updatingChunks = new Long2ObjectLinkedOpenHashMap();
public volatile Long2ObjectLinkedOpenHashMap<PlayerChunk> visibleChunks;
private final Long2ObjectLinkedOpenHashMap<PlayerChunk> pendingUnload;
- private final LongSet loadedChunks;
+ final LongSet loadedChunks; // Paper - private -> package
+ public final LongSet loadedChunks; // Paper - private -> public
public final WorldServer world;
private final LightEngineThreaded lightEngine;
private final IAsyncTaskHandler<Runnable> executor;

View File

@ -8,7 +8,7 @@ This patch also adds a chunk status cache on region files (note that
its only purpose is to cache the status on DISK)
diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
index 0b2973a7272890ebee205bd74e7d75c174ceeb9a..24b7b76e11cf2b389c6f40fb4046294f356164c5 100644
index b80c3bd702141ca4a88078386845d731b3ecc539..c6acc429fd0a599c1c1ab676054d9e3f720fbd39 100644
--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
@@ -52,7 +52,7 @@ public class ChunkProviderServer extends IChunkProvider {
@ -67,10 +67,10 @@ index 9891cf98f8c740f84f9135ee8176e67abb648b3a..6bced8533df49d7bfdb32dfa0caad9d7
public CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> getStatusFutureUnchecked(ChunkStatus chunkstatus) {
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
index bdcc4542eb5da0a80f00a1d41d4773bb3be3996a..c8b2013791ce0ac4438243998b43bbd781405254 100644
index a0fcd20d4a7e951437756edb60a44c627612e04c..ccfde274edfe1b611ccf8c583c92b16d52e4518d 100644
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
@@ -983,12 +983,61 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -985,12 +985,61 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
@Nullable
@ -200,10 +200,18 @@ index 247d14a3ca56734bbbf4dc0ec247d60a1f241e7a..d785f44cd503d4d91589f3fc4bc8dc80
@Nullable
private PersistentStructureLegacy c;
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
index 7491c09b3d8fdd27fa83d850ff097e44e1bb0eee..299806b73e44a7128e829b35cc2b017a321d7926 100644
index a9cbe17f6ccf0ce4ace97ba4b951b3fd7415d71b..39d3a71f3945b1c97df35e28d1011b9d42b162f5 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -41,6 +41,30 @@ public class RegionFile implements AutoCloseable {
@@ -26,6 +26,7 @@ import net.minecraft.SystemUtils;
import net.minecraft.nbt.NBTCompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.level.ChunkCoordIntPair;
+import net.minecraft.world.level.chunk.ChunkStatus;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -43,6 +44,30 @@ public class RegionFile implements AutoCloseable {
protected final RegionFileBitSet freeSectors;
public final File file; // Paper
@ -234,7 +242,7 @@ index 7491c09b3d8fdd27fa83d850ff097e44e1bb0eee..299806b73e44a7128e829b35cc2b017a
public RegionFile(File file, File file1, boolean flag) throws IOException {
this(file.toPath(), file1.toPath(), RegionFileCompression.b, flag);
}
@@ -377,11 +401,13 @@ public class RegionFile implements AutoCloseable {
@@ -379,11 +404,13 @@ public class RegionFile implements AutoCloseable {
return this.getOffset(chunkcoordintpair) != 0;
}
@ -249,10 +257,10 @@ index 7491c09b3d8fdd27fa83d850ff097e44e1bb0eee..299806b73e44a7128e829b35cc2b017a
this.d();
} finally {
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java
index 571b34cd30bb76dcfac928e29a1cafd5824d4772..8ceebe1f5ca8821228faf65e1d26fa205ec1e56c 100644
index ab9f4d40fd1126a3d7ba5b16fdc6ab09de4a7fdb..55e7e983d2c760a8052d7b3ddbdc8447f619a60f 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java
@@ -25,7 +25,14 @@ public final class RegionFileCache implements AutoCloseable {
@@ -28,7 +28,14 @@ public final class RegionFileCache implements AutoCloseable {
this.c = flag;
}
@ -268,7 +276,7 @@ index 571b34cd30bb76dcfac928e29a1cafd5824d4772..8ceebe1f5ca8821228faf65e1d26fa20
long i = ChunkCoordIntPair.pair(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ());
RegionFile regionfile = (RegionFile) this.cache.getAndMoveToFirst(i);
@@ -172,6 +179,7 @@ public final class RegionFileCache implements AutoCloseable {
@@ -175,6 +182,7 @@ public final class RegionFileCache implements AutoCloseable {
try {
NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) dataoutputstream);

View File

@ -71,7 +71,7 @@ index e4b7bd30117e0a3af50ec28aada604df837ebb02..1d8695ac6692194c9a1cfd46c9d73512
this.methodProfiler.enter("snooper");
if (((DedicatedServer) this).getDedicatedServerProperties().snooperEnabled && !this.snooper.d() && this.ticks > 100) { // Spigot
diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
index 24b7b76e11cf2b389c6f40fb4046294f356164c5..0b967cc5a86b357ff808621abcb96239bd09d077 100644
index c6acc429fd0a599c1c1ab676054d9e3f720fbd39..2a3c2f4f6d581cff82e0cb69fd6e6fb75435e953 100644
--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
@@ -557,6 +557,15 @@ public class ChunkProviderServer extends IChunkProvider {
@ -158,10 +158,10 @@ index 6bced8533df49d7bfdb32dfa0caad9d788ffc2c8..75d4a8fc394449ccc006fe67a8842edc
public void a(ProtoChunkExtension protochunkextension) {
for (int i = 0; i < this.statusFutures.length(); ++i) {
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
index c8b2013791ce0ac4438243998b43bbd781405254..ec9b765a09500c4e4e5dde8b7856e2b752e7fdc2 100644
index ccfde274edfe1b611ccf8c583c92b16d52e4518d..1f32ab230d650bb5f652efbacdd5e4b90dc4de89 100644
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
@@ -91,6 +91,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.DefinedStruct
@@ -93,6 +93,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.DefinedStruct
import net.minecraft.world.level.storage.Convertable;
import net.minecraft.world.level.storage.WorldPersistentData;
import net.minecraft.world.phys.Vec3D;
@ -169,7 +169,7 @@ index c8b2013791ce0ac4438243998b43bbd781405254..ec9b765a09500c4e4e5dde8b7856e2b7
import org.apache.commons.lang3.mutable.MutableBoolean;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -378,6 +379,64 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -380,6 +381,64 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
@ -234,7 +234,7 @@ index c8b2013791ce0ac4438243998b43bbd781405254..ec9b765a09500c4e4e5dde8b7856e2b7
protected void save(boolean flag) {
if (flag) {
List<PlayerChunk> list = (List) this.visibleChunks.values().stream().filter(PlayerChunk::hasBeenLoaded).peek(PlayerChunk::m).collect(Collectors.toList());
@@ -488,6 +547,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -490,6 +549,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
this.world.unloadChunk(chunk);
}
@ -242,7 +242,7 @@ index c8b2013791ce0ac4438243998b43bbd781405254..ec9b765a09500c4e4e5dde8b7856e2b7
this.lightEngine.a(ichunkaccess.getPos());
this.lightEngine.queueUpdate();
@@ -680,6 +740,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -682,6 +742,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
playerchunk.a(new ProtoChunkExtension(chunk));
}
@ -252,10 +252,10 @@ index c8b2013791ce0ac4438243998b43bbd781405254..ec9b765a09500c4e4e5dde8b7856e2b7
return PlayerChunk.getChunkState(playerchunk.getTicketLevel());
});
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index bfcd40c0cf7f3b41601d4c422e75690a20860bf0..2d2857b301377d45ca5c63e6d855304b3e605f78 100644
index 16441006736abdea0120570557348be4919c82ad..5da94d3c2498c84da81f41c37249159d1c3a9ca2 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -885,11 +885,43 @@ public class WorldServer extends World implements GeneratorAccessSeed {
@@ -886,11 +886,43 @@ public class WorldServer extends World implements GeneratorAccessSeed {
return !this.server.a(this, blockposition, entityhuman) && this.getWorldBorder().a(blockposition);
}
@ -300,7 +300,7 @@ index bfcd40c0cf7f3b41601d4c422e75690a20860bf0..2d2857b301377d45ca5c63e6d855304b
try (co.aikar.timings.Timing ignored = timings.worldSave.startTiming()) { // Paper
if (iprogressupdate != null) {
iprogressupdate.a(new ChatMessage("menu.savingLevel"));
@@ -915,6 +947,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
@@ -916,6 +948,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
// CraftBukkit end
}

View File

@ -59,22 +59,22 @@ index 1278d09f70c1e97607ef20d87a178dc252c7f723..c45493e88bf7e8811be2759ff9ac19e3
}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java
new file mode 100644
index 0000000000000000000000000000000000000000..2bfab782472b0b4f3a9cbb2b51183f286c314dcf
index 0000000000000000000000000000000000000000..83a023ae018cbb79b5f151b1c7a5c8ba0c3bf1bf
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java
@@ -0,0 +1,45 @@
+package com.destroystokyo.paper.antixray;
+
+import net.minecraft.server.BlockPosition;
+import net.minecraft.server.Chunk;
+import net.minecraft.server.ChunkSection;
+import net.minecraft.server.EntityPlayer;
+import net.minecraft.server.EnumDirection;
+import net.minecraft.server.IBlockData;
+import net.minecraft.server.IChunkAccess;
+import net.minecraft.core.BlockPosition;
+import net.minecraft.core.EnumDirection;
+import net.minecraft.network.protocol.game.PacketPlayOutMapChunk;
+import net.minecraft.server.PlayerInteractManager;
+import net.minecraft.server.World;
+import net.minecraft.server.level.EntityPlayer;
+import net.minecraft.server.level.PlayerInteractManager;
+import net.minecraft.world.level.World;
+import net.minecraft.world.level.block.state.IBlockData;
+import net.minecraft.world.level.chunk.Chunk;
+import net.minecraft.world.level.chunk.ChunkSection;
+import net.minecraft.world.level.chunk.IChunkAccess;
+
+public class ChunkPacketBlockController {
+
@ -110,10 +110,10 @@ index 0000000000000000000000000000000000000000..2bfab782472b0b4f3a9cbb2b51183f28
+}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
new file mode 100644
index 0000000000000000000000000000000000000000..a6e2e3ac478801c30459a39e020a0f4354f4636b
index 0000000000000000000000000000000000000000..cd3b5b62d470ab6753b44f9b13dcf5522e4cbd15
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
@@ -0,0 +1,632 @@
@@ -0,0 +1,650 @@
+package com.destroystokyo.paper.antixray;
+
+import java.util.ArrayList;
@ -125,7 +125,25 @@ index 0000000000000000000000000000000000000000..a6e2e3ac478801c30459a39e020a0f43
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.function.IntSupplier;
+
+import net.minecraft.server.*;
+import net.minecraft.core.BlockPosition;
+import net.minecraft.core.EnumDirection;
+import net.minecraft.core.IRegistry;
+import net.minecraft.network.protocol.game.PacketPlayOutMapChunk;
+import net.minecraft.resources.MinecraftKey;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.EntityPlayer;
+import net.minecraft.server.level.PlayerInteractManager;
+import net.minecraft.server.level.WorldServer;
+import net.minecraft.world.level.ChunkCoordIntPair;
+import net.minecraft.world.level.World;
+import net.minecraft.world.level.block.Block;
+import net.minecraft.world.level.block.Blocks;
+import net.minecraft.world.level.block.state.IBlockData;
+import net.minecraft.world.level.chunk.Chunk;
+import net.minecraft.world.level.chunk.ChunkEmpty;
+import net.minecraft.world.level.chunk.ChunkSection;
+import net.minecraft.world.level.chunk.DataPalette;
+import net.minecraft.world.level.chunk.IChunkAccess;
+import org.bukkit.Bukkit;
+import org.bukkit.World.Environment;
+
@ -748,15 +766,15 @@ index 0000000000000000000000000000000000000000..a6e2e3ac478801c30459a39e020a0f43
+}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java
new file mode 100644
index 0000000000000000000000000000000000000000..41618994b463267e41a9eb312db682e497c68e1b
index 0000000000000000000000000000000000000000..22c9adefc3e51e9e4b8d611a40d1497d2a16a8d2
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java
@@ -0,0 +1,81 @@
+package com.destroystokyo.paper.antixray;
+
+import net.minecraft.server.Chunk;
+import net.minecraft.server.DataPalette;
+import net.minecraft.network.protocol.game.PacketPlayOutMapChunk;
+import net.minecraft.world.level.chunk.Chunk;
+import net.minecraft.world.level.chunk.DataPalette;
+
+public class ChunkPacketInfo<T> {
+
@ -835,15 +853,15 @@ index 0000000000000000000000000000000000000000..41618994b463267e41a9eb312db682e4
+}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java
new file mode 100644
index 0000000000000000000000000000000000000000..e61421d87a19bf2f6ce8836b48c445ffdb6772df
index 0000000000000000000000000000000000000000..4b64964e52b11bea4d2c0d0f64f55ad08d2189be
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java
@@ -0,0 +1,30 @@
+package com.destroystokyo.paper.antixray;
+
+import net.minecraft.server.Chunk;
+import net.minecraft.server.IBlockData;
+import net.minecraft.network.protocol.game.PacketPlayOutMapChunk;
+import net.minecraft.world.level.block.state.IBlockData;
+import net.minecraft.world.level.chunk.Chunk;
+
+public final class ChunkPacketInfoAntiXray extends ChunkPacketInfo<IBlockData> implements Runnable {
+
@ -1012,7 +1030,7 @@ index 0000000000000000000000000000000000000000..333763936897befda5bb6c077944d266
+ }
+}
diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java
index 31a6f687a8a75b055a32a686c870d3898aae54c3..fe1910486ffc6acc54b565dc68b9873820053701 100644
index a7d10d124021f3427f23fcd533f885367b64515c..3047cf8c4ec1b664d6b790f18d2b1657e4b00435 100644
--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java
+++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java
@@ -1,5 +1,6 @@
@ -1022,7 +1040,15 @@ index 31a6f687a8a75b055a32a686c870d3898aae54c3..fe1910486ffc6acc54b565dc68b98738
import com.google.common.collect.Lists;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
@@ -32,7 +33,13 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
@@ -16,6 +17,7 @@ import net.minecraft.network.protocol.Packet;
import net.minecraft.world.level.ChunkCoordIntPair;
import net.minecraft.world.level.block.entity.TileEntity;
import net.minecraft.world.level.block.entity.TileEntitySkull;
+import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.chunk.BiomeStorage;
import net.minecraft.world.level.chunk.Chunk;
import net.minecraft.world.level.chunk.ChunkSection;
@@ -33,7 +35,13 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
private List<NBTTagCompound> g;
private boolean h;
@ -1037,7 +1063,7 @@ index 31a6f687a8a75b055a32a686c870d3898aae54c3..fe1910486ffc6acc54b565dc68b98738
// Paper start
private final java.util.List<Packet> extraPackets = new java.util.ArrayList<>();
private static final int TE_LIMIT = Integer.getInteger("Paper.excessiveTELimit", 750);
@@ -42,7 +49,11 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
@@ -43,7 +51,11 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
return extraPackets;
}
// Paper end
@ -1050,7 +1076,7 @@ index 31a6f687a8a75b055a32a686c870d3898aae54c3..fe1910486ffc6acc54b565dc68b98738
ChunkCoordIntPair chunkcoordintpair = chunk.getPos();
this.a = chunkcoordintpair.x;
@@ -65,7 +76,12 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
@@ -66,7 +78,12 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
}
this.f = new byte[this.a(chunk, i)];
@ -1064,7 +1090,7 @@ index 31a6f687a8a75b055a32a686c870d3898aae54c3..fe1910486ffc6acc54b565dc68b98738
this.g = Lists.newArrayList();
iterator = chunk.getTileEntities().entrySet().iterator();
int totalTileEntities = 0; // Paper
@@ -92,8 +108,19 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
@@ -93,8 +110,19 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
this.g.add(nbttagcompound);
}
}
@ -1084,7 +1110,7 @@ index 31a6f687a8a75b055a32a686c870d3898aae54c3..fe1910486ffc6acc54b565dc68b98738
@Override
public void a(PacketDataSerializer packetdataserializer) throws IOException {
@@ -159,8 +186,12 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
@@ -160,8 +188,12 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
return bytebuf;
}
@ -1099,7 +1125,7 @@ index 31a6f687a8a75b055a32a686c870d3898aae54c3..fe1910486ffc6acc54b565dc68b98738
int j = 0;
ChunkSection[] achunksection = chunk.getSections();
int k = 0;
@@ -170,7 +201,7 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
@@ -171,7 +203,7 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
if (chunksection != Chunk.a && (!this.f() || !chunksection.c()) && (i & 1 << k) != 0) {
j |= 1 << k;
@ -1109,10 +1135,10 @@ index 31a6f687a8a75b055a32a686c870d3898aae54c3..fe1910486ffc6acc54b565dc68b98738
}
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
index ec9b765a09500c4e4e5dde8b7856e2b752e7fdc2..78e2c2bab951a8f7759ea5badc3275ef4f00e9ba 100644
index 1f32ab230d650bb5f652efbacdd5e4b90dc4de89..71c2792d7eede35485cc36ac929cf295bcd4646b 100644
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
@@ -654,7 +654,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -656,7 +656,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
this.g(chunkcoordintpair);
@ -1121,7 +1147,7 @@ index ec9b765a09500c4e4e5dde8b7856e2b752e7fdc2..78e2c2bab951a8f7759ea5badc3275ef
}, this.executor);
}
@@ -1394,9 +1394,10 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -1396,9 +1396,10 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
@ -1147,10 +1173,10 @@ index 0d32d7e9fc6bf6a05f3975fe225022a9e176e47b..3dcfb2326af92eb7a9cd16fd4725b3ae
public void a(BlockPosition blockposition, PacketPlayInBlockDig.EnumPlayerDigType packetplayinblockdig_enumplayerdigtype, String s) {
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index 2d2857b301377d45ca5c63e6d855304b3e605f78..8b7e6dfa146abc3b4c8a5b0646e0ef1453ddb68c 100644
index 5da94d3c2498c84da81f41c37249159d1c3a9ca2..280ecd3634d77b93cf0923f4c4a5cfd7f114e848 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -209,7 +209,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
@@ -210,7 +210,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
// Add env and gen to constructor, WorldData -> WorldDataServer
public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
@ -1160,7 +1186,7 @@ index 2d2857b301377d45ca5c63e6d855304b3e605f78..8b7e6dfa146abc3b4c8a5b0646e0ef14
convertable = convertable_conversionsession;
uuid = WorldUUID.getUUID(convertable_conversionsession.folder.toFile());
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
index 12330f20a8550ec044562e2135c465a9fc8e1d60..81f657084afdfcace67a2245230b0cb91dd919bd 100644
index 12ac3608736b45447afe6b0d35ead1441390be5e..15da3511a9e57c320f4cf409852bee07109095bc 100644
--- a/src/main/java/net/minecraft/world/level/World.java
+++ b/src/main/java/net/minecraft/world/level/World.java
@@ -2,6 +2,8 @@ package net.minecraft.world.level;
@ -1172,7 +1198,7 @@ index 12330f20a8550ec044562e2135c465a9fc8e1d60..81f657084afdfcace67a2245230b0cb9
import com.destroystokyo.paper.event.server.ServerExceptionEvent;
import com.destroystokyo.paper.exception.ServerInternalException;
import com.google.common.base.MoreObjects;
@@ -136,6 +138,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -144,6 +146,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper
@ -1180,7 +1206,7 @@ index 12330f20a8550ec044562e2135c465a9fc8e1d60..81f657084afdfcace67a2245230b0cb9
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
public static BlockPosition lastPhysicsProblem; // Spigot
@@ -157,9 +160,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -165,9 +168,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
return typeKey;
}
@ -1192,7 +1218,7 @@ index 12330f20a8550ec044562e2135c465a9fc8e1d60..81f657084afdfcace67a2245230b0cb9
this.generator = gen;
this.world = new CraftWorld((WorldServer) this, gen, env);
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
@@ -425,6 +429,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -433,6 +437,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
// CraftBukkit end
IBlockData iblockdata1 = chunk.setType(blockposition, iblockdata, (i & 64) != 0, (i & 1024) == 0); // CraftBukkit custom NO_PLACE flag
@ -1227,10 +1253,10 @@ index 89efd0b68b04457e1cd617dcc8bb1a6ea1c4717c..a8f4c1468759fe44c28957e0e733dee7
// Paper start
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java
index eea4a30428293eaf7afbe303a37adec60b44c2b4..00658974083a97d74e3336d9c719892f25aa22a9 100644
index eea4a30428293eaf7afbe303a37adec60b44c2b4..0b4e346daaea91565fde2f789fafa8b431a7b042 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java
@@ -1,6 +1,7 @@
@@ -1,9 +1,11 @@
package net.minecraft.world.level.chunk;
import java.util.function.Predicate;
@ -1238,7 +1264,11 @@ index eea4a30428293eaf7afbe303a37adec60b44c2b4..00658974083a97d74e3336d9c719892f
import javax.annotation.Nullable;
import net.minecraft.nbt.GameProfileSerializer;
import net.minecraft.network.PacketDataSerializer;
@@ -18,16 +19,22 @@ public class ChunkSection {
+import net.minecraft.world.level.World;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.IBlockData;
@@ -18,16 +20,22 @@ public class ChunkSection {
private short e;
final DataPaletteBlock<IBlockData> blockIds; // Paper - package-private
@ -1265,7 +1295,7 @@ index eea4a30428293eaf7afbe303a37adec60b44c2b4..00658974083a97d74e3336d9c719892f
}
public final IBlockData getType(int i, int j, int k) { // Paper
@@ -139,10 +146,14 @@ public class ChunkSection {
@@ -139,10 +147,14 @@ public class ChunkSection {
return this.blockIds;
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Mark entities as being ticked when notifying navigation
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index 8b7e6dfa146abc3b4c8a5b0646e0ef1453ddb68c..86e6a11c760b2ec47711bd8327b185ae902c4527 100644
index 280ecd3634d77b93cf0923f4c4a5cfd7f114e848..7282ac286e4f1333c25a8515275b27b9efb19343 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -1473,6 +1473,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
@@ -1474,6 +1474,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
VoxelShape voxelshape1 = iblockdata1.getCollisionShape(this, blockposition);
if (VoxelShapes.c(voxelshape, voxelshape1, OperatorBoolean.NOT_SAME)) {
@ -16,7 +16,7 @@ index 8b7e6dfa146abc3b4c8a5b0646e0ef1453ddb68c..86e6a11c760b2ec47711bd8327b185ae
Iterator iterator = this.navigators.iterator();
while (iterator.hasNext()) {
@@ -1494,6 +1495,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
@@ -1495,6 +1496,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
}
}

View File

@ -121,7 +121,7 @@ tasks required to be executed by the chunk load task (i.e lighting
and some poi tasks).
diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
index 944fd203e9f39d6c6fc9e270940c76c98067273a..a27dc38d1a29ed1d63d2f44b7984c2b65be487d9 100644
index fa154ed68187a2020e814db6345a8cc1119ab4ba..2da28784ee427001b1137c859f0b4c350abd3110 100644
--- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java
+++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
@@ -58,6 +58,17 @@ public class WorldTimingsHandler {
@ -326,17 +326,17 @@ index 0000000000000000000000000000000000000000..5af0ac3d9e87c06053e65433060f1577
+}
diff --git a/src/main/java/com/destroystokyo/paper/io/PaperFileIOThread.java b/src/main/java/com/destroystokyo/paper/io/PaperFileIOThread.java
new file mode 100644
index 0000000000000000000000000000000000000000..1917d7be7dfddc93c95b9fd864cf13f9a24c8f96
index 0000000000000000000000000000000000000000..9fe91f9512ee8c2589fc8da76bda5f6d70c9fac4
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/io/PaperFileIOThread.java
@@ -0,0 +1,606 @@
+package com.destroystokyo.paper.io;
+
+import net.minecraft.server.ChunkCoordIntPair;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.NBTTagCompound;
+import net.minecraft.server.RegionFile;
+import net.minecraft.server.WorldServer;
+import net.minecraft.server.level.WorldServer;
+import net.minecraft.world.level.ChunkCoordIntPair;
+import net.minecraft.world.level.chunk.storage.RegionFile;
+import org.apache.logging.log4j.Logger;
+
+import java.io.IOException;
@ -1468,7 +1468,7 @@ index 0000000000000000000000000000000000000000..ee906b594b306906c170180a29a8b619
+}
diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkLoadTask.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkLoadTask.java
new file mode 100644
index 0000000000000000000000000000000000000000..6367092663a213793367ccb65733afc119e4883c
index 0000000000000000000000000000000000000000..9a2b51d005efc9d31b3685e8298fd00b341c7dc7
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkLoadTask.java
@@ -0,0 +1,146 @@
@ -1477,10 +1477,10 @@ index 0000000000000000000000000000000000000000..6367092663a213793367ccb65733afc1
+import co.aikar.timings.Timing;
+import com.destroystokyo.paper.io.PaperFileIOThread;
+import com.destroystokyo.paper.io.IOUtil;
+import net.minecraft.server.ChunkCoordIntPair;
+import net.minecraft.server.ChunkRegionLoader;
+import net.minecraft.server.PlayerChunkMap;
+import net.minecraft.server.WorldServer;
+import net.minecraft.server.level.PlayerChunkMap;
+import net.minecraft.server.level.WorldServer;
+import net.minecraft.world.level.ChunkCoordIntPair;
+import net.minecraft.world.level.chunk.storage.ChunkRegionLoader;
+
+import java.util.ArrayDeque;
+import java.util.function.Consumer;
@ -1620,24 +1620,23 @@ index 0000000000000000000000000000000000000000..6367092663a213793367ccb65733afc1
+}
diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkSaveTask.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkSaveTask.java
new file mode 100644
index 0000000000000000000000000000000000000000..60312b85f9e7070378458f29afee0ebb7850d8a5
index 0000000000000000000000000000000000000000..e3ad8f50b51c4e9bf38ffa5911444cc88d3f67eb
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkSaveTask.java
@@ -0,0 +1,112 @@
@@ -0,0 +1,111 @@
+package com.destroystokyo.paper.io.chunk;
+
+import co.aikar.timings.Timing;
+import com.destroystokyo.paper.io.PaperFileIOThread;
+import com.destroystokyo.paper.io.IOUtil;
+import com.destroystokyo.paper.io.PrioritizedTaskQueue;
+import net.minecraft.server.ChunkRegionLoader;
+import net.minecraft.server.IAsyncTaskHandler;
+import net.minecraft.server.IChunkAccess;
+import net.minecraft.server.NBTTagCompound;
+import net.minecraft.server.WorldServer;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.atomic.AtomicInteger;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.server.level.WorldServer;
+import net.minecraft.world.level.chunk.IChunkAccess;
+import net.minecraft.world.level.chunk.storage.ChunkRegionLoader;
+
+public final class ChunkSaveTask extends ChunkTask {
+
@ -1738,7 +1737,7 @@ index 0000000000000000000000000000000000000000..60312b85f9e7070378458f29afee0ebb
+}
diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTask.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTask.java
new file mode 100644
index 0000000000000000000000000000000000000000..1dfa8abfd869ca97e4cc566d44e509b444dbcdc5
index 0000000000000000000000000000000000000000..9c1370c7d85262da9d64871e03e5a8a8c5e087d7
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTask.java
@@ -0,0 +1,40 @@
@ -1746,7 +1745,7 @@ index 0000000000000000000000000000000000000000..1dfa8abfd869ca97e4cc566d44e509b4
+
+import com.destroystokyo.paper.io.PaperFileIOThread;
+import com.destroystokyo.paper.io.PrioritizedTaskQueue;
+import net.minecraft.server.WorldServer;
+import net.minecraft.server.level.WorldServer;
+
+abstract class ChunkTask extends PrioritizedTaskQueue.PrioritizedTask implements Runnable {
+
@ -1784,23 +1783,25 @@ index 0000000000000000000000000000000000000000..1dfa8abfd869ca97e4cc566d44e509b4
+}
diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..49a594e5f345096cb3b9913b8ee2760795c5f012
index 0000000000000000000000000000000000000000..8e642f450b974d81f128d26edfd40915554db638
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java
@@ -0,0 +1,511 @@
@@ -0,0 +1,513 @@
+package com.destroystokyo.paper.io.chunk;
+
+import com.destroystokyo.paper.io.PaperFileIOThread;
+import com.destroystokyo.paper.io.IOUtil;
+import com.destroystokyo.paper.io.PrioritizedTaskQueue;
+import com.destroystokyo.paper.io.QueueExecutorThread;
+import net.minecraft.server.ChunkRegionLoader;
+import net.minecraft.server.IAsyncTaskHandler;
+import net.minecraft.server.IChunkAccess;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.NBTTagCompound;
+import net.minecraft.server.PlayerChunk;
+import net.minecraft.server.WorldServer;
+import net.minecraft.server.level.ChunkProviderServer;
+import net.minecraft.server.level.PlayerChunk;
+import net.minecraft.server.level.WorldServer;
+import net.minecraft.util.thread.IAsyncTaskHandler;
+import net.minecraft.world.level.chunk.ChunkStatus;
+import net.minecraft.world.level.chunk.IChunkAccess;
+import net.minecraft.world.level.chunk.storage.ChunkRegionLoader;
+import org.apache.commons.lang.StringUtils;
+import org.apache.logging.log4j.Level;
+import org.bukkit.Bukkit;
@ -1888,7 +1889,7 @@ index 0000000000000000000000000000000000000000..49a594e5f345096cb3b9913b8ee27607
+ PaperFileIOThread.LOGGER.log(Level.ERROR, "Load Task - " + (loadTask == null ? "none" : loadTask.toString()));
+ PaperFileIOThread.LOGGER.log(Level.ERROR, "Save Task - " + (saveTask == null ? "none" : saveTask.toString()));
+ // log current status of chunk to indicate whether we're waiting on generation or loading
+ net.minecraft.server.PlayerChunk chunkHolder = chunkInfo.world.getChunkProvider().playerChunkMap.getVisibleChunk(key);
+ PlayerChunk chunkHolder = chunkInfo.world.getChunkProvider().playerChunkMap.getVisibleChunk(key);
+
+ dumpChunkInfo(new HashSet<>(), chunkHolder, chunkInfo.chunkX, chunkInfo.chunkZ);
+ }
@ -1912,7 +1913,7 @@ index 0000000000000000000000000000000000000000..49a594e5f345096cb3b9913b8ee27607
+ PaperFileIOThread.LOGGER.log(Level.ERROR, indentStr + "Chunk Holder - null for (" + x +"," + z +")");
+ } else {
+ IChunkAccess chunk = chunkHolder.getAvailableChunkNow();
+ net.minecraft.server.ChunkStatus holderStatus = chunkHolder.getChunkHolderStatus();
+ ChunkStatus holderStatus = chunkHolder.getChunkHolderStatus();
+ PaperFileIOThread.LOGGER.log(Level.ERROR, indentStr + "Chunk Holder - non-null");
+ PaperFileIOThread.LOGGER.log(Level.ERROR, indentStr + "Chunk Status - " + ((chunk == null) ? "null chunk" : chunk.getChunkStatus().toString()));
+ PaperFileIOThread.LOGGER.log(Level.ERROR, indentStr + "Chunk Ticket Status - " + PlayerChunk.getChunkStatus(chunkHolder.getTicketLevel()));
@ -1955,7 +1956,7 @@ index 0000000000000000000000000000000000000000..49a594e5f345096cb3b9913b8ee27607
+ * less-than or equal to 0, then this chunk task manager will operate off of the world's chunk task queue.
+ * @param world Specified world.
+ * @param threads Specified number of threads.
+ * @see net.minecraft.server.ChunkProviderServer#serverThreadQueue
+ * @see ChunkProviderServer#serverThreadQueue
+ */
+ public ChunkTaskManager(final WorldServer world, final int threads) {
+ this.world = world;
@ -1980,7 +1981,7 @@ index 0000000000000000000000000000000000000000..49a594e5f345096cb3b9913b8ee27607
+ * the global queue is not shutdown. If the global workers is configured to be disabled or use 0 threads, then
+ * this chunk task manager will operate off of the world's chunk task queue.
+ * @param world The world that this task manager is responsible for
+ * @see net.minecraft.server.ChunkProviderServer#serverThreadQueue
+ * @see ChunkProviderServer#serverThreadQueue
+ */
+ public ChunkTaskManager(final WorldServer world) {
+ this.world = world;
@ -2088,7 +2089,7 @@ index 0000000000000000000000000000000000000000..49a594e5f345096cb3b9913b8ee27607
+ * @param chunkX Chunk's x coordinate
+ * @param chunkZ Chunk's z coordinate
+ * @param priority Priority for this task
+ * @param onComplete The consumer to invoke with the {@link net.minecraft.server.ChunkRegionLoader.InProgressChunkHolder} object once this task is complete
+ * @param onComplete The consumer to invoke with the {@link ChunkRegionLoader.InProgressChunkHolder} object once this task is complete
+ * @param intendingToBlock Whether the caller is intending to block on this task completing (this is a performance tune, and has no adverse side-effects)
+ * @return The {@link ChunkLoadTask} associated with
+ */
@ -2313,10 +2314,10 @@ index e201e4efd4ecc65ec3c38528a4ec5336e2d51ab2..45f3f8964a587c382b6ea82560e9da30
@Override
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
index 5f8b8b5fac14983fbeb64ce3f09bf9a885179e8c..2489a29e344145f3ce4ff3c9fe08d6ee64a47acb 100644
index fbd33aef21b4539d249c367609a36491530fb7ca..5a410550cfb48505c9de9979465ed1528c8fbf05 100644
--- a/src/main/java/net/minecraft/server/MCUtil.java
+++ b/src/main/java/net/minecraft/server/MCUtil.java
@@ -704,4 +704,9 @@ public final class MCUtil {
@@ -714,4 +714,9 @@ public final class MCUtil {
out.print(fileData);
}
}
@ -2352,10 +2353,18 @@ index 1d8695ac6692194c9a1cfd46c9d735120ca75245..eafee14262ac8abb482bdd0fa52a8a33
public String getServerIp() {
diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
index 0b967cc5a86b357ff808621abcb96239bd09d077..32ef8b2e52b47c2fdeb13d00df5107fa7c3b540e 100644
index 2a3c2f4f6d581cff82e0cb69fd6e6fb75435e953..df71f8c42ac488153257614b58202bb5d7083251 100644
--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
@@ -332,11 +332,138 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -38,6 +38,7 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.IChunkAccess;
import net.minecraft.world.level.chunk.IChunkProvider;
+import net.minecraft.world.level.chunk.ProtoChunkExtension;
import net.minecraft.world.level.levelgen.structure.templatesystem.DefinedStructureManager;
import net.minecraft.world.level.storage.Convertable;
import net.minecraft.world.level.storage.WorldData;
@@ -332,11 +333,138 @@ public class ChunkProviderServer extends IChunkProvider {
return playerChunk.getAvailableChunkNow();
}
@ -2417,7 +2426,7 @@ index 0b967cc5a86b357ff808621abcb96239bd09d077..32ef8b2e52b47c2fdeb13d00df5107fa
+
+ IChunkAccess current = this.getChunkAtImmediately(x, z); // we want to bypass ticket restrictions
+ if (current != null) {
+ if (!(current instanceof ProtoChunkExtension) && !(current instanceof net.minecraft.server.Chunk)) {
+ if (!(current instanceof ProtoChunkExtension) && !(current instanceof Chunk)) {
+ return CompletableFuture.completedFuture(PlayerChunk.UNLOADED_CHUNK_ACCESS);
+ }
+ // we know the chunk is at full status here (either in read-only mode or the real thing)
@ -2494,7 +2503,7 @@ index 0b967cc5a86b357ff808621abcb96239bd09d077..32ef8b2e52b47c2fdeb13d00df5107fa
if (Thread.currentThread() != this.serverThread) {
return (IChunkAccess) CompletableFuture.supplyAsync(() -> {
return this.getChunkAt(i, j, chunkstatus, flag);
@@ -359,11 +486,16 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -359,11 +487,16 @@ public class ChunkProviderServer extends IChunkProvider {
}
gameprofilerfiller.c("getChunkCacheMiss");
@ -2512,7 +2521,7 @@ index 0b967cc5a86b357ff808621abcb96239bd09d077..32ef8b2e52b47c2fdeb13d00df5107fa
this.world.timings.syncChunkLoad.stopTiming(); // Paper
} // Paper
ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
@@ -429,6 +561,11 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -429,6 +562,11 @@ public class ChunkProviderServer extends IChunkProvider {
}
private CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> getChunkFutureMainThread(int i, int j, ChunkStatus chunkstatus, boolean flag) {
@ -2524,7 +2533,7 @@ index 0b967cc5a86b357ff808621abcb96239bd09d077..32ef8b2e52b47c2fdeb13d00df5107fa
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
long k = chunkcoordintpair.pair();
int l = 33 + ChunkStatus.a(chunkstatus);
@@ -828,11 +965,12 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -828,11 +966,12 @@ public class ChunkProviderServer extends IChunkProvider {
protected boolean executeNext() {
// CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task
try {
@ -2584,10 +2593,18 @@ index 75d4a8fc394449ccc006fe67a8842edcd9f36854..6433463938d8bb717840c8f57fe6e707
completablefuture = (CompletableFuture) this.statusFutures.get(i);
if (completablefuture != null) {
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdadf833b0c1 100644
index 71c2792d7eede35485cc36ac929cf295bcd4646b..a6c3bed5824d112042536a5666098d4d80173c3b 100644
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
@@ -110,7 +110,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -88,6 +88,7 @@ import net.minecraft.world.level.chunk.ProtoChunk;
import net.minecraft.world.level.chunk.ProtoChunkExtension;
import net.minecraft.world.level.chunk.storage.ChunkRegionLoader;
import net.minecraft.world.level.chunk.storage.IChunkLoader;
+import net.minecraft.world.level.chunk.storage.RegionFile;
import net.minecraft.world.level.levelgen.structure.StructureStart;
import net.minecraft.world.level.levelgen.structure.templatesystem.DefinedStructureManager;
import net.minecraft.world.level.storage.Convertable;
@@ -112,7 +113,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
private final LightEngineThreaded lightEngine;
private final IAsyncTaskHandler<Runnable> executor;
public final ChunkGenerator chunkGenerator;
@ -2596,7 +2613,7 @@ index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdad
private final VillagePlace m;
public final LongSet unloadQueue;
private boolean updatingChunksModified;
@@ -120,7 +120,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -122,7 +123,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
public final WorldLoadListener worldLoadListener;
public final PlayerChunkMap.a chunkDistanceManager;
private final AtomicInteger u;
@ -2605,7 +2622,7 @@ index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdad
private final File w;
private final PlayerMap playerMap;
public final Int2ObjectMap<PlayerChunkMap.EntityTracker> trackedEntities;
@@ -203,7 +203,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -205,7 +206,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
this.lightEngine = new LightEngineThreaded(ilightaccess, this, this.world.getDimensionManager().hasSkyLight(), threadedmailbox1, this.p.a(threadedmailbox1, false));
this.chunkDistanceManager = new PlayerChunkMap.a(executor, iasynctaskhandler);
this.l = supplier;
@ -2614,7 +2631,7 @@ index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdad
this.setViewDistance(i);
}
@@ -245,12 +245,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -247,12 +248,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
@Nullable
@ -2629,7 +2646,7 @@ index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdad
return (PlayerChunk) this.visibleChunks.get(i);
}
@@ -372,6 +372,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -374,6 +375,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
public void close() throws IOException {
try {
this.p.close();
@ -2637,7 +2654,7 @@ index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdad
this.m.close();
} finally {
super.close();
@@ -463,7 +464,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -465,7 +467,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
this.b(() -> {
return true;
});
@ -2647,7 +2664,7 @@ index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdad
PlayerChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.w.getName());
} else {
this.visibleChunks.values().stream().filter(PlayerChunk::hasBeenLoaded).forEach((playerchunk) -> {
@@ -479,16 +481,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -481,16 +484,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
@ -2669,7 +2686,7 @@ index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdad
}
gameprofilerfiller.exit();
@@ -509,12 +515,13 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -511,12 +518,13 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
if (playerchunk != null) {
this.pendingUnload.put(j, playerchunk);
this.updatingChunksModified = true;
@ -2684,7 +2701,7 @@ index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdad
}
}
activityAccountant.endActivity(); // Spigot
@@ -528,6 +535,60 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -530,6 +538,60 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
@ -2745,7 +2762,7 @@ index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdad
private void a(long i, PlayerChunk playerchunk) {
CompletableFuture<IChunkAccess> completablefuture = playerchunk.getChunkSave();
Consumer<IChunkAccess> consumer = (ichunkaccess) -> { // CraftBukkit - decompile error
@@ -541,7 +602,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -543,7 +605,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
((Chunk) ichunkaccess).setLoaded(false);
}
@ -2754,7 +2771,7 @@ index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdad
if (this.loadedChunks.remove(i) && ichunkaccess instanceof Chunk) {
Chunk chunk = (Chunk) ichunkaccess;
@@ -549,6 +610,13 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -551,6 +613,13 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
this.autoSaveQueue.remove(playerchunk); // Paper
@ -2768,7 +2785,7 @@ index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdad
this.lightEngine.a(ichunkaccess.getPos());
this.lightEngine.queueUpdate();
this.worldLoadListener.a(ichunkaccess.getPos(), (ChunkStatus) null);
@@ -619,19 +687,23 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -621,19 +690,23 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
private CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> f(ChunkCoordIntPair chunkcoordintpair) {
@ -2801,7 +2818,7 @@ index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdad
protochunk.setLastSaved(this.world.getTime());
this.a(chunkcoordintpair, protochunk.getChunkStatus().getType());
@@ -655,7 +727,32 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -657,7 +730,32 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
this.g(chunkcoordintpair);
return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a, this.world)); // Paper - Anti-Xray - Add parameter
@ -2835,7 +2852,7 @@ index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdad
}
private void g(ChunkCoordIntPair chunkcoordintpair) {
@@ -882,6 +979,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -884,6 +982,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
public boolean saveChunk(IChunkAccess ichunkaccess) {
@ -2843,7 +2860,7 @@ index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdad
this.m.a(ichunkaccess.getPos());
if (!ichunkaccess.isNeedsSaving()) {
return false;
@@ -894,6 +992,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -896,6 +995,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
ChunkStatus chunkstatus = ichunkaccess.getChunkStatus();
if (chunkstatus.getType() != ChunkStatus.Type.LEVELCHUNK) {
@ -2851,7 +2868,7 @@ index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdad
if (this.h(chunkcoordintpair)) {
return false;
}
@@ -901,12 +1000,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -903,12 +1003,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
if (chunkstatus == ChunkStatus.EMPTY && ichunkaccess.h().values().stream().noneMatch(StructureStart::e)) {
return false;
}
@ -2874,7 +2891,7 @@ index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdad
this.a(chunkcoordintpair, chunkstatus.getType());
return true;
} catch (Exception exception) {
@@ -915,6 +1022,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -917,6 +1025,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
return false;
}
}
@ -2882,7 +2899,7 @@ index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdad
}
private boolean h(ChunkCoordIntPair chunkcoordintpair) {
@@ -1044,6 +1152,35 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -1046,6 +1155,35 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
}
@ -2918,7 +2935,7 @@ index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdad
@Nullable
public NBTTagCompound readChunkData(ChunkCoordIntPair chunkcoordintpair) throws IOException { // Paper - private -> public
NBTTagCompound nbttagcompound = this.read(chunkcoordintpair);
@@ -1065,33 +1202,55 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -1067,33 +1205,55 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
// Paper start - chunk status cache "api"
public ChunkStatus getChunkStatusOnDiskIfCached(ChunkCoordIntPair chunkPos) {
@ -2985,7 +3002,7 @@ index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdad
}
public IChunkAccess getUnloadingChunk(int chunkX, int chunkZ) {
@@ -1100,6 +1259,39 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -1102,6 +1262,39 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
// Paper end
@ -3001,17 +3018,17 @@ index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdad
+ }
+ // Paper end
+ // Paper start - async io
+ net.minecraft.server.NBTTagCompound inProgressWrite = com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE
+ NBTTagCompound inProgressWrite = com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE
+ .getPendingWrite(this.world, x, z, false);
+
+ if (inProgressWrite != null) {
+ return net.minecraft.server.ChunkRegionLoader.getStatus(inProgressWrite);
+ return ChunkRegionLoader.getStatus(inProgressWrite);
+ }
+ // Paper end
+ // variant of PlayerChunkMap#getChunkStatusOnDisk that does not load data off disk, but loads the region file
+ ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(x, z);
+ synchronized (world.getChunkProvider().playerChunkMap) {
+ net.minecraft.server.RegionFile file;
+ RegionFile file;
+ try {
+ file = world.getChunkProvider().playerChunkMap.regionFileCache.getFile(chunkPos, false);
+ } catch (IOException ex) {
@ -3025,7 +3042,7 @@ index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdad
boolean isOutsideOfRange(ChunkCoordIntPair chunkcoordintpair) {
// Spigot start
return isOutsideOfRange(chunkcoordintpair, false);
@@ -1446,6 +1638,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -1448,6 +1641,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
@ -3046,10 +3063,26 @@ index 285a03b57431bd6a4d26bb84e916d2c6e1eb0213..218dc900e125a11548485887b1918742
public static <T> TicketType<T> a(String s, Comparator<T> comparator) {
return new TicketType<>(s, comparator, 0L);
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index 86e6a11c760b2ec47711bd8327b185ae902c4527..ea89392698cd712844cde6976d60a1c2ba6f1b15 100644
index 7282ac286e4f1333c25a8515275b27b9efb19343..1ceff988080b47352edf9cdf3c4f8e69421765d2 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -207,6 +207,79 @@ public class WorldServer extends World implements GeneratorAccessSeed {
@@ -51,6 +51,7 @@ import net.minecraft.core.IRegistry;
import net.minecraft.core.IRegistryCustom;
import net.minecraft.core.SectionPosition;
import net.minecraft.core.particles.ParticleParam;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.chat.ChatMessage;
import net.minecraft.network.chat.IChatBaseComponent;
import net.minecraft.network.protocol.Packet;
@@ -126,6 +127,7 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.chunk.ChunkSection;
import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.IChunkAccess;
+import net.minecraft.world.level.chunk.storage.RegionFile;
import net.minecraft.world.level.dimension.DimensionManager;
import net.minecraft.world.level.dimension.end.EnderDragonBattle;
import net.minecraft.world.level.levelgen.HeightMap;
@@ -208,6 +210,79 @@ public class WorldServer extends World implements GeneratorAccessSeed {
return this.chunkProvider.getChunkAt(x, z, false);
}
@ -3129,7 +3162,7 @@ index 86e6a11c760b2ec47711bd8327b185ae902c4527..ea89392698cd712844cde6976d60a1c2
// Add env and gen to constructor, WorldData -> WorldDataServer
public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor
@@ -254,6 +327,8 @@ public class WorldServer extends World implements GeneratorAccessSeed {
@@ -255,6 +330,8 @@ public class WorldServer extends World implements GeneratorAccessSeed {
this.dragonBattle = null;
}
this.getServer().addWorld(this.getWorld()); // CraftBukkit
@ -3138,7 +3171,7 @@ index 86e6a11c760b2ec47711bd8327b185ae902c4527..ea89392698cd712844cde6976d60a1c2
}
// CraftBukkit start
@@ -1741,7 +1816,10 @@ public class WorldServer extends World implements GeneratorAccessSeed {
@@ -1742,7 +1819,10 @@ public class WorldServer extends World implements GeneratorAccessSeed {
}
MCUtil.getSpiralOutChunks(spawn, radiusInBlocks >> 4).forEach(pair -> {
@ -3151,7 +3184,7 @@ index 86e6a11c760b2ec47711bd8327b185ae902c4527..ea89392698cd712844cde6976d60a1c2
}
public void removeTicketsForSpawn(int radiusInBlocks, BlockPosition spawn) {
diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java
index 1cfa8a4066baaf86f10e3f709d9b1d60aba4dec5..24184c88f354baa082e2ceb0674a4a1a4e1eb65b 100644
index 6a00d53e01f5f169a5e9d58ba6bd3fb067722c63..12d98c82b93658d1246bfe267bbfc87d3a56bbaa 100644
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
@@ -728,6 +728,13 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -3182,10 +3215,20 @@ index e5641f2b41d89a57285fc072a48b951aa03a14a7..ca23ca14d8011fc8daa7e20f2eaa550a
;
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java
index aa1d948e6aebef25f0f4c4c07f5131d2e8387e59..6f3f968b30fdc210e47cb8d99139173869df1638 100644
index aa1d948e6aebef25f0f4c4c07f5131d2e8387e59..04b01cb841dc4f34ded5aaa4ea7a8e6d4b470183 100644
--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java
+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java
@@ -36,8 +36,16 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
@@ -22,7 +22,9 @@ import java.util.stream.Stream;
import net.minecraft.SystemUtils;
import net.minecraft.core.BlockPosition;
import net.minecraft.core.SectionPosition;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.level.LightEngineGraphSection;
+import net.minecraft.server.level.WorldServer;
import net.minecraft.util.datafix.DataFixTypes;
import net.minecraft.world.level.ChunkCoordIntPair;
import net.minecraft.world.level.IWorldReader;
@@ -36,8 +38,16 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
private final VillagePlace.a a = new VillagePlace.a();
private final LongSet b = new LongOpenHashSet();
@ -3202,7 +3245,7 @@ index aa1d948e6aebef25f0f4c4c07f5131d2e8387e59..6f3f968b30fdc210e47cb8d991391738
}
public void a(BlockPosition blockposition, VillagePlaceType villageplacetype) {
@@ -155,7 +163,23 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
@@ -155,7 +165,23 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
@Override
public void a(BooleanSupplier booleansupplier) {
@ -3227,7 +3270,7 @@ index aa1d948e6aebef25f0f4c4c07f5131d2e8387e59..6f3f968b30fdc210e47cb8d991391738
this.a.a();
}
@@ -255,6 +279,35 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
@@ -255,6 +281,35 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
}
}
@ -3604,7 +3647,7 @@ index 2853f9e06064a5c0fe2b0e5df75223d1275eae20..42dc430d948dbab38ad1a1788aaff840
nbttagcompound1.set("PostProcessing", a(ichunkaccess.l()));
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java
index d785f44cd503d4d91589f3fc4bc8dc805dff3d41..65c2bbeb4d77b9accbfa0e26504fdec3f581fa6a 100644
index d785f44cd503d4d91589f3fc4bc8dc805dff3d41..01ae13385dd0208c9f34da8b3897b571f86305d0 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java
@@ -3,6 +3,10 @@ package net.minecraft.world.level.chunk.storage;
@ -3630,7 +3673,7 @@ index d785f44cd503d4d91589f3fc4bc8dc805dff3d41..65c2bbeb4d77b9accbfa0e26504fdec3
+ private volatile PersistentStructureLegacy c; // Paper - async chunk loading
+
+ private final Object persistentDataLock = new Object(); // Paper
+ protected final RegionFileCache regionFileCache;
+ public final RegionFileCache regionFileCache;
public IChunkLoader(File file, DataFixer datafixer, boolean flag) {
+ this.regionFileCache = new RegionFileCache(file, flag); // Paper - nuke IOWorker
@ -3716,10 +3759,10 @@ index d785f44cd503d4d91589f3fc4bc8dc805dff3d41..65c2bbeb4d77b9accbfa0e26504fdec3
}
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
index 299806b73e44a7128e829b35cc2b017a321d7926..1b9836672a82ee3bb8f8df96f7b4d5d493fb9e95 100644
index 39d3a71f3945b1c97df35e28d1011b9d42b162f5..4999ba61fb04713ffe3d23c556f732dc4abbf0bc 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
@@ -41,6 +41,8 @@ public class RegionFile implements AutoCloseable {
@@ -44,6 +44,8 @@ public class RegionFile implements AutoCloseable {
protected final RegionFileBitSet freeSectors;
public final File file; // Paper
@ -3728,7 +3771,7 @@ index 299806b73e44a7128e829b35cc2b017a321d7926..1b9836672a82ee3bb8f8df96f7b4d5d4
// Paper start - Cache chunk status
private final ChunkStatus[] statuses = new ChunkStatus[32 * 32];
@@ -247,7 +249,7 @@ public class RegionFile implements AutoCloseable {
@@ -250,7 +252,7 @@ public class RegionFile implements AutoCloseable {
return (i + 4096 - 1) / 4096;
}
@ -3737,7 +3780,7 @@ index 299806b73e44a7128e829b35cc2b017a321d7926..1b9836672a82ee3bb8f8df96f7b4d5d4
int i = this.getOffset(chunkcoordintpair);
if (i == 0) {
@@ -407,6 +409,11 @@ public class RegionFile implements AutoCloseable {
@@ -410,6 +412,11 @@ public class RegionFile implements AutoCloseable {
}
public void close() throws IOException {
@ -3749,7 +3792,7 @@ index 299806b73e44a7128e829b35cc2b017a321d7926..1b9836672a82ee3bb8f8df96f7b4d5d4
this.closed = true; // Paper
try {
this.d();
@@ -417,6 +424,10 @@ public class RegionFile implements AutoCloseable {
@@ -420,6 +427,10 @@ public class RegionFile implements AutoCloseable {
this.dataFile.close();
}
}
@ -3761,10 +3804,10 @@ index 299806b73e44a7128e829b35cc2b017a321d7926..1b9836672a82ee3bb8f8df96f7b4d5d4
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java
index 8ceebe1f5ca8821228faf65e1d26fa205ec1e56c..53500c2643279fdae73c4cfce2a0d7fb684366df 100644
index 55e7e983d2c760a8052d7b3ddbdc8447f619a60f..ebb0d6988f87013ea5d523ab4a1b31cb669ccc43 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java
@@ -14,7 +14,7 @@ import net.minecraft.nbt.NBTTagCompound;
@@ -17,7 +17,7 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ExceptionSuppressor;
import net.minecraft.world.level.ChunkCoordIntPair;
@ -3773,7 +3816,7 @@ index 8ceebe1f5ca8821228faf65e1d26fa205ec1e56c..53500c2643279fdae73c4cfce2a0d7fb
public final Long2ObjectLinkedOpenHashMap<RegionFile> cache = new Long2ObjectLinkedOpenHashMap();
private final File b;
@@ -27,16 +27,27 @@ public final class RegionFileCache implements AutoCloseable {
@@ -30,16 +30,27 @@ public final class RegionFileCache implements AutoCloseable {
// Paper start
@ -3803,7 +3846,7 @@ index 8ceebe1f5ca8821228faf65e1d26fa205ec1e56c..53500c2643279fdae73c4cfce2a0d7fb
return regionfile;
} else {
if (this.cache.size() >= com.destroystokyo.paper.PaperConfig.regionFileCacheSize) { // Paper - configurable
@@ -52,6 +63,12 @@ public final class RegionFileCache implements AutoCloseable {
@@ -55,6 +66,12 @@ public final class RegionFileCache implements AutoCloseable {
RegionFile regionfile1 = new RegionFile(file, this.b, this.c);
this.cache.putAndMoveToFirst(i, regionfile1);
@ -3816,7 +3859,7 @@ index 8ceebe1f5ca8821228faf65e1d26fa205ec1e56c..53500c2643279fdae73c4cfce2a0d7fb
return regionfile1;
}
}
@@ -127,11 +144,12 @@ public final class RegionFileCache implements AutoCloseable {
@@ -130,11 +147,12 @@ public final class RegionFileCache implements AutoCloseable {
@Nullable
public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException {
// CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
@ -3830,7 +3873,7 @@ index 8ceebe1f5ca8821228faf65e1d26fa205ec1e56c..53500c2643279fdae73c4cfce2a0d7fb
DataInputStream datainputstream = regionfile.a(chunkcoordintpair);
// Paper start
if (regionfile.isOversized(chunkcoordintpair.x, chunkcoordintpair.z)) {
@@ -169,10 +187,14 @@ public final class RegionFileCache implements AutoCloseable {
@@ -172,10 +190,14 @@ public final class RegionFileCache implements AutoCloseable {
}
return nbttagcompound;
@ -3846,7 +3889,7 @@ index 8ceebe1f5ca8821228faf65e1d26fa205ec1e56c..53500c2643279fdae73c4cfce2a0d7fb
int attempts = 0; Exception laste = null; while (attempts++ < 5) { try { // Paper
DataOutputStream dataoutputstream = regionfile.c(chunkcoordintpair);
Throwable throwable = null;
@@ -211,9 +233,12 @@ public final class RegionFileCache implements AutoCloseable {
@@ -214,9 +236,12 @@ public final class RegionFileCache implements AutoCloseable {
MinecraftServer.LOGGER.error("Failed to save chunk", laste);
}
// Paper end
@ -3860,7 +3903,7 @@ index 8ceebe1f5ca8821228faf65e1d26fa205ec1e56c..53500c2643279fdae73c4cfce2a0d7fb
ExceptionSuppressor<IOException> exceptionsuppressor = new ExceptionSuppressor<>();
ObjectIterator objectiterator = this.cache.values().iterator();
@@ -240,4 +265,12 @@ public final class RegionFileCache implements AutoCloseable {
@@ -243,4 +268,12 @@ public final class RegionFileCache implements AutoCloseable {
}
}
@ -3874,7 +3917,7 @@ index 8ceebe1f5ca8821228faf65e1d26fa205ec1e56c..53500c2643279fdae73c4cfce2a0d7fb
+ // CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSection.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSection.java
index 8ad97a8a2189553da88810380b1c240079eacc93..40cf6af57c9fad294dd502f797d23e6d908087c2 100644
index 8ad97a8a2189553da88810380b1c240079eacc93..d3b9a9e4695655860c72db5f2188472681e8d37a 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSection.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSection.java
@@ -30,28 +30,29 @@ import net.minecraft.world.level.World;
@ -3889,7 +3932,7 @@ index 8ad97a8a2189553da88810380b1c240079eacc93..40cf6af57c9fad294dd502f797d23e6d
+ // Paper - nuke IOWorker
private final Long2ObjectMap<Optional<R>> c = new Long2ObjectOpenHashMap();
- private final LongLinkedOpenHashSet d = new LongLinkedOpenHashSet();
+ protected final LongLinkedOpenHashSet d = new LongLinkedOpenHashSet(); // Paper - private -> protected
+ public final LongLinkedOpenHashSet d = new LongLinkedOpenHashSet(); // Paper - private -> public
private final Function<Runnable, Codec<R>> e;
private final Function<Runnable, R> f;
private final DataFixer g;

View File

@ -8,10 +8,10 @@ ticket level 33 (yes getChunkIfLoaded will actually perform a chunk
load in that case).
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index ea89392698cd712844cde6976d60a1c2ba6f1b15..cc24b2fa12ba998fa7c41376ec442c05eb754375 100644
index 1ceff988080b47352edf9cdf3c4f8e69421765d2..a67462e10c6f8cb0eecb9a81fdc55f353c258368 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -204,7 +204,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
@@ -207,7 +207,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
}
@Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
@ -21,7 +21,7 @@ index ea89392698cd712844cde6976d60a1c2ba6f1b15..cc24b2fa12ba998fa7c41376ec442c05
// Paper start - Asynchronous IO
diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java
index 24184c88f354baa082e2ceb0674a4a1a4e1eb65b..0ac3df7c0b9f49a7bb4dfcf97df74e9caeddc1f7 100644
index 12d98c82b93658d1246bfe267bbfc87d3a56bbaa..bae1fb41b1559373f73d4ed3ba145d81a71cabeb 100644
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
@@ -1242,7 +1242,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -34,10 +34,10 @@ index 24184c88f354baa082e2ceb0674a4a1a4e1eb65b..0ac3df7c0b9f49a7bb4dfcf97df74e9c
return;
}
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
index 81f657084afdfcace67a2245230b0cb91dd919bd..dbe1de86ea8d638f90adaf8ff78a34c2e95d0691 100644
index 15da3511a9e57c320f4cf409852bee07109095bc..b620d7e0d824c8d0758a66a8fbe872c3e45103d2 100644
--- a/src/main/java/net/minecraft/world/level/World.java
+++ b/src/main/java/net/minecraft/world/level/World.java
@@ -156,6 +156,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -164,6 +164,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
return (CraftServer) Bukkit.getServer();
}
@ -51,7 +51,7 @@ index 81f657084afdfcace67a2245230b0cb91dd919bd..dbe1de86ea8d638f90adaf8ff78a34c2
public ResourceKey<DimensionManager> getTypeKey() {
return typeKey;
}
@@ -1054,14 +1061,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -1062,14 +1069,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
}
public boolean p(BlockPosition blockposition) {
@ -68,7 +68,7 @@ index 81f657084afdfcace67a2245230b0cb91dd919bd..dbe1de86ea8d638f90adaf8ff78a34c2
return ichunkaccess == null ? false : ichunkaccess.getType(blockposition).a((IBlockAccess) this, blockposition, entity, enumdirection);
}
@@ -1182,7 +1189,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -1190,7 +1197,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
for (int i1 = i; i1 < j; ++i1) {
for (int j1 = k; j1 < l; ++j1) {

View File

@ -105,10 +105,10 @@ index f657e9b6bb3d24a6c77ef584711a003d1eea0341..eb1e86e8bb0f421e3686ffa02a4015a5
if (args.length < 2 || args[1].equals("*")) {
diff --git a/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
new file mode 100644
index 0000000000000000000000000000000000000000..1a68a8012f83bab9e814159c76b8c3710c7b1112
index 0000000000000000000000000000000000000000..d381f91cf105bfc01846ada90da8971a3618e784
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
@@ -0,0 +1,172 @@
@@ -0,0 +1,171 @@
+package com.destroystokyo.paper.io;
+
+import com.google.gson.JsonArray;
@ -116,14 +116,13 @@ index 0000000000000000000000000000000000000000..1a68a8012f83bab9e814159c76b8c371
+import com.mojang.datafixers.util.Pair;
+import it.unimi.dsi.fastutil.longs.Long2IntMap;
+import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap;
+import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
+import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
+import net.minecraft.server.World;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+import net.minecraft.world.level.World;
+
+public class SyncLoadFinder {
+
@ -282,10 +281,10 @@ index 0000000000000000000000000000000000000000..1a68a8012f83bab9e814159c76b8c371
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
index 32ef8b2e52b47c2fdeb13d00df5107fa7c3b540e..3d3c58cef3a92355caa6dad7053d129f2e8e0732 100644
index df71f8c42ac488153257614b58202bb5d7083251..2530c5ddfc8469329b411ad5c98ed718a3771890 100644
--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
@@ -493,6 +493,7 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -494,6 +494,7 @@ public class ChunkProviderServer extends IChunkProvider {
this.world.asyncChunkTaskManager.raisePriority(x, z, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY);
com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.world, x, z);
// Paper end
@ -294,10 +293,10 @@ index 32ef8b2e52b47c2fdeb13d00df5107fa7c3b540e..3d3c58cef3a92355caa6dad7053d129f
this.serverThreadQueue.awaitTasks(completablefuture::isDone);
com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index cc24b2fa12ba998fa7c41376ec442c05eb754375..04cbcb6a872c0b595a691f705131100341e0ec63 100644
index a67462e10c6f8cb0eecb9a81fdc55f353c258368..23f88bd794b2c738463e1aa1180b6826d33f3b77 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -279,6 +279,12 @@ public class WorldServer extends World implements GeneratorAccessSeed {
@@ -282,6 +282,12 @@ public class WorldServer extends World implements GeneratorAccessSeed {
};
public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager;
// Paper end
@ -311,10 +310,10 @@ index cc24b2fa12ba998fa7c41376ec442c05eb754375..04cbcb6a872c0b595a691f7051311003
// Add env and gen to constructor, WorldData -> WorldDataServer
public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
index dbe1de86ea8d638f90adaf8ff78a34c2e95d0691..3c66c1920119fdf6208e0d545f6b8bbd4e5d9a6d 100644
index b620d7e0d824c8d0758a66a8fbe872c3e45103d2..6781b25cc8e15be2556bb1bb8dc8c18c106b40ec 100644
--- a/src/main/java/net/minecraft/world/level/World.java
+++ b/src/main/java/net/minecraft/world/level/World.java
@@ -1122,7 +1122,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -1130,7 +1130,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
for (int i1 = i; i1 <= j; ++i1) {
for (int j1 = k; j1 <= l; ++j1) {
@ -323,7 +322,7 @@ index dbe1de86ea8d638f90adaf8ff78a34c2e95d0691..3c66c1920119fdf6208e0d545f6b8bbd
if (chunk != null) {
chunk.a(entity, axisalignedbb, list, predicate);
@@ -1143,7 +1143,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -1151,7 +1151,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
for (int i1 = i; i1 < j; ++i1) {
for (int j1 = k; j1 < l; ++j1) {
@ -332,7 +331,7 @@ index dbe1de86ea8d638f90adaf8ff78a34c2e95d0691..3c66c1920119fdf6208e0d545f6b8bbd
if (chunk != null) {
chunk.a(entitytypes, axisalignedbb, list, predicate);
@@ -1166,7 +1166,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -1174,7 +1174,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
for (int i1 = i; i1 < j; ++i1) {
for (int j1 = k; j1 < l; ++j1) {

View File

@ -7,10 +7,10 @@ The problem was we were checking isExpired() on the entry, but if it
was expired at that point, then it would be null.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 85bb7fc6d4b65ffb2923d5a6776ebe7a89605024..7386c30b4455deb4e8916bb721e9505ad0aded15 100644
index ae0aaaf129c44901ac72c67e50c663333ab57f9d..f1dd51f30a40613a1fa1e00be43d21684ea9c274 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -605,8 +605,10 @@ public abstract class PlayerList {
@@ -607,8 +607,10 @@ public abstract class PlayerList {
Player player = entity.getBukkitEntity();
PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.networkManager.getRawAddress()).getAddress());

View File

@ -5,7 +5,7 @@ Subject: [PATCH] implement optional per player mob spawns
diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
index a27dc38d1a29ed1d63d2f44b7984c2b65be487d9..96aaaab5b7685c874463505f9d25e8a0a01a6e7c 100644
index 2da28784ee427001b1137c859f0b4c350abd3110..c5f594d45012016d99b83a778a2b9d20a7c086ac 100644
--- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java
+++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
@@ -57,6 +57,7 @@ public class WorldTimingsHandler {
@ -40,23 +40,22 @@ index b913cd2dd0cd1b369b3f7b5a9d8b1be73f6d7920..6aec502eb529d4090306e12e837117cd
}
diff --git a/src/main/java/com/destroystokyo/paper/util/PlayerMobDistanceMap.java b/src/main/java/com/destroystokyo/paper/util/PlayerMobDistanceMap.java
new file mode 100644
index 0000000000000000000000000000000000000000..9ebd7ecb7a0ac73ccacf34c097056598bb5d26e8
index 0000000000000000000000000000000000000000..6124b54d99adbb2a5bb9bb09dfd02522a67ab3ba
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/PlayerMobDistanceMap.java
@@ -0,0 +1,253 @@
@@ -0,0 +1,252 @@
+package com.destroystokyo.paper.util;
+
+import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
+import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
+import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet;
+import net.minecraft.server.ChunkCoordIntPair;
+import net.minecraft.server.EntityPlayer;
+import net.minecraft.server.SectionPosition;
+import org.spigotmc.AsyncCatcher;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import net.minecraft.core.SectionPosition;
+import net.minecraft.server.level.EntityPlayer;
+import net.minecraft.world.level.ChunkCoordIntPair;
+import org.spigotmc.AsyncCatcher;
+import java.util.HashMap;
+
+/** @author Spottedleaf */
+public final class PlayerMobDistanceMap {
@ -545,10 +544,10 @@ index 0000000000000000000000000000000000000000..4f13d3ff8391793a99f067189f854078
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
index 3d3c58cef3a92355caa6dad7053d129f2e8e0732..a20c1df6d0cc7b869bcd4094c1627a16c33604d7 100644
index 2530c5ddfc8469329b411ad5c98ed718a3771890..4998fad49755c08e20ebfb1dc97b558e1cf10b50 100644
--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java
@@ -766,7 +766,22 @@ public class ChunkProviderServer extends IChunkProvider {
@@ -767,7 +767,22 @@ public class ChunkProviderServer extends IChunkProvider {
this.world.getMethodProfiler().enter("naturalSpawnCount");
this.world.timings.countNaturalMobs.startTiming(); // Paper - timings
int l = this.chunkMapDistance.b();
@ -573,10 +572,18 @@ index 3d3c58cef3a92355caa6dad7053d129f2e8e0732..a20c1df6d0cc7b869bcd4094c1627a16
this.p = spawnercreature_d;
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
index 689063b7f1e57d691f130ddb399177566edcad2e..4a03432a644763dc3a56788e69ee2580a9e15254 100644
index 3105ec935e6fb2cf36b95e63dc9dc09dbfb45029..d66956b879ad7b05ea2a0252ca14b2d06dba135c 100644
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
@@ -218,6 +218,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -94,6 +94,7 @@ import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityInsentient;
import net.minecraft.world.entity.EntityLiving;
+import net.minecraft.world.entity.EnumCreatureType;
import net.minecraft.world.entity.EnumMainHand;
import net.minecraft.world.entity.IEntityAngerable;
import net.minecraft.world.entity.animal.horse.EntityHorseAbstract;
@@ -218,6 +219,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public boolean queueHealthUpdatePacket = false;
public net.minecraft.network.protocol.game.PacketPlayOutUpdateHealth queuedHealthUpdatePacket;
// Paper end
@ -588,7 +595,7 @@ index 689063b7f1e57d691f130ddb399177566edcad2e..4a03432a644763dc3a56788e69ee2580
// CraftBukkit start
public String displayName;
@@ -256,6 +261,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -256,6 +262,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.adventure$displayName = net.kyori.adventure.text.Component.text(this.getName()); // Paper
this.canPickUpLoot = true;
this.maxHealthCache = this.getMaxHealth();
@ -596,7 +603,7 @@ index 689063b7f1e57d691f130ddb399177566edcad2e..4a03432a644763dc3a56788e69ee2580
}
// Yes, this doesn't match Vanilla, but it's the best we can do for now.
@@ -2051,6 +2057,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -2051,6 +2058,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
@ -605,10 +612,18 @@ index 689063b7f1e57d691f130ddb399177566edcad2e..4a03432a644763dc3a56788e69ee2580
return this.cj;
}
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
index a9c970f6a3227c37e55549488ab9bdadf833b0c1..207c8343815991c687c411cb374081fb485dd0b7 100644
index a6c3bed5824d112042536a5666098d4d80173c3b..9c5b1dd305567f09a23a3f189d4dadba323b643e 100644
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
@@ -126,7 +126,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -72,6 +72,7 @@ import net.minecraft.util.thread.ThreadedMailbox;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityInsentient;
import net.minecraft.world.entity.EntityTypes;
+import net.minecraft.world.entity.EnumCreatureType;
import net.minecraft.world.entity.ai.village.poi.VillagePlace;
import net.minecraft.world.entity.boss.EntityComplexPart;
import net.minecraft.world.entity.player.EntityHuman;
@@ -129,7 +130,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
public final Int2ObjectMap<PlayerChunkMap.EntityTracker> trackedEntities;
private final Long2ByteMap z;
private final Queue<Runnable> A; private final Queue<Runnable> getUnloadQueueTasks() { return this.A; } // Paper - OBFHELPER
@ -618,7 +633,7 @@ index a9c970f6a3227c37e55549488ab9bdadf833b0c1..207c8343815991c687c411cb374081fb
// CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback()
public final CallbackExecutor callbackExecutor = new CallbackExecutor();
@@ -205,6 +206,24 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -208,6 +210,24 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
this.l = supplier;
this.m = new VillagePlace(new File(this.w, "poi"), datafixer, flag, this.world); // Paper
this.setViewDistance(i);
@ -644,10 +659,10 @@ index a9c970f6a3227c37e55549488ab9bdadf833b0c1..207c8343815991c687c411cb374081fb
private static double a(ChunkCoordIntPair chunkcoordintpair, Entity entity) {
diff --git a/src/main/java/net/minecraft/world/entity/EntityTypes.java b/src/main/java/net/minecraft/world/entity/EntityTypes.java
index 8ba75c847efa0633e7b8cb718e3a9b55e0b8ad77..82f42f73b9696220be6d8003ec8c108a4ba3f082 100644
index 1355c074353611669c947cb0f06c67be0ab418aa..9d2955f05aadd4bbc6dcfec068a55d7fe6950ba0 100644
--- a/src/main/java/net/minecraft/world/entity/EntityTypes.java
+++ b/src/main/java/net/minecraft/world/entity/EntityTypes.java
@@ -425,6 +425,7 @@ public class EntityTypes<T extends Entity> {
@@ -426,6 +426,7 @@ public class EntityTypes<T extends Entity> {
return this.bl;
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent consuming the wrong itemstack
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
index 8a0d125bc1cf3a75141a286f0c9fb553827e556f..f0feb60b95eed9e7445bb37f60231ae1ac108963 100644
index ecceb272028e1ae1dd40c0c39d6f687fccfabb58..903c3cfdaae3dd1750aa2f32f6cdbb423909eb47 100644
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
@@ -3200,10 +3200,13 @@ public abstract class EntityLiving extends Entity {
@@ -3201,10 +3201,13 @@ public abstract class EntityLiving extends Entity {
this.datawatcher.set(EntityLiving.ag, (byte) j);
}
@ -24,7 +24,7 @@ index 8a0d125bc1cf3a75141a286f0c9fb553827e556f..f0feb60b95eed9e7445bb37f60231ae1
this.activeItem = itemstack;
this.bd = itemstack.k();
if (!this.world.isClientSide) {
@@ -3281,6 +3284,7 @@ public abstract class EntityLiving extends Entity {
@@ -3282,6 +3285,7 @@ public abstract class EntityLiving extends Entity {
this.releaseActiveItem();
} else {
if (!this.activeItem.isEmpty() && this.isHandRaised()) {
@ -32,7 +32,7 @@ index 8a0d125bc1cf3a75141a286f0c9fb553827e556f..f0feb60b95eed9e7445bb37f60231ae1
this.b(this.activeItem, 16);
// CraftBukkit start - fire PlayerItemConsumeEvent
ItemStack itemstack;
@@ -3315,8 +3319,8 @@ public abstract class EntityLiving extends Entity {
@@ -3316,8 +3320,8 @@ public abstract class EntityLiving extends Entity {
}
this.clearActiveItem();

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix stuck in sneak when changing worlds (MC-10657)
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
index 4a03432a644763dc3a56788e69ee2580a9e15254..77f1a2a5b1c172c5bc991d27aaa3e19a53de72c0 100644
index d66956b879ad7b05ea2a0252ca14b2d06dba135c..4ab293c49eba44ee3533b07866c5bdd68b1e849b 100644
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
@@ -1071,6 +1071,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -1072,6 +1072,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.lastHealthSent = -1.0F;
this.lastFoodSent = -1;
@ -18,10 +18,10 @@ index 4a03432a644763dc3a56788e69ee2580a9e15254..77f1a2a5b1c172c5bc991d27aaa3e19a
PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld());
this.world.getServer().getPluginManager().callEvent(changeEvent);
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 7386c30b4455deb4e8916bb721e9505ad0aded15..0c51f90c103600be8881f204bdd18fb12e0ef11c 100644
index f1dd51f30a40613a1fa1e00be43d21684ea9c274..1f74fddfc6d9d9ae38fd35f83fa668e38591b222 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -844,6 +844,8 @@ public abstract class PlayerList {
@@ -846,6 +846,8 @@ public abstract class PlayerList {
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobEffect));
}

View File

@ -7,7 +7,7 @@ Fixes an AssertionError when setting the player's item in hand to null or a new
Fixes GH-2718
diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java
index 0ac3df7c0b9f49a7bb4dfcf97df74e9caeddc1f7..fef5b401a168c5b2be26c834e03b014d6231daf9 100644
index bae1fb41b1559373f73d4ed3ba145d81a71cabeb..28106cc6acbdcd026c646c030491d74049306861 100644
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
@@ -1705,6 +1705,10 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -22,10 +22,10 @@ index 0ac3df7c0b9f49a7bb4dfcf97df74e9caeddc1f7..fef5b401a168c5b2be26c834e03b014d
if (enuminteractionresult.b()) {
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
index f0feb60b95eed9e7445bb37f60231ae1ac108963..1102659557ea9f0ab4fe6225cbf1dc1006661caf 100644
index 903c3cfdaae3dd1750aa2f32f6cdbb423909eb47..58cf4bb4c6267c4d8d71bbd29ed34575eb93aed3 100644
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
@@ -2155,6 +2155,7 @@ public abstract class EntityLiving extends Entity {
@@ -2156,6 +2156,7 @@ public abstract class EntityLiving extends Entity {
return predicate.test(this.getItemInMainHand().getItem()) || predicate.test(this.getItemInOffHand().getItem());
}

View File

@ -63,10 +63,10 @@ index 5da20483ed352ac6d9695287f840ed643a2bf302..8a2ff2ef17aba806a63be3aaebfa779d
itemstack.d(this.D());
if (this.tag != null) {
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
index 3c66c1920119fdf6208e0d545f6b8bbd4e5d9a6d..03d521444178aa6d3291f4177cdca993c8a251fc 100644
index 6781b25cc8e15be2556bb1bb8dc8c18c106b40ec..d1738b57efd3f5e6c51603553a773173e4b09bb5 100644
--- a/src/main/java/net/minecraft/world/level/World.java
+++ b/src/main/java/net/minecraft/world/level/World.java
@@ -1154,8 +1154,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -1162,8 +1162,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
return list;
}
@ -78,10 +78,18 @@ index 3c66c1920119fdf6208e0d545f6b8bbd4e5d9a6d..03d521444178aa6d3291f4177cdca993
int i = MathHelper.floor((axisalignedbb.minX - 2.0D) / 16.0D);
int j = MathHelper.f((axisalignedbb.maxX + 2.0D) / 16.0D);
diff --git a/src/main/java/net/minecraft/world/level/block/entity/IHopper.java b/src/main/java/net/minecraft/world/level/block/entity/IHopper.java
index d0943ae1f372784716195666212ff83e6ee4873e..885ca0a12d3514212bd03392c7da6891efc05b0b 100644
index d0943ae1f372784716195666212ff83e6ee4873e..1db7b7bfe98658d0b20800a4178556f8daaf881a 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/IHopper.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/IHopper.java
@@ -17,12 +17,13 @@ public interface IHopper extends IInventory {
@@ -1,6 +1,7 @@
package net.minecraft.world.level.block.entity;
import javax.annotation.Nullable;
+import net.minecraft.core.BlockPosition;
import net.minecraft.world.IInventory;
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.Block;
@@ -17,12 +18,13 @@ public interface IHopper extends IInventory {
return IHopper.c;
}
@ -100,10 +108,10 @@ index d0943ae1f372784716195666212ff83e6ee4873e..885ca0a12d3514212bd03392c7da6891
+ double A(); default double getZ() { return this.A(); } // Paper - OBFHELPER
}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
index 642ed6e5788a79f7bc7d6185564bdf0df07e492c..a497d23de7ff0dba9e0ac10a63e77fc514599d51 100644
index 3ff9e389fcf15044c2740fb884c9438428d7a681..9088fd324207f2abc9ba04cf510b519f4fbb8cc9 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
@@ -76,6 +76,7 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
@@ -77,6 +77,7 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
public void setCurrentChunk(Chunk chunk) {
this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null;
}
@ -111,7 +119,7 @@ index 642ed6e5788a79f7bc7d6185564bdf0df07e492c..a497d23de7ff0dba9e0ac10a63e77fc5
// Paper end
@Nullable
@@ -154,6 +155,7 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
@@ -155,6 +156,7 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
public void update() {
if (this.world != null) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] PlayerDeathEvent#shouldDropExperience
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
index 77f1a2a5b1c172c5bc991d27aaa3e19a53de72c0..a3195ab0c447d5532642b430411434abaa168306 100644
index 4ab293c49eba44ee3533b07866c5bdd68b1e849b..3b3c0b32f4f7b3d97ffc63cc5a9878f96a32712e 100644
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
@@ -820,7 +820,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -821,7 +821,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.eW();
}
// SPIGOT-5478 must be called manually now

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Optimise IEntityAccess#getPlayerByUUID
Use the world entity map instead of iterating over all players
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index 04cbcb6a872c0b595a691f705131100341e0ec63..7eec1b181ed99e78cfd43a6f48327133fdfbeee7 100644
index 23f88bd794b2c738463e1aa1180b6826d33f3b77..f11617dc37771f65d574cd14ae9cea09103d11e1 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -286,6 +286,15 @@ public class WorldServer extends World implements GeneratorAccessSeed {
@@ -289,6 +289,15 @@ public class WorldServer extends World implements GeneratorAccessSeed {
}
// Paper end

View File

@ -7,10 +7,10 @@ When the server is lagging, players will wait longer when eating.
Change to also use a time check instead if it passes.
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
index 1102659557ea9f0ab4fe6225cbf1dc1006661caf..e1d8217e48e7c5e7870e46f43074c79efc298ccc 100644
index 58cf4bb4c6267c4d8d71bbd29ed34575eb93aed3..00f94e94aa302e24d286164ae829c935d2bcce95 100644
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
@@ -213,7 +213,7 @@ public abstract class EntityLiving extends Entity {
@@ -214,7 +214,7 @@ public abstract class EntityLiving extends Entity {
private int jumpTicks;
private float bw;
public ItemStack activeItem; // Paper - public
@ -19,7 +19,7 @@ index 1102659557ea9f0ab4fe6225cbf1dc1006661caf..e1d8217e48e7c5e7870e46f43074c79e
protected int be;
private BlockPosition bx;
private Optional<BlockPosition> by;
@@ -3150,6 +3150,11 @@ public abstract class EntityLiving extends Entity {
@@ -3151,6 +3151,11 @@ public abstract class EntityLiving extends Entity {
return ((Byte) this.datawatcher.get(EntityLiving.ag) & 2) > 0 ? EnumHand.OFF_HAND : EnumHand.MAIN_HAND;
}
@ -31,7 +31,7 @@ index 1102659557ea9f0ab4fe6225cbf1dc1006661caf..e1d8217e48e7c5e7870e46f43074c79e
private void t() {
if (this.isHandRaised()) {
if (ItemStack.d(this.b(this.getRaisedHand()), this.activeItem)) {
@@ -3159,7 +3164,12 @@ public abstract class EntityLiving extends Entity {
@@ -3160,7 +3165,12 @@ public abstract class EntityLiving extends Entity {
this.b(this.activeItem, 5);
}
@ -45,7 +45,7 @@ index 1102659557ea9f0ab4fe6225cbf1dc1006661caf..e1d8217e48e7c5e7870e46f43074c79e
this.s();
}
} else {
@@ -3209,7 +3219,10 @@ public abstract class EntityLiving extends Entity {
@@ -3210,7 +3220,10 @@ public abstract class EntityLiving extends Entity {
if (!itemstack.isEmpty() && !this.isHandRaised() || forceUpdate) { // Paper use override flag
this.activeItem = itemstack;
@ -57,7 +57,7 @@ index 1102659557ea9f0ab4fe6225cbf1dc1006661caf..e1d8217e48e7c5e7870e46f43074c79e
if (!this.world.isClientSide) {
this.c(1, true);
this.c(2, enumhand == EnumHand.OFF_HAND);
@@ -3233,7 +3246,10 @@ public abstract class EntityLiving extends Entity {
@@ -3234,7 +3247,10 @@ public abstract class EntityLiving extends Entity {
}
} else if (!this.isHandRaised() && !this.activeItem.isEmpty()) {
this.activeItem = ItemStack.b;
@ -69,7 +69,7 @@ index 1102659557ea9f0ab4fe6225cbf1dc1006661caf..e1d8217e48e7c5e7870e46f43074c79e
}
}
@@ -3361,7 +3377,10 @@ public abstract class EntityLiving extends Entity {
@@ -3362,7 +3378,10 @@ public abstract class EntityLiving extends Entity {
}
this.activeItem = ItemStack.b;

Some files were not shown because too many files have changed in this diff Show More