More more more more more more more more more more more more more work

This commit is contained in:
Nassim Jahnke 2021-11-24 16:07:19 +01:00 committed by MiniDigger | Martin
parent 4e81c1fe78
commit 45c36e5d0c
29 changed files with 247 additions and 269 deletions

View File

@ -8,3 +8,4 @@
# To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId: # To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId:
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter # minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java # minecraft net/minecraft/world/level/entity/LevelEntityGetter.java

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add entity liquid API
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 3bb7154a5be37e1943e4f94b5496019c07ca6937..c729cb44290cd719e7684fd919bf74300484b883 100644 index 4ed3486e8ef097837cf6762b618e08fa9ff166a5..b7d3cd271cccbc250914c5bc17ae892ffcf14b57 100644
--- a/src/main/java/org/bukkit/entity/Entity.java --- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -725,5 +725,35 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent @@ -725,5 +725,35 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Allow delegation to vanilla chunk gen
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 474b7a7d14d1b4ef8146c7b23883651ff776e41b..2bcae78ec0016b465b611041b8397fee5a04baaf 100644 index 338f0938fbae7eec6cecaf3f1cd30d3e27ad40d6..dc0ceb725aebcce9d048b53e06d4fa84bb3afbe1 100644
--- a/src/main/java/org/bukkit/Bukkit.java --- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1620,6 +1620,22 @@ public final class Bukkit { @@ -1634,6 +1634,22 @@ public final class Bukkit {
return server.createChunkData(world); return server.createChunkData(world);
} }
@ -32,10 +32,10 @@ index 474b7a7d14d1b4ef8146c7b23883651ff776e41b..2bcae78ec0016b465b611041b8397fee
* Creates a boss bar instance to display to players. The progress * Creates a boss bar instance to display to players. The progress
* defaults to 1.0 * defaults to 1.0
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 4800e1e0f127cc159bcc75c856aee9102462b01a..2a2f009a957c19a6d1ef1e284b27fe2f954f13e0 100644 index 5a98eaeafafc11a7f925701187fc96eb5c675efe..b47eb644b35d27eb5ff65a2ff62e451d23e8026b 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -1371,6 +1371,20 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -1383,6 +1383,20 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@NotNull @NotNull
public ChunkGenerator.ChunkData createChunkData(@NotNull World world); public ChunkGenerator.ChunkData createChunkData(@NotNull World world);

View File

@ -5,11 +5,11 @@ Subject: [PATCH] Allow delegation to vanilla chunk gen
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index da9fc8a99576f13a52ab4830cb09b69b1e406fae..81effb4bc34d3cb4325510c1b0de39956961c427 100644 index b1dfd1b13652807882e057ae4fb55f9a045d1a16..926ecc79744142c1361399afa61719db435638fa 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2198,6 +2198,32 @@ public final class CraftServer implements Server { @@ -2244,6 +2244,32 @@ public final class CraftServer implements Server {
return new OldCraftChunkData(world); return new OldCraftChunkData(world.getMinHeight(), world.getMaxHeight(), handle.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY));
} }
+ // Paper start + // Paper start
@ -42,19 +42,19 @@ index da9fc8a99576f13a52ab4830cb09b69b1e406fae..81effb4bc34d3cb4325510c1b0de3995
public BossBar createBossBar(String title, BarColor color, BarStyle style, BarFlag... flags) { public BossBar createBossBar(String title, BarColor color, BarStyle style, BarFlag... flags) {
return new CraftBossBar(title, color, style, flags); return new CraftBossBar(title, color, style, flags);
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java diff --git a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java
index a48c659c02c6c33a8efdac6daf9c9a0708f05071..932bd3334b5852c8f209678b1444fc0e43a637f0 100644 index 960405935e395a31c0300773c41413801cf0d290..f86a8619862c752ca5d47a2ce4c2d0fab6f0810d 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java --- a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java
@@ -22,7 +22,7 @@ import org.bukkit.material.MaterialData; @@ -23,7 +23,7 @@ import org.bukkit.material.MaterialData;
public final class OldCraftChunkData implements ChunkGenerator.ChunkData { public final class OldCraftChunkData implements ChunkGenerator.ChunkData {
private final int minHeight; private final int minHeight;
private final int maxHeight; private final int maxHeight;
- private final LevelChunkSection[] sections; - private final LevelChunkSection[] sections;
+ private LevelChunkSection[] sections; + private LevelChunkSection[] sections;
private final Registry<net.minecraft.world.level.biome.Biome> biomes;
private Set<BlockPos> tiles; private Set<BlockPos> tiles;
private final Set<BlockPos> lights = new HashSet<>(); private final Set<BlockPos> lights = new HashSet<>();
private World world; // Paper - Anti-Xray - Add parameters @@ -192,4 +192,10 @@ public final class OldCraftChunkData implements ChunkGenerator.ChunkData {
@@ -195,4 +195,10 @@ public final class OldCraftChunkData implements ChunkGenerator.ChunkData {
Set<BlockPos> getLights() { Set<BlockPos> getLights() {
return this.lights; return this.lights;
} }

View File

@ -7,7 +7,7 @@ Inline bit operations and reduce instruction count to make these hot
operations faster operations faster
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
index 80d8873bc2512ecde6a531e974b14e9b48402d64..b70aa66732fb5e957aed0901f4c76358b2c56f8e 100644 index d38049bed6f3dc3198e687686ef4d8938c7a6b59..0dcf75c5c792650d7a5b9354222df16bcd1cfbd2 100644
--- a/src/main/java/net/minecraft/core/BlockPos.java --- a/src/main/java/net/minecraft/core/BlockPos.java
+++ b/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java
@@ -30,15 +30,16 @@ public class BlockPos extends Vec3i { @@ -30,15 +30,16 @@ public class BlockPos extends Vec3i {
@ -76,18 +76,18 @@ index 80d8873bc2512ecde6a531e974b14e9b48402d64..b70aa66732fb5e957aed0901f4c76358
public static long asLong(int x, int y, int z) { public static long asLong(int x, int y, int z) {
- long l = 0L; - long l = 0L;
- l = l | ((long)x & PACKED_X_MASK) << X_OFFSET; - l |= ((long)x & PACKED_X_MASK) << X_OFFSET;
- l = l | ((long)y & PACKED_Y_MASK) << 0; - l |= ((long)y & PACKED_Y_MASK) << 0;
- return l | ((long)z & PACKED_Z_MASK) << Z_OFFSET; - return l | ((long)z & PACKED_Z_MASK) << Z_OFFSET;
+ return (((long) x & (long) 67108863) << 38) | (((long) y & (long) 4095)) | (((long) z & (long) 67108863) << 12); // Paper - inline constants and simplify + return (((long) x & (long) 67108863) << 38) | (((long) y & (long) 4095)) | (((long) z & (long) 67108863) << 12); // Paper - inline constants and simplify
} }
public static long getFlatIndex(long y) { public static long getFlatIndex(long y) {
diff --git a/src/main/java/net/minecraft/core/SectionPos.java b/src/main/java/net/minecraft/core/SectionPos.java diff --git a/src/main/java/net/minecraft/core/SectionPos.java b/src/main/java/net/minecraft/core/SectionPos.java
index 4ea92289304bdad469e67164442bc0b837183e8a..b0c39895e10fab5acc609128d34aafdebc5520f9 100644 index f9a6e9a7403d3fe8726214da981fdc599956f856..51567ca63a0d2748515d002e1f838bbb14afc162 100644
--- a/src/main/java/net/minecraft/core/SectionPos.java --- a/src/main/java/net/minecraft/core/SectionPos.java
+++ b/src/main/java/net/minecraft/core/SectionPos.java +++ b/src/main/java/net/minecraft/core/SectionPos.java
@@ -37,7 +37,7 @@ public class SectionPos extends Vec3i { @@ -38,7 +38,7 @@ public class SectionPos extends Vec3i {
} }
public static SectionPos of(BlockPos pos) { public static SectionPos of(BlockPos pos) {
@ -96,7 +96,7 @@ index 4ea92289304bdad469e67164442bc0b837183e8a..b0c39895e10fab5acc609128d34aafde
} }
public static SectionPos of(ChunkPos chunkPos, int y) { public static SectionPos of(ChunkPos chunkPos, int y) {
@@ -49,7 +49,7 @@ public class SectionPos extends Vec3i { @@ -50,7 +50,7 @@ public class SectionPos extends Vec3i {
} }
public static SectionPos of(long packed) { public static SectionPos of(long packed) {
@ -105,7 +105,7 @@ index 4ea92289304bdad469e67164442bc0b837183e8a..b0c39895e10fab5acc609128d34aafde
} }
public static SectionPos bottomOf(ChunkAccess chunk) { public static SectionPos bottomOf(ChunkAccess chunk) {
@@ -60,8 +60,16 @@ public class SectionPos extends Vec3i { @@ -61,8 +61,16 @@ public class SectionPos extends Vec3i {
return offset(packed, direction.getStepX(), direction.getStepY(), direction.getStepZ()); return offset(packed, direction.getStepX(), direction.getStepY(), direction.getStepZ());
} }
@ -123,7 +123,7 @@ index 4ea92289304bdad469e67164442bc0b837183e8a..b0c39895e10fab5acc609128d34aafde
} }
public static int posToSectionCoord(double coord) { public static int posToSectionCoord(double coord) {
@@ -77,10 +85,7 @@ public class SectionPos extends Vec3i { @@ -78,10 +86,7 @@ public class SectionPos extends Vec3i {
} }
public static short sectionRelativePos(BlockPos pos) { public static short sectionRelativePos(BlockPos pos) {
@ -135,7 +135,7 @@ index 4ea92289304bdad469e67164442bc0b837183e8a..b0c39895e10fab5acc609128d34aafde
} }
public static int sectionRelativeX(short packedLocalPos) { public static int sectionRelativeX(short packedLocalPos) {
@@ -143,16 +148,16 @@ public class SectionPos extends Vec3i { @@ -144,16 +149,16 @@ public class SectionPos extends Vec3i {
return this.getZ(); return this.getZ();
} }
@ -158,7 +158,7 @@ index 4ea92289304bdad469e67164442bc0b837183e8a..b0c39895e10fab5acc609128d34aafde
} }
public int maxBlockX() { public int maxBlockX() {
@@ -168,7 +173,8 @@ public class SectionPos extends Vec3i { @@ -169,7 +174,8 @@ public class SectionPos extends Vec3i {
} }
public static long blockToSection(long blockPos) { public static long blockToSection(long blockPos) {
@ -168,7 +168,7 @@ index 4ea92289304bdad469e67164442bc0b837183e8a..b0c39895e10fab5acc609128d34aafde
} }
public static long getZeroNode(long pos) { public static long getZeroNode(long pos) {
@@ -192,15 +198,18 @@ public class SectionPos extends Vec3i { @@ -193,15 +199,18 @@ public class SectionPos extends Vec3i {
return asLong(blockToSectionCoord(pos.getX()), blockToSectionCoord(pos.getY()), blockToSectionCoord(pos.getZ())); return asLong(blockToSectionCoord(pos.getX()), blockToSectionCoord(pos.getY()), blockToSectionCoord(pos.getZ()));
} }
@ -180,8 +180,8 @@ index 4ea92289304bdad469e67164442bc0b837183e8a..b0c39895e10fab5acc609128d34aafde
+ +
public static long asLong(int x, int y, int z) { public static long asLong(int x, int y, int z) {
- long l = 0L; - long l = 0L;
- l = l | ((long)x & 4194303L) << 42; - l |= ((long)x & 4194303L) << 42;
- l = l | ((long)y & 1048575L) << 0; - l |= ((long)y & 1048575L) << 0;
- return l | ((long)z & 4194303L) << 20; - return l | ((long)z & 4194303L) << 20;
+ return (((long) x & 4194303L) << 42) | (((long) y & 1048575L)) | (((long) z & 4194303L) << 20); // Paper - Simplify to reduce instruction count + return (((long) x & 4194303L) << 42) | (((long) y & 1048575L)) | (((long) z & 4194303L) << 20); // Paper - Simplify to reduce instruction count
} }
@ -192,7 +192,7 @@ index 4ea92289304bdad469e67164442bc0b837183e8a..b0c39895e10fab5acc609128d34aafde
} }
@Override @Override
@@ -213,16 +222,11 @@ public class SectionPos extends Vec3i { @@ -214,16 +223,11 @@ public class SectionPos extends Vec3i {
} }
public static Stream<SectionPos> cube(SectionPos center, int radius) { public static Stream<SectionPos> cube(SectionPos center, int radius) {

View File

@ -22,10 +22,10 @@ wants it to collect even faster, they can restore that setting back to 1 instead
Not adding it to .getType() though to keep behavior consistent with vanilla for performance reasons. Not adding it to .getType() though to keep behavior consistent with vanilla for performance reasons.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index acae4ffc1e97ba54056b7b30679404de6ff54fca..cb08173bdfe52c8a0d5de70f0421cabaa476647a 100644 index 835ff36cfd8c15bf11b3b6a70eb02f6c5b693b8a..b1dfd1b13652807882e057ae4fb55f9a045d1a16 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -369,7 +369,7 @@ public final class CraftServer implements Server { @@ -373,7 +373,7 @@ public final class CraftServer implements Server {
this.ambientSpawn = this.configuration.getInt("spawn-limits.ambient"); this.ambientSpawn = this.configuration.getInt("spawn-limits.ambient");
console.autosavePeriod = this.configuration.getInt("ticks-per.autosave"); console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose")); this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
@ -34,7 +34,7 @@ index acae4ffc1e97ba54056b7b30679404de6ff54fca..cb08173bdfe52c8a0d5de70f0421caba
this.minimumAPI = this.configuration.getString("settings.minimum-api"); this.minimumAPI = this.configuration.getString("settings.minimum-api");
this.loadIcon(); this.loadIcon();
} }
@@ -860,7 +860,7 @@ public final class CraftServer implements Server { @@ -903,7 +903,7 @@ public final class CraftServer implements Server {
this.waterUndergroundCreatureSpawn = this.configuration.getInt("spawn-limits.water-underground-creature"); this.waterUndergroundCreatureSpawn = this.configuration.getInt("spawn-limits.water-underground-creature");
this.ambientSpawn = this.configuration.getInt("spawn-limits.ambient"); this.ambientSpawn = this.configuration.getInt("spawn-limits.ambient");
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose")); this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
@ -44,7 +44,7 @@ index acae4ffc1e97ba54056b7b30679404de6ff54fca..cb08173bdfe52c8a0d5de70f0421caba
this.printSaveWarning = false; this.printSaveWarning = false;
console.autosavePeriod = this.configuration.getInt("ticks-per.autosave"); console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 01ac6e7e7b4b6c61d01684c77ecc2238afcaa8f1..20d956c9a4e3b598ffebbe481a190158566343d9 100644 index c4d5d78064cbef9386c00dc962e0a7889ed73d9d..3bc98586792960f50ca25929f1d91fc60a8577ce 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -264,8 +264,21 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -264,8 +264,21 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@ -113,7 +113,7 @@ index 67ff66e232592203cf8dad605ad01eabc4dded89..f357a3473682c2d37a20fb862522c67b
public void clearCache() { public void clearCache() {
diff --git a/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java b/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java diff --git a/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java b/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java
index ee32aba07aad4a3f101a6a57f7aa6c07f74dd0c3..cc9eb8273d5157fb649d84a3ec589b0b923b5bc9 100644 index 99a758341d4b31cb1703fdce0a257f65ed602ca0..4f7b63f2cc8a69fa8efb3a84f6abc3d3dcf05b49 100644
--- a/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java --- a/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java
+++ b/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java +++ b/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java
@@ -28,7 +28,7 @@ public abstract class LayerLightSectionStorage<M extends DataLayerStorageMap<M>> @@ -28,7 +28,7 @@ public abstract class LayerLightSectionStorage<M extends DataLayerStorageMap<M>>
@ -153,7 +153,7 @@ index ee32aba07aad4a3f101a6a57f7aa6c07f74dd0c3..cc9eb8273d5157fb649d84a3ec589b0b
} }
@Nullable @Nullable
@@ -346,9 +354,11 @@ public abstract class LayerLightSectionStorage<M extends DataLayerStorageMap<M>> @@ -343,9 +351,11 @@ public abstract class LayerLightSectionStorage<M extends DataLayerStorageMap<M>>
protected void swapSectionMap() { protected void swapSectionMap() {
if (!this.changedSections.isEmpty()) { if (!this.changedSections.isEmpty()) {
@ -167,7 +167,7 @@ index ee32aba07aad4a3f101a6a57f7aa6c07f74dd0c3..cc9eb8273d5157fb649d84a3ec589b0b
} }
diff --git a/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java b/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java diff --git a/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java b/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java
index c436ba1f09f6034679dc3dc7af28c00776e165f2..24030bcb3303d0419c7859ded7613608c5f82308 100644 index 1f6ed4309f0f5e06cd2981864feaa6ea16df0350..9797254e981d08d3934f7ca8f369dd78a6ef1a48 100644
--- a/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java --- a/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java
+++ b/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java +++ b/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java
@@ -21,7 +21,7 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec @@ -21,7 +21,7 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec
@ -180,20 +180,20 @@ index c436ba1f09f6034679dc3dc7af28c00776e165f2..24030bcb3303d0419c7859ded7613608
@Override @Override
@@ -32,8 +32,9 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec @@ -32,8 +32,9 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec
protected int getLightValue(long l, boolean bl) { protected int getLightValue(long blockPos, boolean cached) {
long m = SectionPos.blockToSection(l); long l = SectionPos.blockToSection(blockPos);
int i = SectionPos.y(m); int i = SectionPos.y(l);
- SkyLightSectionStorage.SkyDataLayerStorageMap skyDataLayerStorageMap = bl ? this.updatingSectionData : this.visibleSectionData; - SkyLightSectionStorage.SkyDataLayerStorageMap skyDataLayerStorageMap = cached ? this.updatingSectionData : this.visibleSectionData;
- int j = skyDataLayerStorageMap.topSections.get(SectionPos.getZeroNode(m)); - int j = skyDataLayerStorageMap.topSections.get(SectionPos.getZeroNode(l));
+ synchronized (this.visibleUpdateLock) { // Paper - avoid copying light data + synchronized (this.visibleUpdateLock) { // Paper - avoid copying light data
+ SkyLightSectionStorage.SkyDataLayerStorageMap skyDataLayerStorageMap = (SkyLightSectionStorage.SkyDataLayerStorageMap) this.e_visible; // Paper - avoid copying light data - must be after lock acquire + SkyLightSectionStorage.SkyDataLayerStorageMap skyDataLayerStorageMap = (SkyLightSectionStorage.SkyDataLayerStorageMap) this.e_visible; // Paper - avoid copying light data - must be after lock acquire
+ int j = skyDataLayerStorageMap.otherData.getVisibleAsync(SectionPos.getZeroNode(m)); // Paper - avoid copying light data + int j = skyDataLayerStorageMap.otherData.getVisibleAsync(SectionPos.getZeroNode(l)); // Paper - avoid copying light data
if (j != skyDataLayerStorageMap.currentLowestY && i < j) { if (j != skyDataLayerStorageMap.currentLowestY && i < j) {
DataLayer dataLayer = this.getDataLayer(skyDataLayerStorageMap, m); DataLayer dataLayer = this.getDataLayer(skyDataLayerStorageMap, l);
if (dataLayer == null) { if (dataLayer == null) {
@@ -52,6 +53,7 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec @@ -52,6 +53,7 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec
} else { } else {
return bl && !this.lightOnInSection(m) ? 0 : 15; return cached && !this.lightOnInSection(l) ? 0 : 15;
} }
+ } // Paper - avoid copying light data + } // Paper - avoid copying light data
} }

View File

@ -8,10 +8,10 @@ We have stored UUID in plenty of places that did not get DFU'd
So just look for old format and load it if it exists. So just look for old format and load it if it exists.
diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java
index 5456387ade8932fb0d9804abe0fd66f1c565e1ae..7199be3b9c00c66f452e92ad35795017112f1658 100644 index be2bd47a509a03e78c380cf749cd476f332ab03d..210f81e380cb38c2d5d69849e593d2fdb54e8856 100644
--- a/src/main/java/net/minecraft/nbt/CompoundTag.java --- a/src/main/java/net/minecraft/nbt/CompoundTag.java
+++ b/src/main/java/net/minecraft/nbt/CompoundTag.java +++ b/src/main/java/net/minecraft/nbt/CompoundTag.java
@@ -120,6 +120,12 @@ public class CompoundTag implements Tag { @@ -182,6 +182,12 @@ public class CompoundTag implements Tag {
} }
public void putUUID(String key, UUID value) { public void putUUID(String key, UUID value) {
@ -24,7 +24,7 @@ index 5456387ade8932fb0d9804abe0fd66f1c565e1ae..7199be3b9c00c66f452e92ad35795017
this.tags.put(key, NbtUtils.createUUID(value)); this.tags.put(key, NbtUtils.createUUID(value));
} }
@@ -128,10 +134,20 @@ public class CompoundTag implements Tag { @@ -190,10 +196,20 @@ public class CompoundTag implements Tag {
* You must use {@link #hasUUID(String)} before or else it <b>will</b> throw an NPE. * You must use {@link #hasUUID(String)} before or else it <b>will</b> throw an NPE.
*/ */
public UUID getUUID(String key) { public UUID getUUID(String key) {
@ -46,55 +46,44 @@ index 5456387ade8932fb0d9804abe0fd66f1c565e1ae..7199be3b9c00c66f452e92ad35795017
return tag != null && tag.getType() == IntArrayTag.TYPE && ((IntArrayTag)tag).getAsIntArray().length == 4; return tag != null && tag.getType() == IntArrayTag.TYPE && ((IntArrayTag)tag).getAsIntArray().length == 4;
} }
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
index 57c9575a9714acb95d9dced672955a96d71dfd1e..06fe97e05608fc21f90c9884d745d910beb6883d 100644 index a61f480bc2e2169969e614bccd3e143f47c1a40e..b77b806b28dfada3e84e25d868aa8a8f8556f5af 100644
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java --- a/src/main/java/net/minecraft/nbt/NbtUtils.java
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java +++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
@@ -40,14 +40,14 @@ import org.apache.logging.log4j.LogManager; @@ -40,14 +40,14 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
public final class NbtUtils { public final class NbtUtils {
- private static final Comparator<ListTag> YXZ_LISTTAG_INT_COMPARATOR = Comparator.comparingInt((listTag) -> { - private static final Comparator<ListTag> YXZ_LISTTAG_INT_COMPARATOR = Comparator.comparingInt((nbt) -> {
+ private static final Comparator<ListTag> YXZ_LISTTAG_INT_COMPARATOR = Comparator.<ListTag>comparingInt((listTag) -> { // Paper - decompile fix + private static final Comparator<ListTag> YXZ_LISTTAG_INT_COMPARATOR = Comparator.<ListTag>comparingInt((nbt) -> { // Paper - decompile fix
return listTag.getInt(1); return nbt.getInt(1);
}).thenComparingInt((listTag) -> { }).thenComparingInt((nbt) -> {
return listTag.getInt(0); return nbt.getInt(0);
}).thenComparingInt((listTag) -> { }).thenComparingInt((nbt) -> {
return listTag.getInt(2); return nbt.getInt(2);
}); });
- private static final Comparator<ListTag> YXZ_LISTTAG_DOUBLE_COMPARATOR = Comparator.comparingDouble((listTag) -> { - private static final Comparator<ListTag> YXZ_LISTTAG_DOUBLE_COMPARATOR = Comparator.comparingDouble((nbt) -> {
+ private static final Comparator<ListTag> YXZ_LISTTAG_DOUBLE_COMPARATOR = Comparator.<ListTag>comparingDouble((listTag) -> { // Paper - decompile fix + private static final Comparator<ListTag> YXZ_LISTTAG_DOUBLE_COMPARATOR = Comparator.<ListTag>comparingDouble((nbt) -> { // Paper - decompile fix
return listTag.getDouble(1); return nbt.getDouble(1);
}).thenComparingDouble((listTag) -> { }).thenComparingDouble((nbt) -> {
return listTag.getDouble(0); return nbt.getDouble(0);
@@ -76,6 +76,11 @@ public final class NbtUtils { @@ -75,6 +75,11 @@ public final class NbtUtils {
if (compound.contains("Name", 8)) {
string = compound.getString("Name"); string = compound.getString("Name");
} }
+ // Paper start - support string UUID's + // Paper start - support string UUID's
+ if (compound.contains("Id", 8)) { + if (compound.contains("Id", 8)) {
+ uUID = UUID.fromString(compound.getString("Id")); + uUID = UUID.fromString(compound.getString("Id"));
+ } + }
+ // Paper end + // Paper end
if (compound.hasUUID("Id")) { if (compound.hasUUID("Id")) {
uUID = compound.getUUID("Id"); uUID = compound.getUUID("Id");
}
@@ -495,7 +500,7 @@ public final class NbtUtils { @@ -495,7 +500,7 @@ public final class NbtUtils {
} }
public static CompoundTag update(DataFixer fixer, DataFixTypes fixTypes, CompoundTag compound, int oldVersion, int targetVersion) { public static CompoundTag update(DataFixer fixer, DataFixTypes fixTypes, CompoundTag compound, int oldVersion, int targetVersion) {
- return fixer.update(fixTypes.getType(), new Dynamic<>(NbtOps.INSTANCE, compound), oldVersion, targetVersion).getValue(); - return fixer.update(fixTypes.getType(), new Dynamic<>(NbtOps.INSTANCE, compound), oldVersion, targetVersion).getValue();
+ return (CompoundTag) fixer.update(fixTypes.getType(), new com.mojang.serialization.Dynamic<>(NbtOps.INSTANCE, compound), oldVersion, targetVersion).getValue(); // Paper - decompile fix + return (CompoundTag) fixer.update(fixTypes.getType(), new Dynamic<>(NbtOps.INSTANCE, compound), oldVersion, targetVersion).getValue(); // Paper - decompile fix
} }
public static Component toPrettyComponent(Tag element) { public static Component toPrettyComponent(Tag element) {
@@ -620,8 +625,8 @@ public final class NbtUtils {
CompoundTag compoundTag2 = new CompoundTag();
if (i + 2 <= string.length()) {
String string3 = string.substring(i + 1, string.indexOf(125, i));
- COMMA_SPLITTER.split(string3).forEach((string2) -> {
- List<String> list = COLON_SPLITTER.splitToList(string2);
+ COMMA_SPLITTER.split(string3).forEach(it -> { // Paper - decompile fix
+ List<String> list = COLON_SPLITTER.splitToList(it); // Paper - decompile fix
if (list.size() == 2) {
compoundTag2.putString(list.get(0), list.get(1));
} else {

View File

@ -9,7 +9,7 @@ growing to large sizes and preventing login.
This now automatically cleans up the extra properties. This now automatically cleans up the extra properties.
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
index 06fe97e05608fc21f90c9884d745d910beb6883d..dca8853944832e8fc5a291aa6b46d84b24181ea7 100644 index b77b806b28dfada3e84e25d868aa8a8f8556f5af..97c5e6c70cd9f96bc229557a425fbffbf489910e 100644
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java --- a/src/main/java/net/minecraft/nbt/NbtUtils.java
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java +++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
@@ -93,7 +93,8 @@ public final class NbtUtils { @@ -93,7 +93,8 @@ public final class NbtUtils {

View File

@ -30,7 +30,7 @@ index 0520c45197629cbdc2777d9ae11eef572e793160..46c313d581b9af6aa0a48f97ae3cc800
public CraftAttributeMap(AttributeMap handle) { public CraftAttributeMap(AttributeMap handle) {
this.handle = handle; this.handle = handle;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 0aa7854119ab876f0e46bb7667282d79d2a57e3d..3a125e7018b57aa6a802e99662fa784493fec5fc 100644 index 9d4685698ed707239b071a366eebbc4b8450683c..9ef1da08fe1b0ff8146c4931139eee9a2c6d5f12 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -480,7 +480,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -480,7 +480,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {

View File

@ -0,0 +1,37 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: JRoy <joshroy126@gmail.com>
Date: Mon, 29 Jun 2020 17:03:06 -0400
Subject: [PATCH] Remove some streams from structures
This showed up a lot in the spark profiler, should have a low-medium performance improvement.
diff --git a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
index 1de44cc8d3e030421ad50a732bfe569f569655f0..98c4ddb261b6a17f6b8fc269c98add92688cae96 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
@@ -16,6 +16,7 @@ import net.minecraft.world.level.levelgen.feature.structures.StructureTemplatePo
import net.minecraft.world.level.levelgen.structure.BoundingBox;
import net.minecraft.world.level.levelgen.structure.PoolElementStructurePiece;
import net.minecraft.world.level.levelgen.structure.StructurePiece;
+import net.minecraft.world.level.levelgen.structure.StructureStart;
public class Beardifier implements NoiseChunk.NoiseFiller {
public static final int BEARD_KERNEL_RADIUS = 12;
@@ -43,7 +44,7 @@ public class Beardifier implements NoiseChunk.NoiseFiller {
this.rigids = new ObjectArrayList<>(10);
for(StructureFeature<?> structureFeature : StructureFeature.NOISE_AFFECTING_FEATURES) {
- structureAccessor.startsForFeature(SectionPos.bottomOf(chunk), structureFeature).forEach((structureStart) -> {
+ for (StructureStart<?> structureStart : structureAccessor.startsForFeature(SectionPos.bottomOf(chunk), structureFeature)) { // Paper - remove streams
for(StructurePiece structurePiece : structureStart.getPieces()) {
if (structurePiece.isCloseToChunk(chunkPos, 12)) {
if (structurePiece instanceof PoolElementStructurePiece) {
@@ -66,7 +67,7 @@ public class Beardifier implements NoiseChunk.NoiseFiller {
}
}
- });
+ } // Paper
}
this.pieceIterator = this.rigids.iterator();

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Remove streams from classes related villager gossip
diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
index 01df536b3b61281828ca2be03ac1bbb6a1096423..2d124ff784b943f5a9d164ee7cdc001465502ce4 100644 index 5498ec7049318dc2d10bb2ef7fbfefcf1e6e1e72..d45d14394320e87513f70a9e821fb7d179450cd9 100644
--- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java --- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
+++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java +++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
@@ -8,6 +8,7 @@ import com.mojang.serialization.Dynamic; @@ -8,6 +8,7 @@ import com.mojang.serialization.Dynamic;

View File

@ -8,26 +8,91 @@ an object pool for these.
Uses lots of advanced new capabilities of the Paper codebase :) Uses lots of advanced new capabilities of the Paper codebase :)
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacket.java diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
index 24d5a44cb81ec5f10bfcce002a193f4566de88fc..d8be2ad889f46491e50404916fb4ae0de5f42098 100644 index 079734654c0fd421561b5f9003cd318bad5787a9..a15dbd37bf810c89b751710537203d6bf1d085bc 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacket.java --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
@@ -2,11 +2,14 @@ package net.minecraft.network.protocol.game; @@ -2,8 +2,11 @@ package net.minecraft.network.protocol.game;
import com.google.common.collect.Lists;
import java.util.BitSet; import java.util.BitSet;
+import io.netty.channel.ChannelFuture; // Paper
import java.util.List;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import net.minecraft.core.SectionPos; +
+import io.netty.channel.ChannelFuture;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.Packet;
+import net.minecraft.server.MCUtil;
+import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.LightLayer; import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.chunk.DataLayer; import net.minecraft.world.level.lighting.LevelLightEngine;
@@ -22,6 +25,35 @@ public class ClientboundLightUpdatePacket implements Packet<ClientGamePacketList @@ -14,6 +17,23 @@ public class ClientboundLevelChunkWithLightPacket implements Packet<ClientGamePa
private final ClientboundLevelChunkPacketData chunkData;
private final ClientboundLightUpdatePacketData lightData;
+ // Paper start
+ @Override
+ public void onPacketDispatch(ServerPlayer player) {
+ lightData.onPacketDispatch(player);
+ }
+
+ @Override
+ public void onPacketDispatchFinish(ServerPlayer player, ChannelFuture future) {
+ lightData.onPacketDispatchFinish(player, future);
+ }
+
+ @Override
+ public boolean hasFinishListener() {
+ return true;
+ }
+ // Paper end
+
public ClientboundLevelChunkWithLightPacket(LevelChunk chunk, LevelLightEngine lightProvider, @Nullable BitSet bitSet, @Nullable BitSet bitSet2, boolean bl) {
ChunkPos chunkPos = chunk.getPos();
this.x = chunkPos.x;
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacket.java
index 15350c301ba670cd86c83c7051c3571ff2759d8f..da46695e4d45f701a216767a048b21e289f056f6 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacket.java
@@ -2,8 +2,11 @@ package net.minecraft.network.protocol.game;
import java.util.BitSet;
import javax.annotation.Nullable;
+
+import io.netty.channel.ChannelFuture;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.Packet;
+import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.lighting.LevelLightEngine;
@@ -12,6 +15,23 @@ public class ClientboundLightUpdatePacket implements Packet<ClientGamePacketList
private final int z;
private final ClientboundLightUpdatePacketData lightData;
+ // Paper start
+ @Override
+ public void onPacketDispatch(ServerPlayer player) {
+ lightData.onPacketDispatch(player);
+ }
+
+ @Override
+ public void onPacketDispatchFinish(ServerPlayer player, ChannelFuture future) {
+ lightData.onPacketDispatchFinish(player, future);
+ }
+
+ @Override
+ public boolean hasFinishListener() {
+ return true;
+ }
+ // Paper end
+
public ClientboundLightUpdatePacket(ChunkPos chunkPos, LevelLightEngine lightProvider, @Nullable BitSet skyBits, @Nullable BitSet blockBits, boolean nonEdge) {
this.x = chunkPos.x;
this.z = chunkPos.z;
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacketData.java
index fe9cfb2c6e3ecbe8966bc33a16785f03f870e7cf..e887317e8fcf71740ec96d85b7ea5b819a39d468 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacketData.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLightUpdatePacketData.java
@@ -19,6 +19,27 @@ public class ClientboundLightUpdatePacketData {
private final List<byte[]> skyUpdates; private final List<byte[]> skyUpdates;
private final List<byte[]> blockUpdates; private final List<byte[]> blockUpdates;
private final boolean trustEdges; private final boolean trustEdges;
@ -36,16 +101,14 @@ index 24d5a44cb81ec5f10bfcce002a193f4566de88fc..d8be2ad889f46491e50404916fb4ae0d
+ java.lang.Runnable cleaner2; + java.lang.Runnable cleaner2;
+ java.util.concurrent.atomic.AtomicInteger remainingSends = new java.util.concurrent.atomic.AtomicInteger(0); + java.util.concurrent.atomic.AtomicInteger remainingSends = new java.util.concurrent.atomic.AtomicInteger(0);
+ +
+ @Override + public void onPacketDispatch(net.minecraft.server.level.ServerPlayer player) {
+ public void onPacketDispatch(ServerPlayer player) {
+ remainingSends.incrementAndGet(); + remainingSends.incrementAndGet();
+ } + }
+ +
+ @Override + public void onPacketDispatchFinish(net.minecraft.server.level.ServerPlayer player, io.netty.channel.ChannelFuture future) {
+ public void onPacketDispatchFinish(ServerPlayer player, ChannelFuture future) {
+ if (remainingSends.decrementAndGet() <= 0) { + if (remainingSends.decrementAndGet() <= 0) {
+ // incase of any race conditions, schedule this delayed + // incase of any race conditions, schedule this delayed
+ MCUtil.scheduleTask(5, () -> { + net.minecraft.server.MCUtil.scheduleTask(5, () -> {
+ if (remainingSends.get() == 0) { + if (remainingSends.get() == 0) {
+ cleaner1.run(); + cleaner1.run();
+ cleaner2.run(); + cleaner2.run();
@ -53,38 +116,32 @@ index 24d5a44cb81ec5f10bfcce002a193f4566de88fc..d8be2ad889f46491e50404916fb4ae0d
+ }, "Light Packet Release"); + }, "Light Packet Release");
+ } + }
+ } + }
+
+ @Override
+ public boolean hasFinishListener() {
+ return true;
+ }
+
+ // Paper end + // Paper end
public ClientboundLightUpdatePacket(ChunkPos chunkPos, LevelLightEngine lightProvider, @Nullable BitSet bitSet, @Nullable BitSet bitSet2, boolean nonEdge) { public ClientboundLightUpdatePacketData(ChunkPos pos, LevelLightEngine lightProvider, @Nullable BitSet skyBits, @Nullable BitSet blockBits, boolean nonEdge) {
this.x = chunkPos.x; this.trustEdges = nonEdge;
@@ -31,8 +63,8 @@ public class ClientboundLightUpdatePacket implements Packet<ClientGamePacketList @@ -26,8 +47,8 @@ public class ClientboundLightUpdatePacketData {
this.blockYMask = new BitSet(); this.blockYMask = new BitSet();
this.emptySkyYMask = new BitSet(); this.emptySkyYMask = new BitSet();
this.emptyBlockYMask = new BitSet(); this.emptyBlockYMask = new BitSet();
- this.skyUpdates = Lists.newArrayList(); - this.skyUpdates = Lists.newArrayList();
- this.blockUpdates = Lists.newArrayList(); - this.blockUpdates = Lists.newArrayList();
+ this.skyUpdates = Lists.newArrayList();this.cleaner1 = MCUtil.registerListCleaner(this, this.skyUpdates, DataLayer::releaseBytes); // Paper + this.skyUpdates = Lists.newArrayList();this.cleaner1 = net.minecraft.server.MCUtil.registerListCleaner(this, this.skyUpdates, DataLayer::releaseBytes); // Paper
+ this.blockUpdates = Lists.newArrayList();this.cleaner2 = MCUtil.registerListCleaner(this, this.blockUpdates, DataLayer::releaseBytes); // Paper + this.blockUpdates = Lists.newArrayList();this.cleaner2 = net.minecraft.server.MCUtil.registerListCleaner(this, this.blockUpdates, DataLayer::releaseBytes); // Paper
for(int i = 0; i < lightProvider.getLightSectionCount(); ++i) { for(int i = 0; i < lightProvider.getLightSectionCount(); ++i) {
if (bitSet == null || bitSet.get(i)) { if (skyBits == null || skyBits.get(i)) {
@@ -53,7 +85,7 @@ public class ClientboundLightUpdatePacket implements Packet<ClientGamePacketList @@ -72,7 +93,7 @@ public class ClientboundLightUpdatePacketData {
bitSet2.set(i); uninitialized.set(y);
} else { } else {
bitSet.set(i); initialized.set(y);
- list.add((byte[])dataLayer.getData().clone()); - nibbles.add((byte[])dataLayer.getData().clone());
+ list.add((byte[])dataLayer.getCloneIfSet()); // Paper + nibbles.add((byte[])dataLayer.getCloneIfSet()); // Paper
} }
} }
diff --git a/src/main/java/net/minecraft/world/level/chunk/DataLayer.java b/src/main/java/net/minecraft/world/level/chunk/DataLayer.java diff --git a/src/main/java/net/minecraft/world/level/chunk/DataLayer.java b/src/main/java/net/minecraft/world/level/chunk/DataLayer.java
index 4ddcdb3881f616f922cb539bf9d00a1ac89f051f..68a6c4db5980e733d81ef9a34cf32950f0983de6 100644 index 81701abd11fbc4671393a76a42973f53835ca234..e8cf0088e94925934acd02ba05b9411bd7cf186e 100644
--- a/src/main/java/net/minecraft/world/level/chunk/DataLayer.java --- a/src/main/java/net/minecraft/world/level/chunk/DataLayer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/DataLayer.java +++ b/src/main/java/net/minecraft/world/level/chunk/DataLayer.java
@@ -13,11 +13,65 @@ public final class DataLayer { @@ -13,11 +13,65 @@ public final class DataLayer {
@ -151,7 +208,7 @@ index 4ddcdb3881f616f922cb539bf9d00a1ac89f051f..68a6c4db5980e733d81ef9a34cf32950
+ registerCleaner(); + registerCleaner();
+ // Paper end + // Paper end
if (bytes.length != 2048) { if (bytes.length != 2048) {
throw (IllegalArgumentException) Util.pauseInIde((Throwable) (new IllegalArgumentException("DataLayer should be 2048 bytes not: " + bytes.length))); throw (IllegalArgumentException) Util.pauseInIde(new IllegalArgumentException("DataLayer should be 2048 bytes not: " + bytes.length));
} }
@@ -52,7 +106,8 @@ public final class DataLayer { @@ -52,7 +106,8 @@ public final class DataLayer {
@ -199,23 +256,23 @@ index 4ddcdb3881f616f922cb539bf9d00a1ac89f051f..68a6c4db5980e733d81ef9a34cf32950
public String toString() { public String toString() {
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
index d113b4835e86a789c0ba124eb839e1c56a5437d2..ed05a11f5038fdac90576ca33a0b710c83ab39a1 100644 index fdc80d70cf444e9b6d968764e4232f23f3ae9c37..5c21871c7bdfce191db499860725da769dc9caac 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
@@ -488,11 +488,11 @@ public class ChunkSerializer { @@ -496,11 +496,11 @@ public class ChunkSerializer {
} }
if (nibblearray != null && !nibblearray.isEmpty()) { if (nibblearray != null && !nibblearray.isEmpty()) {
- nbttagcompound2.putByteArray("BlockLight", nibblearray.getData()); - nbttagcompound1.putByteArray("BlockLight", nibblearray.getData());
+ nbttagcompound2.putByteArray("BlockLight", nibblearray.asBytesPoolSafe().clone()); // Paper + nbttagcompound1.putByteArray("BlockLight", nibblearray.asBytesPoolSafe().clone()); // Paper
} }
if (nibblearray1 != null && !nibblearray1.isEmpty()) { if (nibblearray1 != null && !nibblearray1.isEmpty()) {
- nbttagcompound2.putByteArray("SkyLight", nibblearray1.getData()); - nbttagcompound1.putByteArray("SkyLight", nibblearray1.getData());
+ nbttagcompound2.putByteArray("SkyLight", nibblearray1.asBytesPoolSafe().clone()); // Paper + nbttagcompound1.putByteArray("SkyLight", nibblearray1.asBytesPoolSafe().clone()); // Paper
} }
nbttaglist.add(nbttagcompound2); if (!nbttagcompound1.isEmpty()) {
diff --git a/src/main/java/net/minecraft/world/level/lighting/DataLayerStorageMap.java b/src/main/java/net/minecraft/world/level/lighting/DataLayerStorageMap.java diff --git a/src/main/java/net/minecraft/world/level/lighting/DataLayerStorageMap.java b/src/main/java/net/minecraft/world/level/lighting/DataLayerStorageMap.java
index f357a3473682c2d37a20fb862522c67b9979402a..52682471adc13dffc0383fc4abacbd3397f3bb10 100644 index f357a3473682c2d37a20fb862522c67b9979402a..52682471adc13dffc0383fc4abacbd3397f3bb10 100644
--- a/src/main/java/net/minecraft/world/level/lighting/DataLayerStorageMap.java --- a/src/main/java/net/minecraft/world/level/lighting/DataLayerStorageMap.java
@ -232,10 +289,10 @@ index f357a3473682c2d37a20fb862522c67b9979402a..52682471adc13dffc0383fc4abacbd33
} }
diff --git a/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java b/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java diff --git a/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java b/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java
index cc9eb8273d5157fb649d84a3ec589b0b923b5bc9..fd1cdb6e2023713f947b9497c605cf6f4bae8994 100644 index 4f7b63f2cc8a69fa8efb3a84f6abc3d3dcf05b49..cae559b37b5404851fa99d1d206232b5e7ab770c 100644
--- a/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java --- a/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java
+++ b/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java +++ b/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java
@@ -162,7 +162,7 @@ public abstract class LayerLightSectionStorage<M extends DataLayerStorageMap<M>> @@ -157,7 +157,7 @@ public abstract class LayerLightSectionStorage<M extends DataLayerStorageMap<M>>
protected DataLayer createDataLayer(long sectionPos) { protected DataLayer createDataLayer(long sectionPos) {
DataLayer dataLayer = this.queuedSections.get(sectionPos); DataLayer dataLayer = this.queuedSections.get(sectionPos);
@ -244,13 +301,13 @@ index cc9eb8273d5157fb649d84a3ec589b0b923b5bc9..fd1cdb6e2023713f947b9497c605cf6f
} }
protected void clearQueuedSectionBlocks(LayerLightEngine<?, ?> storage, long sectionPos) { protected void clearQueuedSectionBlocks(LayerLightEngine<?, ?> storage, long sectionPos) {
@@ -321,12 +321,12 @@ public abstract class LayerLightSectionStorage<M extends DataLayerStorageMap<M>> @@ -318,12 +318,12 @@ public abstract class LayerLightSectionStorage<M extends DataLayerStorageMap<M>>
protected void queueSectionData(long sectionPos, @Nullable DataLayer array, boolean bl) { protected void queueSectionData(long sectionPos, @Nullable DataLayer array, boolean nonEdge) {
if (array != null) { if (array != null) {
- this.queuedSections.put(sectionPos, array); - this.queuedSections.put(sectionPos, array);
+ DataLayer remove = this.queuedSections.put(sectionPos, array); if (remove != null && remove.cleaner != null) remove.cleaner.run(); // Paper - clean up when removed + DataLayer remove = this.queuedSections.put(sectionPos, array); if (remove != null && remove.cleaner != null) remove.cleaner.run(); // Paper - clean up when removed
if (!bl) { if (!nonEdge) {
this.untrustedSections.add(sectionPos); this.untrustedSections.add(sectionPos);
} }
} else { } else {
@ -260,7 +317,7 @@ index cc9eb8273d5157fb649d84a3ec589b0b923b5bc9..fd1cdb6e2023713f947b9497c605cf6f
} }
diff --git a/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java b/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java diff --git a/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java b/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java
index 24030bcb3303d0419c7859ded7613608c5f82308..ec3837a64e8ac6892028611d57a111a7fd5c58f7 100644 index 9797254e981d08d3934f7ca8f369dd78a6ef1a48..4012d87dc27c3b1096fdaa60bfdfd68f27a22da7 100644
--- a/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java --- a/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java
+++ b/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java +++ b/src/main/java/net/minecraft/world/level/lighting/SkyLightSectionStorage.java
@@ -163,14 +163,14 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec @@ -163,14 +163,14 @@ public class SkyLightSectionStorage extends LayerLightSectionStorage<SkyLightSec
@ -299,10 +356,10 @@ index 24030bcb3303d0419c7859ded7613608c5f82308..ec3837a64e8ac6892028611d57a111a7
int k = SectionPos.sectionToBlockCoord(SectionPos.y(l)); int k = SectionPos.sectionToBlockCoord(SectionPos.y(l));
int m = SectionPos.sectionToBlockCoord(SectionPos.z(l)); int m = SectionPos.sectionToBlockCoord(SectionPos.z(l));
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
index 46136c5daa1b4ea9103c736cc4b035195177368e..5088c84f6518cb686241b1db54faa8d813cb3eaa 100644 index 7bc1219523eeb0880493e6fb42692f1fdb30c110..187366c33c86b220581c3deac9168d6b6a2c5a3e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -343,14 +343,14 @@ public class CraftChunk implements Chunk { @@ -339,14 +339,14 @@ public class CraftChunk implements Chunk {
sectionSkyLights[i] = CraftChunk.emptyLight; sectionSkyLights[i] = CraftChunk.emptyLight;
} else { } else {
sectionSkyLights[i] = new byte[2048]; sectionSkyLights[i] = new byte[2048];
@ -317,5 +374,5 @@ index 46136c5daa1b4ea9103c736cc4b035195177368e..5088c84f6518cb686241b1db54faa8d8
- System.arraycopy(emitLightArray.getData(), 0, sectionEmitLights[i], 0, 2048); - System.arraycopy(emitLightArray.getData(), 0, sectionEmitLights[i], 0, 2048);
+ System.arraycopy(emitLightArray.getIfSet(), 0, sectionEmitLights[i], 0, 2048); // Paper + System.arraycopy(emitLightArray.getIfSet(), 0, sectionEmitLights[i], 0, 2048); // Paper
} }
}
} if (biome != null) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Support components in ItemMeta
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 3a125e7018b57aa6a802e99662fa784493fec5fc..808eb6b9ec535b1179a1d7b88877c9ce1755c45b 100644 index 9ef1da08fe1b0ff8146c4931139eee9a2c6d5f12..bfede0c5dac43e063d465e386a080d2ffb89eb6f 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -874,11 +874,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -874,11 +874,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {

View File

@ -7,7 +7,7 @@ CraftBukkit has a bug in their implementation and is incorrectly handling forget
Also adds more target reasons for why it forgot target. Also adds more target reasons for why it forgot target.
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java b/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java b/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java
index 6ee0098de2b55a437f914869643adbd1ddbe7faf..4b2e0379d9bbeb12c104e52817bb2005ed627a78 100644 index 3210f8de59b8760fc48809bd451744b46119c0b0..85f8634edddd3b8a05cb3f89262032fb8c49b560 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java --- a/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java
@@ -50,15 +50,15 @@ public class StopAttackingIfTargetInvalid<E extends Mob> extends Behavior<E> { @@ -50,15 +50,15 @@ public class StopAttackingIfTargetInvalid<E extends Mob> extends Behavior<E> {
@ -16,7 +16,7 @@ index 6ee0098de2b55a437f914869643adbd1ddbe7faf..4b2e0379d9bbeb12c104e52817bb2005
if (!entity.canAttack(entityliving)) { if (!entity.canAttack(entityliving)) {
- this.clearAttackTarget(entity); - this.clearAttackTarget(entity);
+ this.clearAttackTarget(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_INVALID); // Paper + this.clearAttackTarget(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_INVALID); // Paper
} else if (StopAttackingIfTargetInvalid.isTiredOfTryingToReachTarget((LivingEntity) entity)) { } else if (StopAttackingIfTargetInvalid.isTiredOfTryingToReachTarget(entity)) {
- this.clearAttackTarget(entity); - this.clearAttackTarget(entity);
+ this.clearAttackTarget(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET); // Paper + this.clearAttackTarget(entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET); // Paper
} else if (this.isCurrentTargetDeadOrRemoved(entity)) { } else if (this.isCurrentTargetDeadOrRemoved(entity)) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add entity liquid API
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 19a6b2c686e6421624282d0536dfdd3320da4ec6..3e1f34ed8c3b4bd4f6c3624332a5f2be62e196fe 100644 index 4c506e2bf241ba9d6dd53b54def09be09303664b..91e034f54deb2aa084527aaa001e48ddcc2e9cd1 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1365,7 +1365,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @@ -1359,7 +1359,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
return this.isInWater() || this.isInRain(); return this.isInWater() || this.isInRain();
} }
@ -17,7 +17,7 @@ index 19a6b2c686e6421624282d0536dfdd3320da4ec6..3e1f34ed8c3b4bd4f6c3624332a5f2be
return this.isInWater() || this.isInRain() || this.isInBubbleColumn(); return this.isInWater() || this.isInRain() || this.isInBubbleColumn();
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index c9e716900d88d025be1f09b6fe0156cf0dac2d33..f28f857d6218db1634348e8a57e7b275b9115bfc 100644 index fd811e2ba455d7e4eb618d48ca2c4983797a265c..38e38abd5302a9f8c5eb2d3d81d825cdae99d7c4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1235,5 +1235,29 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -1235,5 +1235,29 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Update itemstack legacy name and lore
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 1f93ad93701339418b554eb3e1e3f74e62468f3f..e643f925623820ffa67217eb3615582c0d0ca3a5 100644 index 3d6d48ce4b762091aeee3b4fdd28bd121aaf291b..a18cf051b374cbf294e319b619b7e2fba10a6268 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java --- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -168,6 +168,44 @@ public final class ItemStack { @@ -168,6 +168,44 @@ public final class ItemStack {
@ -54,7 +54,7 @@ index 1f93ad93701339418b554eb3e1e3f74e62468f3f..e643f925623820ffa67217eb3615582c
public ItemStack(ItemLike item) { public ItemStack(ItemLike item) {
@@ -214,6 +252,7 @@ public final class ItemStack { @@ -214,6 +252,7 @@ public final class ItemStack {
this.tag = (CompoundTag) nbttagcompound.getCompound("tag").copy(); this.tag = nbttagcompound.getCompound("tag").copy();
// CraftBukkit end // CraftBukkit end
this.processEnchantOrder(this.tag); // Paper this.processEnchantOrder(this.tag); // Paper
+ this.processText(); // Paper + this.processText(); // Paper

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Spawn player in correct world on login
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index f5334be5d9c799da16198ecb0f69f17a2bf4a1eb..e0c9857a922d8a3f421d7df0f056b82c4775390e 100644 index c2cc59f476a67224774503009439fec2ad1ec62d..0ac5ba6bc7b582d1ab02a90c9418c9b899175d93 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -196,7 +196,18 @@ public abstract class PlayerList { @@ -196,7 +196,18 @@ public abstract class PlayerList {

View File

@ -8,10 +8,10 @@ Adds a new event for all crafting stations that generate a result slot item
Anvil, Grindstone and Smithing now extend this event Anvil, Grindstone and Smithing now extend this event
diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
index 2ed4930648411ccd52fc970b069e57eba9bceef8..593e23c10f2b1616db7256158dfe564b2d289df1 100644 index 6b9c39b85e3a21fc0073fc15c8a76c92f75d2487..b40377e882d9cc3571f527e706862e27c59b1fd0 100644
--- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java --- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
@@ -317,6 +317,7 @@ public class AnvilMenu extends ItemCombinerMenu { @@ -316,6 +316,7 @@ public class AnvilMenu extends ItemCombinerMenu {
} }
this.createResult(); this.createResult();
@ -20,7 +20,7 @@ index 2ed4930648411ccd52fc970b069e57eba9bceef8..593e23c10f2b1616db7256158dfe564b
public int getCost() { public int getCost() {
diff --git a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
index 93ebd73b94efac5f671b0459e0075959f5ce8bdf..aaf67ac2a73fa3b4420ec99ee185bceda2cb4c2b 100644 index fc2b400c58ddbd7b012707c61d9a37363d351251..35e13a5fc23fc0cc046345059b43b37b348a3803 100644
--- a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java --- a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java +++ b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
@@ -150,6 +150,7 @@ public class CartographyTableMenu extends AbstractContainerMenu { @@ -150,6 +150,7 @@ public class CartographyTableMenu extends AbstractContainerMenu {
@ -32,10 +32,10 @@ index 93ebd73b94efac5f671b0459e0075959f5ce8bdf..aaf67ac2a73fa3b4420ec99ee185bced
private void setupResultSlot(ItemStack map, ItemStack item, ItemStack oldResult) { private void setupResultSlot(ItemStack map, ItemStack item, ItemStack oldResult) {
diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
index b268645827b7a57b906fd925d694f802a75da25d..dda6c4948b903221fa8020c76d109216d2dd82bf 100644 index aa0ba9c7dcb0ee81c9081031c447eeab61d92a10..aa47947ea2f04afd3cca4b359891609025c112d5 100644
--- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java --- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java +++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
@@ -160,6 +160,7 @@ public class GrindstoneMenu extends AbstractContainerMenu { @@ -159,6 +159,7 @@ public class GrindstoneMenu extends AbstractContainerMenu {
super.slotsChanged(inventory); super.slotsChanged(inventory);
if (inventory == this.repairSlots) { if (inventory == this.repairSlots) {
this.createResult(); this.createResult();
@ -44,7 +44,7 @@ index b268645827b7a57b906fd925d694f802a75da25d..dda6c4948b903221fa8020c76d109216
} }
diff --git a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
index 8819347987a8072eede52a57fec763711d9bab92..9cc246f43230e87c6bd2377ef77ab2dcb9509a5c 100644 index f5e52220abc5c678c090b32d83eb9644fa91ce9d..0a30b051e2fb4f081d0d579b30732aa8289c3389 100644
--- a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java --- a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java +++ b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
@@ -78,6 +78,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu { @@ -78,6 +78,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
@ -56,10 +56,10 @@ index 8819347987a8072eede52a57fec763711d9bab92..9cc246f43230e87c6bd2377ef77ab2dc
} }
diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
index b490e87d95c3a140323aa9da95b90381392f64f8..9bcab01324612a905b21623a09109d404f8dadf7 100644 index 5d9e444793bc9995f669596e699ace095ae3cb2b..fba8c59071847d9669943534ff8a0898b5787c28 100644
--- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java --- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java +++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
@@ -196,7 +196,8 @@ public class LoomMenu extends AbstractContainerMenu { @@ -198,7 +198,8 @@ public class LoomMenu extends AbstractContainerMenu {
} }
this.setupResultSlot(); this.setupResultSlot();
@ -82,7 +82,7 @@ index 92dd2ea23185bba311e184b2ac9744a423c102ea..cb3f522a586b841056c35378a49dd50b
@Override @Override
diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
index 3df5031ec2c50dc6eb2533318cf8a98f21b03d2a..c971a534ded962e3be92c71059c75cc1d54970b5 100644 index cdebd0cdf6eb901464cf4c16089b10ea0147b54d..221b6ffb426edc034183dbaf37de29c694874c62 100644
--- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java --- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java +++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
@@ -176,6 +176,7 @@ public class StonecutterMenu extends AbstractContainerMenu { @@ -176,6 +176,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
@ -94,7 +94,7 @@ index 3df5031ec2c50dc6eb2533318cf8a98f21b03d2a..c971a534ded962e3be92c71059c75cc1
private void setupRecipeList(Container input, ItemStack stack) { private void setupRecipeList(Container input, ItemStack stack) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index ff2149572a82d6605a0b28f2fdd0dadb86af25a1..869990c181403a025d219dbd0e1201005973ffe9 100644 index 5fea023590fd1456a4d43c1ebc5b8c243e185631..1c0bf20f19a697e588a1d0210c181d29edbcaba7 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1556,19 +1556,44 @@ public class CraftEventFactory { @@ -1556,19 +1556,44 @@ public class CraftEventFactory {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Don't check chunk for portal on world gen entity add
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index fab8098ce72feb9b08960e55ab1a4aebaae22276..2e7d7bd60ac340568b1bc0f3052affcf445090f7 100644 index 6c4fd054a06830947dbb4728e62dc320a51f43f0..2e02fc6d9c54bd246602b8535553dd04c4e26679 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3359,7 +3359,7 @@ public abstract class LivingEntity extends Entity { @@ -3362,7 +3362,7 @@ public abstract class LivingEntity extends Entity {
Entity entity = this.getVehicle(); Entity entity = this.getVehicle();
super.stopRiding(suppressCancellation); // Paper - suppress super.stopRiding(suppressCancellation); // Paper - suppress

View File

@ -1,106 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: JRoy <joshroy126@gmail.com>
Date: Mon, 29 Jun 2020 17:03:06 -0400
Subject: [PATCH] Remove some streams from structures
This showed up a lot in the spark profiler, should have a low-medium performance improvement.
diff --git a/src/main/java/net/minecraft/world/level/StructureFeatureManager.java b/src/main/java/net/minecraft/world/level/StructureFeatureManager.java
index 21f67cf20dede30a056a7807a0e7338e858da142..9a8e44fb3b1cffec3f70c9812c80175bd07f10e2 100644
--- a/src/main/java/net/minecraft/world/level/StructureFeatureManager.java
+++ b/src/main/java/net/minecraft/world/level/StructureFeatureManager.java
@@ -45,6 +45,20 @@ public class StructureFeatureManager {
});
}
+ // Paper start - remove structure streams - based on method above
+ public java.util.List<StructureStart<?>> streamlessStartsForFeature(SectionPos sectionPosition, StructureFeature<?> structureGenerator) {
+ java.util.List<StructureStart<?>> list = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>();
+ for (Long curLong : this.level.getChunk(sectionPosition.x(), sectionPosition.z(), ChunkStatus.STRUCTURE_REFERENCES).getReferencesForFeature(structureGenerator)) {
+ SectionPos sectionPosition1 = SectionPos.of(new ChunkPos(curLong), 0);
+ StructureStart<?> structurestart = getStartForFeature(sectionPosition1, structureGenerator, this.level.getChunk(sectionPosition1.x(), sectionPosition1.z(), ChunkStatus.STRUCTURE_STARTS));
+ if (structurestart != null && structurestart.isValid()) {
+ list.add(structurestart);
+ }
+ }
+ return list;
+ }
+ // Paper end
+
@Nullable
public StructureStart<?> getStartForFeature(SectionPos pos, StructureFeature<?> feature, FeatureAccess holder) {
return holder.getStartForFeature(feature);
@@ -63,11 +77,20 @@ public class StructureFeatureManager {
}
public StructureStart<?> getStructureAt(BlockPos pos, boolean matchChildren, StructureFeature<?> feature) {
- return (StructureStart) DataFixUtils.orElse(this.startsForFeature(SectionPos.of(pos), feature).filter((structurestart) -> {
- return matchChildren ? structurestart.getPieces().stream().anyMatch((structurepiece) -> {
- return structurepiece.getBoundingBox().isInside((Vec3i) pos);
- }) : structurestart.getBoundingBox().isInside((Vec3i) pos);
- }).findFirst(), StructureStart.INVALID_START);
+ // Paper start - remove structure streams
+ for (StructureStart<?> structureStart : streamlessStartsForFeature(SectionPos.of(pos), feature)) {
+ if (matchChildren) {
+ for (net.minecraft.world.level.levelgen.structure.StructurePiece piece : structureStart.getPieces()) {
+ if (piece.getBoundingBox().isInside(pos)) {
+ return structureStart;
+ }
+ }
+ } else if (structureStart.getBoundingBox().isInside(pos)) {
+ return structureStart;
+ }
+ }
+ return StructureStart.INVALID_START;
+ // Paper end
}
// Spigot start
diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java
index 3f3b4e4ea8231fdcc799bd9de3e20747a5634603..a7a7e6cd87270e64a92448f03f8b0b0c7e375ec7 100644
--- a/src/main/java/net/minecraft/world/level/biome/Biome.java
+++ b/src/main/java/net/minecraft/world/level/biome/Biome.java
@@ -44,6 +44,7 @@ import net.minecraft.world.level.levelgen.WorldgenRandom;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.StructureFeature;
import net.minecraft.world.level.levelgen.structure.BoundingBox;
+import net.minecraft.world.level.levelgen.structure.StructureStart;
import net.minecraft.world.level.levelgen.surfacebuilders.ConfiguredSurfaceBuilder;
import net.minecraft.world.level.levelgen.synth.PerlinSimplexNoise;
import net.minecraft.world.level.material.FluidState;
@@ -241,9 +242,11 @@ public final class Biome {
int p = region.getMinBuildHeight() + 1;
int q = region.getMaxBuildHeight() - 1;
region.setCurrentlyGenerating(supplier);
- structureAccessor.startsForFeature(SectionPos.of(origin), structureFeature).forEach((structureStart) -> {
+ // Paper start - remove structure streams
+ for (StructureStart<?> structureStart : structureAccessor.streamlessStartsForFeature(SectionPos.of(origin), structureFeature)) {
structureStart.placeInChunk(region, structureAccessor, chunkGenerator, random, new BoundingBox(n, p, o, n + 15, q, o + 15), new ChunkPos(l, m));
- });
+ }
+ // Paper end
} catch (Exception var24) {
CrashReport crashReport = CrashReport.forThrowable(var24, "Feature placement");
crashReport.addCategory("Feature").setDetail("Description", supplier::get);
diff --git a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
index ed3bfe13d0e3835ce0dbe3ae5af8cd22a7ea25e6..c52d1a23a0f0bdde062f73a435bc6b9cef51c437 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
@@ -44,7 +44,7 @@ public class Beardifier {
this.rigids = new ObjectArrayList<>(10);
for(StructureFeature<?> structureFeature : StructureFeature.NOISE_AFFECTING_FEATURES) {
- accessor.startsForFeature(SectionPos.bottomOf(chunk), structureFeature).forEach((start) -> {
+ for (net.minecraft.world.level.levelgen.structure.StructureStart<?> start : accessor.streamlessStartsForFeature(SectionPos.of(chunkPos, 0), structureFeature)) { // Paper - remove structure streams
for(StructurePiece structurePiece : start.getPieces()) {
if (structurePiece.isCloseToChunk(chunkPos, 12)) {
if (structurePiece instanceof PoolElementStructurePiece) {
@@ -67,7 +67,7 @@ public class Beardifier {
}
}
- });
+ } // Paper - remove structure streams
}
this.pieceIterator = this.rigids.iterator();