3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 02:50:09 +01:00

Things, and Starlight (maybe)

Dieser Commit ist enthalten in:
Nassim Jahnke 2022-06-08 13:44:30 +02:00
Ursprung 8d5407b16f
Commit d28b20944b
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
29 geänderte Dateien mit 187 neuen und 173 gelöschten Zeilen

Datei anzeigen

@ -5,11 +5,11 @@ Subject: [PATCH] Use Velocity compression and cipher natives
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 6b46f9c94dc051579ca5b51755caad19505e874a..4715d1386afd939628c392a7d8062e5887d7a507 100644 index 8c597c2671746ecf89d53704fba4d85d61dc316c..a7c7d450f22f9642fadeac9cb601214cfa9a2b02 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -35,6 +35,11 @@ dependencies { @@ -36,6 +36,11 @@ dependencies {
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.2") runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
implementation("net.fabricmc:mapping-io:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation implementation("net.fabricmc:mapping-io:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation
+ // Paper start - Use Velocity cipher + // Paper start - Use Velocity cipher
@ -268,10 +268,10 @@ index 792883afe53d2b7989c25a81c2f9a639d5e21d20..c04379ca8a4db0f4de46ad2b3b338431
return this.threshold; return this.threshold;
} }
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index d3a25cc5262843b5c9736ff32e300264d9847c9b..42400b6f0b693dd0ec4a2303a82bd131753a24ba 100644 index 1e4b75ab79a1d63a82498907d72932d644552635..7030c38980dbebfd374c2369294555650cf7880b 100644
--- a/src/main/java/net/minecraft/network/Connection.java --- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java
@@ -640,11 +640,28 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -642,11 +642,28 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
return networkmanager; return networkmanager;
} }
@ -304,7 +304,7 @@ index d3a25cc5262843b5c9736ff32e300264d9847c9b..42400b6f0b693dd0ec4a2303a82bd131
public boolean isEncrypted() { public boolean isEncrypted() {
return this.encrypted; return this.encrypted;
@@ -673,16 +690,17 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -675,16 +692,17 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
public void setupCompression(int compressionThreshold, boolean rejectsBadPackets) { public void setupCompression(int compressionThreshold, boolean rejectsBadPackets) {
if (compressionThreshold >= 0) { if (compressionThreshold >= 0) {
@ -325,10 +325,10 @@ index d3a25cc5262843b5c9736ff32e300264d9847c9b..42400b6f0b693dd0ec4a2303a82bd131
} else { } else {
if (this.channel.pipeline().get("decompress") instanceof CompressionDecoder) { if (this.channel.pipeline().get("decompress") instanceof CompressionDecoder) {
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index bfa519b9335c960a5baec50b0da95d95cd5ee958..af4d9244102bd0ac204f44a8de7f3a7706e3692d 100644 index 9e7154c9df96d5a0577886d43a98a73626a8f189..af3e70920221b6bd127bb3aed7f1e0a7e9e4c322 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -104,6 +104,11 @@ public class ServerConnectionListener { @@ -105,6 +105,11 @@ public class ServerConnectionListener {
ServerConnectionListener.LOGGER.info("Using default channel type"); ServerConnectionListener.LOGGER.info("Using default channel type");
} }
@ -341,10 +341,10 @@ index bfa519b9335c960a5baec50b0da95d95cd5ee958..af4d9244102bd0ac204f44a8de7f3a77
protected void initChannel(Channel channel) { protected void initChannel(Channel channel) {
try { try {
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 4e23e9ac3579dd0cedf0dfdbb231f6fae111745c..4cd92875d60c2f1dcce67ac99e9ba257a10f87b1 100644 index ffbd711375c400c9faaa4c984463a24af2f4993f..b146fc81ebd4adb8c15b10ed05c92db202a2c89e 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -279,12 +279,14 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener @@ -339,12 +339,14 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
} }
SecretKey secretkey = packet.getSecretKey(privatekey); SecretKey secretkey = packet.getSecretKey(privatekey);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Reduce worldgen thread worker count for low core count CPUs
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index da55a78b28b463f737464ebc818e918425903571..ab524d5bd579ad56fd6fc7808e9060953a1c21c3 100644 index 206c6ce227ba19620185ac835af28d67caa76c40..e8f5f87962cd3dbd383096fc4df9c3f0d5399211 100644
--- a/src/main/java/net/minecraft/Util.java --- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java
@@ -130,7 +130,19 @@ public class Util { @@ -140,7 +140,19 @@ public class Util {
private static ExecutorService makeExecutor(String s, int priorityModifier) { // Paper - add priority private static ExecutorService makeExecutor(String s, int priorityModifier) { // Paper - add priority
// Paper start - use simpler thread pool that allows 1 thread // Paper start - use simpler thread pool that allows 1 thread

Datei anzeigen

@ -16,10 +16,10 @@ of a chance that we're about to eat a dirtload of chunk load callbacks, thus
making this issue much more of an issue making this issue much more of an issue
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 0085a4dd0f0def1ba71342e20aecdd46a3761b02..0cf67d55ab30ab145ffb2ff562c26c47c2e2879e 100644 index 4a9b20e0dae3d502738e71e0f6119bdb3e0e2f16..7fd9f20d60339270d5e4adbf098ac38a832fb224 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
@@ -129,46 +129,6 @@ public class CraftChunk implements Chunk { @@ -130,46 +130,6 @@ public class CraftChunk implements Chunk {
this.getWorld().getChunkAt(x, z); // Transient load for this tick this.getWorld().getChunkAt(x, z); // Transient load for this tick
} }

Datei anzeigen

@ -8,7 +8,7 @@ Now in 1.17, this state is _even more_ critical than it was before,
so these must exist to catch stupid plugins. so these must exist to catch stupid plugins.
diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
index db2ef605bccbb9024f787cd58f3cb93df03d5532..3d5f38a1ca0206e5bcae4ed49d3df7ce0967f722 100644 index 90dff6b5786933577cf070fe723872041e050738..9a3364241a6f96b16644bf598fa2afd7bcd7972b 100644
--- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java --- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
+++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java +++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
@@ -138,6 +138,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -138,6 +138,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
@ -123,7 +123,7 @@ index db2ef605bccbb9024f787cd58f3cb93df03d5532..3d5f38a1ca0206e5bcae4ed49d3df7ce
PersistentEntitySectionManager.this.entitySliceManager.moveEntity((Entity)this.entity); // Paper PersistentEntitySectionManager.this.entitySliceManager.moveEntity((Entity)this.entity); // Paper
Visibility visibility = this.currentSection.getStatus(); final Visibility oldVisibility = visibility; // Paper - diff on change - this should be OLD section visibility Visibility visibility = this.currentSection.getStatus(); final Visibility oldVisibility = visibility; // Paper - diff on change - this should be OLD section visibility
// Paper start // Paper start
@@ -583,6 +598,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A @@ -592,6 +607,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
@Override @Override
public void onRemove(Entity.RemovalReason reason) { public void onRemove(Entity.RemovalReason reason) {

Datei anzeigen

@ -4,16 +4,16 @@ Date: Sun, 24 Oct 2021 15:49:35 +0200
Subject: [PATCH] Fix Bukkit NamespacedKey shenanigans Subject: [PATCH] Fix Bukkit NamespacedKey shenanigans
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
index 6d2e0493729b7b4e109ff103a6ac36c9901568c0..83dd3c254fd10e4596e454cc75c8e5e976b73ac0 100644 index 88e32ed64f90bfd277dac84ba4bd84f0d943f5f8..d4a8c1bbb8fef27ac42bdf27dde495b4c649e6cb 100644
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java --- a/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java +++ b/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
@@ -16,7 +16,7 @@ public class PaperMinecartLootableInventory implements PaperLootableEntityInvent @@ -17,7 +17,7 @@ public class PaperContainerEntityLootableInventory implements PaperLootableEntit
@Override @Override
public org.bukkit.loot.LootTable getLootTable() { public org.bukkit.loot.LootTable getLootTable() {
- return entity.lootTable != null ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.lootTable)) : null; - return entity.getLootTable() != null ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.getLootTable())) : null;
+ return entity.lootTable != null && !entity.lootTable.getPath().isEmpty() ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.lootTable)) : null; + return entity.getLootTable() != null && !entity.getLootTable().getPath().isEmpty() ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.getLootTable())) : null;
} }
@Override @Override

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Fix merchant inventory not closing on entity removal
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 7922ecc1bfeb2d00a7a1bce0431efec4f8c57eec..4c9832ccede082a468e97870b5f6b07bbed652f3 100644 index d5585e1723eebce14c47c4a92ce339915cd936db..fb5c42755703ade855ab727c55c8d72456b59141 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2491,6 +2491,11 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2569,6 +2569,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot end // Spigot end
// Spigot Start // Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Don't respond to ServerboundCommandSuggestionPacket when
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index eeb21a890480f5cae2a25a4af215bd56778b83e5..6d1e3104750b23e9d4b0ddea35e1241f8434a1ac 100644 index 8ceae524899d6aa739f358b8c88968fb4df56481..9c7d1ce759e119b21e942add5e42ad203226d72b 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -770,6 +770,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -801,6 +801,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} }
// Paper end // Paper end
// CraftBukkit end // CraftBukkit end

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Ensure valid vehicle status
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 6f55fa61f4c3291413aab076a46cec2cc103dac5..6b9622c41966843411184493f42b3d4005be533e 100644 index 866e4aa0080363976861fcbfe6aedc380bbc5e53..0a4934cabf5d04b0561d33f5e777f38b2e721608 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -504,7 +504,7 @@ public class ServerPlayer extends Player { @@ -511,7 +511,7 @@ public class ServerPlayer extends Player {
} }
} }

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent softlocked end exit portal generation
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
index 7dbe0bc8082c8e7741f40bbd69bc7d7407945754..ed6ff35a2112cea4faa6e1458d1effc40fce5dd2 100644 index ad5b20fb16b19bb2099c2fd840e8f5c20f345577..d0c864277886d67362d5389e71095020f69abfc3 100644
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
@@ -412,6 +412,11 @@ public class EndDragonFight { @@ -413,6 +413,11 @@ public class EndDragonFight {
} }
} }
@ -17,6 +17,6 @@ index 7dbe0bc8082c8e7741f40bbd69bc7d7407945754..ed6ff35a2112cea4faa6e1458d1effc4
+ this.portalLocation = this.portalLocation.atY(this.level.getMinBuildHeight() + 1); + this.portalLocation = this.portalLocation.atY(this.level.getMinBuildHeight() + 1);
+ } + }
+ // Paper end + // Paper end
endPodiumFeature.place(FeatureConfiguration.NONE, this.level, this.level.getChunkSource().getGenerator(), new Random(), this.portalLocation); endPodiumFeature.place(FeatureConfiguration.NONE, this.level, this.level.getChunkSource().getGenerator(), RandomSource.create(), this.portalLocation);
} }

Datei anzeigen

@ -6,14 +6,14 @@ Subject: [PATCH] Fix CocaoDecorator causing a crash when trying to generate
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java b/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java b/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java
index c1d220726ca0877fb526e710ae07329b4705a8e5..4474586d199a12f1311ee3ad307b342f4be3690e 100644 index 42b4b306ee89a9e422d234bdaa9b43b118f8bd0a..0fc355bd847749f7ce716b283dd571f143824795 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java --- a/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java +++ b/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java
@@ -29,6 +29,7 @@ public class CocoaDecorator extends TreeDecorator { @@ -25,6 +25,7 @@ public class CocoaDecorator extends TreeDecorator {
@Override @Override
public void place(LevelSimulatedReader world, BiConsumer<BlockPos, BlockState> replacer, Random random, List<BlockPos> logPositions, List<BlockPos> leavesPositions) { public void place(TreeDecorator.Context generator) {
+ if (logPositions.isEmpty()) return; // Paper + if (generator.logs().isEmpty()) return; // Paper
if (!(random.nextFloat() >= this.probability)) { RandomSource randomSource = generator.random();
int i = logPositions.get(0).getY(); if (!(randomSource.nextFloat() >= this.probability)) {
logPositions.stream().filter((pos) -> { List<BlockPos> list = generator.logs();

Datei anzeigen

@ -12,10 +12,10 @@ time to save, as flush saving performs a full flush at
the end anyways. the end anyways.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index a578ff8a88ef944516150303e96f8b49bc797f64..9999f9743184ba929635d625c60836c046ededd4 100644 index 3dd3ed91e702858f07c811afdcfa6c111f9e3d61..85c0d3f07b4ede0864f6ab54ad9392b4708330cb 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -928,6 +928,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -944,6 +944,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper end // Paper end
protected void saveAllChunks(boolean flush) { protected void saveAllChunks(boolean flush) {
@ -32,7 +32,7 @@ index a578ff8a88ef944516150303e96f8b49bc797f64..9999f9743184ba929635d625c60836c0
if (flush) { if (flush) {
List<ChunkHolder> list = (List) this.updatingChunks.getVisibleValuesCopy().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).collect(Collectors.toList()); // Paper List<ChunkHolder> list = (List) this.updatingChunks.getVisibleValuesCopy().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).collect(Collectors.toList()); // Paper
MutableBoolean mutableboolean = new MutableBoolean(); MutableBoolean mutableboolean = new MutableBoolean();
@@ -950,6 +960,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -966,6 +976,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}).filter((ichunkaccess) -> { }).filter((ichunkaccess) -> {
return ichunkaccess instanceof ImposterProtoChunk || ichunkaccess instanceof LevelChunk; return ichunkaccess instanceof ImposterProtoChunk || ichunkaccess instanceof LevelChunk;
}).filter(this::save).forEach((ichunkaccess) -> { }).filter(this::save).forEach((ichunkaccess) -> {

Datei anzeigen

@ -26,10 +26,10 @@ index a3e25ebe096a687de0b63f9618c49198ebea2074..98bcdc50770d9ebd5a07b20f872cfc7e
private com.google.common.collect.Table<String, String, Integer> behaviorTickRates; private com.google.common.collect.Table<String, String, Integer> behaviorTickRates;
private void tickRates() { private void tickRates() {
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
index e3897785b055a859bccf6d67eb1a5157f5b54348..ca5d0bb8a8666285075e23f58b7d34ea34f3d94c 100644 index 9459b912615c692de7d0ceb6cf5a1cd3516d438b..c115bb501e971c6479455dd68e85ebdd180b024a 100644
--- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java --- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
+++ b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java +++ b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
@@ -54,9 +54,17 @@ public class LootTable { @@ -56,9 +56,17 @@ public class LootTable {
this.compositeFunction = LootItemFunctions.compose(functions); this.compositeFunction = LootItemFunctions.compose(functions);
} }
@ -48,7 +48,7 @@ index e3897785b055a859bccf6d67eb1a5157f5b54348..ca5d0bb8a8666285075e23f58b7d34ea
lootConsumer.accept(itemstack); lootConsumer.accept(itemstack);
} else { } else {
int i = itemstack.getCount(); int i = itemstack.getCount();
@@ -93,7 +101,7 @@ public class LootTable { @@ -95,7 +103,7 @@ public class LootTable {
} }
public void getRandomItems(LootContext context, Consumer<ItemStack> lootConsumer) { public void getRandomItems(LootContext context, Consumer<ItemStack> lootConsumer) {
@ -56,7 +56,7 @@ index e3897785b055a859bccf6d67eb1a5157f5b54348..ca5d0bb8a8666285075e23f58b7d34ea
+ this.getRandomItemsRaw(context, LootTable.createStackSplitter(lootConsumer, context.getLevel())); // Paper - preserve overstacked items + this.getRandomItemsRaw(context, LootTable.createStackSplitter(lootConsumer, context.getLevel())); // Paper - preserve overstacked items
} }
public List<ItemStack> getRandomItems(LootContext context) { public ObjectArrayList<ItemStack> getRandomItems(LootContext context) {
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java
index 057676201aa2d19032537832849f3857425d357a..b5c6b7280a9c6964e2ad4aa9bd4517146c98e727 100644 index 057676201aa2d19032537832849f3857425d357a..b5c6b7280a9c6964e2ad4aa9bd4517146c98e727 100644
--- a/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java --- a/src/main/java/net/minecraft/world/level/storage/loot/functions/SetContainerContents.java

Datei anzeigen

@ -8,10 +8,10 @@ This is because bukkit uses a separate head rotation field for yaw.
This issue only applies to players. This issue only applies to players.
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 d3b78f536806246d0474a00bd482b69651455ccf..ac6e01dbf4fe30b9e8301d995392a9c6581eae7b 100644 index 406cf22d8b8ad4f3a19ce8091c290f22be05e6bb..d5c715f436afe3adbe63cc6958318a50fbd2b87e 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
@@ -1665,6 +1665,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -1713,6 +1713,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.setXRot(Mth.clamp(pitch, -90.0F, 90.0F) % 360.0F); this.setXRot(Mth.clamp(pitch, -90.0F, 90.0F) % 360.0F);
this.yRotO = this.getYRot(); this.yRotO = this.getYRot();
this.xRotO = this.getXRot(); this.xRotO = this.getXRot();
@ -19,7 +19,7 @@ index d3b78f536806246d0474a00bd482b69651455ccf..ac6e01dbf4fe30b9e8301d995392a9c6
} }
public void absMoveTo(double x, double y, double z) { public void absMoveTo(double x, double y, double z) {
@@ -1703,6 +1704,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -1751,6 +1752,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.setXRot(pitch); this.setXRot(pitch);
this.setOldPosAndRot(); this.setOldPosAndRot();
this.reapplyPosition(); this.reapplyPosition();

Datei anzeigen

@ -36,7 +36,7 @@ index 87c25170fbe8b0591d452612496ee1a627138de7..a2894f02ceb7c58f6eafe055e1ff47b1
private final T tileEntity; private final T tileEntity;
private final T snapshot; private final T snapshot;
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
index 93a8aeb5545c794ac425c35f8af52a443cd060ca..9a4d79973af25853c4173a1df0131830505b623b 100644 index e609cfeaf5aa6807f57360dde9b0dccf40a23eb1..594b071cbb25d6e8f184c8558c3d1f490fe4712f 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
@@ -19,6 +19,7 @@ import net.minecraft.world.level.block.entity.BeehiveBlockEntity; @@ -19,6 +19,7 @@ import net.minecraft.world.level.block.entity.BeehiveBlockEntity;
@ -47,7 +47,7 @@ index 93a8aeb5545c794ac425c35f8af52a443cd060ca..9a4d79973af25853c4173a1df0131830
import net.minecraft.world.level.block.entity.BrewingStandBlockEntity; import net.minecraft.world.level.block.entity.BrewingStandBlockEntity;
import net.minecraft.world.level.block.entity.CampfireBlockEntity; import net.minecraft.world.level.block.entity.CampfireBlockEntity;
import net.minecraft.world.level.block.entity.ChestBlockEntity; import net.minecraft.world.level.block.entity.ChestBlockEntity;
@@ -105,188 +106,55 @@ public final class CraftBlockStates { @@ -108,187 +109,57 @@ public final class CraftBlockStates {
private static final BlockStateFactory<?> DEFAULT_FACTORY = new BlockStateFactory<CraftBlockState>(CraftBlockState.class) { private static final BlockStateFactory<?> DEFAULT_FACTORY = new BlockStateFactory<CraftBlockState>(CraftBlockState.class) {
@Override @Override
public CraftBlockState createBlockState(World world, BlockPos blockPosition, net.minecraft.world.level.block.state.BlockState blockData, BlockEntity tileEntity) { public CraftBlockState createBlockState(World world, BlockPos blockPosition, net.minecraft.world.level.block.state.BlockState blockData, BlockEntity tileEntity) {
@ -81,6 +81,8 @@ index 93a8aeb5545c794ac425c35f8af52a443cd060ca..9a4d79973af25853c4173a1df0131830
- Material.DARK_OAK_WALL_SIGN, - Material.DARK_OAK_WALL_SIGN,
- Material.JUNGLE_SIGN, - Material.JUNGLE_SIGN,
- Material.JUNGLE_WALL_SIGN, - Material.JUNGLE_WALL_SIGN,
- Material.MANGROVE_SIGN,
- Material.MANGROVE_WALL_SIGN,
- Material.OAK_SIGN, - Material.OAK_SIGN,
- Material.OAK_WALL_SIGN, - Material.OAK_WALL_SIGN,
- Material.SPRUCE_SIGN, - Material.SPRUCE_SIGN,
@ -209,18 +211,12 @@ index 93a8aeb5545c794ac425c35f8af52a443cd060ca..9a4d79973af25853c4173a1df0131830
- ), CraftCampfire.class, CraftCampfire::new, CampfireBlockEntity::new - ), CraftCampfire.class, CraftCampfire::new, CampfireBlockEntity::new
- ); - );
- -
- register(
- Arrays.asList(
- Material.CHEST,
- Material.TRAPPED_CHEST
- ), CraftChest.class, CraftChest::new, ChestBlockEntity::new
- );
-
- register(Material.BARREL, CraftBarrel.class, CraftBarrel::new, BarrelBlockEntity::new); - register(Material.BARREL, CraftBarrel.class, CraftBarrel::new, BarrelBlockEntity::new);
- register(Material.BEACON, CraftBeacon.class, CraftBeacon::new, BeaconBlockEntity::new); - register(Material.BEACON, CraftBeacon.class, CraftBeacon::new, BeaconBlockEntity::new);
- register(Material.BELL, CraftBell.class, CraftBell::new, BellBlockEntity::new); - register(Material.BELL, CraftBell.class, CraftBell::new, BellBlockEntity::new);
- register(Material.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new, BlastFurnaceBlockEntity::new); - register(Material.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new, BlastFurnaceBlockEntity::new);
- register(Material.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new, BrewingStandBlockEntity::new); - register(Material.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new, BrewingStandBlockEntity::new);
- register(Material.CHEST, CraftChest.class, CraftChest::new, ChestBlockEntity::new);
- register(Material.COMPARATOR, CraftComparator.class, CraftComparator::new, ComparatorBlockEntity::new); - register(Material.COMPARATOR, CraftComparator.class, CraftComparator::new, ComparatorBlockEntity::new);
- register(Material.CONDUIT, CraftConduit.class, CraftConduit::new, ConduitBlockEntity::new); - register(Material.CONDUIT, CraftConduit.class, CraftConduit::new, ConduitBlockEntity::new);
- register(Material.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new, DaylightDetectorBlockEntity::new); - register(Material.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new, DaylightDetectorBlockEntity::new);
@ -236,10 +232,13 @@ index 93a8aeb5545c794ac425c35f8af52a443cd060ca..9a4d79973af25853c4173a1df0131830
- register(Material.JUKEBOX, CraftJukebox.class, CraftJukebox::new, JukeboxBlockEntity::new); - register(Material.JUKEBOX, CraftJukebox.class, CraftJukebox::new, JukeboxBlockEntity::new);
- register(Material.LECTERN, CraftLectern.class, CraftLectern::new, LecternBlockEntity::new); - register(Material.LECTERN, CraftLectern.class, CraftLectern::new, LecternBlockEntity::new);
- register(Material.MOVING_PISTON, CraftMovingPiston.class, CraftMovingPiston::new, PistonMovingBlockEntity::new); - register(Material.MOVING_PISTON, CraftMovingPiston.class, CraftMovingPiston::new, PistonMovingBlockEntity::new);
- register(Material.SCULK_CATALYST, CraftSculkCatalyst.class, CraftSculkCatalyst::new, SculkCatalystBlockEntity::new);
- register(Material.SCULK_SENSOR, CraftSculkSensor.class, CraftSculkSensor::new, SculkSensorBlockEntity::new); - register(Material.SCULK_SENSOR, CraftSculkSensor.class, CraftSculkSensor::new, SculkSensorBlockEntity::new);
- register(Material.SCULK_SHRIEKER, CraftSculkShrieker.class, CraftSculkShrieker::new, SculkShriekerBlockEntity::new);
- register(Material.SMOKER, CraftSmoker.class, CraftSmoker::new, SmokerBlockEntity::new); - register(Material.SMOKER, CraftSmoker.class, CraftSmoker::new, SmokerBlockEntity::new);
- register(Material.SPAWNER, CraftCreatureSpawner.class, CraftCreatureSpawner::new, SpawnerBlockEntity::new); - register(Material.SPAWNER, CraftCreatureSpawner.class, CraftCreatureSpawner::new, SpawnerBlockEntity::new);
- register(Material.STRUCTURE_BLOCK, CraftStructureBlock.class, CraftStructureBlock::new, StructureBlockEntity::new); - register(Material.STRUCTURE_BLOCK, CraftStructureBlock.class, CraftStructureBlock::new, StructureBlockEntity::new);
- register(Material.TRAPPED_CHEST, CraftChest.class, CraftChest::new, TrappedChestBlockEntity::new);
+ // Paper start - simplify + // Paper start - simplify
+ register(BlockEntityType.SIGN, CraftSign.class, CraftSign::new); + register(BlockEntityType.SIGN, CraftSign.class, CraftSign::new);
+ register(BlockEntityType.SKULL, CraftSkull.class, CraftSkull::new); + register(BlockEntityType.SKULL, CraftSkull.class, CraftSkull::new);
@ -249,13 +248,12 @@ index 93a8aeb5545c794ac425c35f8af52a443cd060ca..9a4d79973af25853c4173a1df0131830
+ register(BlockEntityType.BED, CraftBed.class, CraftBed::new); + register(BlockEntityType.BED, CraftBed.class, CraftBed::new);
+ register(BlockEntityType.BEEHIVE, CraftBeehive.class, CraftBeehive::new); + register(BlockEntityType.BEEHIVE, CraftBeehive.class, CraftBeehive::new);
+ register(BlockEntityType.CAMPFIRE, CraftCampfire.class, CraftCampfire::new); + register(BlockEntityType.CAMPFIRE, CraftCampfire.class, CraftCampfire::new);
+ register(BlockEntityType.CHEST, CraftChest.class, CraftChest::new); // Paper - split up chests due to different block entity types
+ register(BlockEntityType.TRAPPED_CHEST, CraftChest.class, CraftChest::new); // Paper - split up chests due to different block entity types
+ register(BlockEntityType.BARREL, CraftBarrel.class, CraftBarrel::new); + register(BlockEntityType.BARREL, CraftBarrel.class, CraftBarrel::new);
+ register(BlockEntityType.BEACON, CraftBeacon.class, CraftBeacon::new); + register(BlockEntityType.BEACON, CraftBeacon.class, CraftBeacon::new);
+ register(BlockEntityType.BELL, CraftBell.class, CraftBell::new); + register(BlockEntityType.BELL, CraftBell.class, CraftBell::new);
+ register(BlockEntityType.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new); + register(BlockEntityType.BLAST_FURNACE, CraftBlastFurnace.class, CraftBlastFurnace::new);
+ register(BlockEntityType.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new); + register(BlockEntityType.BREWING_STAND, CraftBrewingStand.class, CraftBrewingStand::new);
+ register(BlockEntityType.CHEST, CraftChest.class, CraftChest::new);
+ register(BlockEntityType.COMPARATOR, CraftComparator.class, CraftComparator::new); + register(BlockEntityType.COMPARATOR, CraftComparator.class, CraftComparator::new);
+ register(BlockEntityType.CONDUIT, CraftConduit.class, CraftConduit::new); + register(BlockEntityType.CONDUIT, CraftConduit.class, CraftConduit::new);
+ register(BlockEntityType.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new); + register(BlockEntityType.DAYLIGHT_DETECTOR, CraftDaylightDetector.class, CraftDaylightDetector::new);
@ -271,34 +269,37 @@ index 93a8aeb5545c794ac425c35f8af52a443cd060ca..9a4d79973af25853c4173a1df0131830
+ register(BlockEntityType.JUKEBOX, CraftJukebox.class, CraftJukebox::new); + register(BlockEntityType.JUKEBOX, CraftJukebox.class, CraftJukebox::new);
+ register(BlockEntityType.LECTERN, CraftLectern.class, CraftLectern::new); + register(BlockEntityType.LECTERN, CraftLectern.class, CraftLectern::new);
+ register(BlockEntityType.PISTON, CraftMovingPiston.class, CraftMovingPiston::new); + register(BlockEntityType.PISTON, CraftMovingPiston.class, CraftMovingPiston::new);
+ register(BlockEntityType.SCULK_CATALYST, CraftSculkCatalyst.class, CraftSculkCatalyst::new);
+ register(BlockEntityType.SCULK_SENSOR, CraftSculkSensor.class, CraftSculkSensor::new); + register(BlockEntityType.SCULK_SENSOR, CraftSculkSensor.class, CraftSculkSensor::new);
+ register(BlockEntityType.SCULK_SHRIEKER, CraftSculkShrieker.class, CraftSculkShrieker::new);
+ register(BlockEntityType.SMOKER, CraftSmoker.class, CraftSmoker::new); + register(BlockEntityType.SMOKER, CraftSmoker.class, CraftSmoker::new);
+ register(BlockEntityType.MOB_SPAWNER, CraftCreatureSpawner.class, CraftCreatureSpawner::new); + register(BlockEntityType.MOB_SPAWNER, CraftCreatureSpawner.class, CraftCreatureSpawner::new);
+ register(BlockEntityType.STRUCTURE_BLOCK, CraftStructureBlock.class, CraftStructureBlock::new); + register(BlockEntityType.STRUCTURE_BLOCK, CraftStructureBlock.class, CraftStructureBlock::new);
+ register(BlockEntityType.TRAPPED_CHEST, CraftChest.class, CraftChest::new);
+ // Paper end + // Paper end
} }
private static void register(Material blockType, BlockStateFactory<?> factory) { private static void register(Material blockType, BlockStateFactory<?> factory) {
@@ -294,35 +162,45 @@ public final class CraftBlockStates { @@ -296,30 +167,33 @@ public final class CraftBlockStates {
} }
private static <T extends BlockEntity, B extends CraftBlockEntityState<T>> void register( private static <T extends BlockEntity, B extends CraftBlockEntityState<T>> void register(
- Material blockType, - Material blockType,
- Class<B> blockStateType,
- BiFunction<World, T, B> blockStateConstructor,
- BiFunction<BlockPos, net.minecraft.world.level.block.state.BlockState, T> tileEntityConstructor
- ) {
- CraftBlockStates.register(Collections.singletonList(blockType), blockStateType, blockStateConstructor, tileEntityConstructor);
- }
-
- private static <T extends BlockEntity, B extends CraftBlockEntityState<T>> void register(
- List<Material> blockTypes,
+ net.minecraft.world.level.block.entity.BlockEntityType<? extends T> blockEntityType, // Paper + net.minecraft.world.level.block.entity.BlockEntityType<? extends T> blockEntityType, // Paper
Class<B> blockStateType, Class<B> blockStateType,
- BiFunction<World, T, B> blockStateConstructor, - BiFunction<World, T, B> blockStateConstructor,
- BiFunction<BlockPos, net.minecraft.world.level.block.state.BlockState, T> tileEntityConstructor - BiFunction<BlockPos, net.minecraft.world.level.block.state.BlockState, T> tileEntityConstructor
+ BiFunction<World, T, B> blockStateConstructor // Paper + BiFunction<World, T, B> blockStateConstructor // Paper
) { ) {
- CraftBlockStates.register(Collections.singletonList(blockType), blockStateType, blockStateConstructor, tileEntityConstructor);
- }
-
- private static <T extends BlockEntity, B extends CraftBlockEntityState<T>> void register(
- List<Material> blockTypes,
- Class<B> blockStateType,
- BiFunction<World, T, B> blockStateConstructor,
- BiFunction<BlockPos, net.minecraft.world.level.block.state.BlockState, T> tileEntityConstructor
- ) {
- BlockStateFactory<B> factory = new BlockEntityStateFactory<>(blockStateType, blockStateConstructor, tileEntityConstructor); - BlockStateFactory<B> factory = new BlockEntityStateFactory<>(blockStateType, blockStateConstructor, tileEntityConstructor);
- for (Material blockType : blockTypes) { - for (Material blockType : blockTypes) {
- CraftBlockStates.register(blockType, factory); - CraftBlockStates.register(blockType, factory);
@ -328,6 +329,8 @@ index 93a8aeb5545c794ac425c35f8af52a443cd060ca..9a4d79973af25853c4173a1df0131830
public static Class<? extends CraftBlockState> getBlockStateType(Material material) { public static Class<? extends CraftBlockState> getBlockStateType(Material material) {
Preconditions.checkNotNull(material, "material is null"); Preconditions.checkNotNull(material, "material is null");
return CraftBlockStates.getFactory(material).blockStateType; return CraftBlockStates.getFactory(material).blockStateType;
@@ -335,6 +209,13 @@ public final class CraftBlockStates {
return null;
} }
+ // Paper start + // Paper start
@ -340,7 +343,7 @@ index 93a8aeb5545c794ac425c35f8af52a443cd060ca..9a4d79973af25853c4173a1df0131830
public static BlockState getBlockState(Block block) { public static BlockState getBlockState(Block block) {
// Paper start // Paper start
return CraftBlockStates.getBlockState(block, true); return CraftBlockStates.getBlockState(block, true);
@@ -380,7 +258,7 @@ public final class CraftBlockStates { @@ -392,7 +273,7 @@ public final class CraftBlockStates {
if (world != null && tileEntity == null && CraftBlockStates.isTileEntityOptional(material)) { if (world != null && tileEntity == null && CraftBlockStates.isTileEntityOptional(material)) {
factory = CraftBlockStates.DEFAULT_FACTORY; factory = CraftBlockStates.DEFAULT_FACTORY;
} else { } else {
@ -350,10 +353,10 @@ index 93a8aeb5545c794ac425c35f8af52a443cd060ca..9a4d79973af25853c4173a1df0131830
return factory.createBlockState(world, blockPosition, blockData, tileEntity); return factory.createBlockState(world, blockPosition, blockData, tileEntity);
} }
diff --git a/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java b/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java diff --git a/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java b/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java
index 738227d8dbab8460d2bd7f75098e91bcae2d1ff3..8980163dabdd21d040bc7e622e9a22d01f73005b 100644 index 15f760c4c71a0493c7c18c3908d229f6b8778a43..95e4a4080a4a168b53f69d9cd7d67c27263c1b7f 100644
--- a/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java --- a/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java +++ b/src/test/java/org/bukkit/craftbukkit/block/BlockStateTest.java
@@ -26,4 +26,11 @@ public class BlockStateTest extends AbstractTestingBase { @@ -45,4 +45,11 @@ public class BlockStateTest extends AbstractTestingBase {
} }
} }
} }

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add config option for logging player ip addresses
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 5203a43d707010f6ba43be2d6627d48560b77731..fa912cffb2349914d1a550d3d1c69ba5934658dc 100644 index 4b828da7f8dbadb8af66ffc04d631273cfccdf36..a98cd0aecc034038d81194fd87c4f8df65b86095 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -91,6 +91,11 @@ public class PaperConfig { @@ -91,6 +91,11 @@ public class PaperConfig {
@ -21,7 +21,7 @@ index 5203a43d707010f6ba43be2d6627d48560b77731..fa912cffb2349914d1a550d3d1c69ba5
private static void maxJoinsPerTick() { private static void maxJoinsPerTick() {
maxJoinsPerTick = getInt("settings.max-joins-per-tick", 3); maxJoinsPerTick = getInt("settings.max-joins-per-tick", 3);
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index f7bb26e8b7a74a9ae5b469351b2fccc6fc80ab6a..230f5adc4df1679597f5b9aa9fcd36501efbebdd 100644 index c8012de68b997d6270ba4a5d79bc93c09ff4354f..2c593125f74c4ffe2b8bf542311cd5525f600f4b 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java --- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java +++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
@@ -51,10 +51,11 @@ public class PacketUtils { @@ -51,10 +51,11 @@ public class PacketUtils {
@ -36,7 +36,7 @@ index f7bb26e8b7a74a9ae5b469351b2fccc6fc80ab6a..230f5adc4df1679597f5b9aa9fcd3650
- LOGGER.error("Error whilst processing packet {} for connection from {}", packet, networkmanager.getRemoteAddress(), exception); - LOGGER.error("Error whilst processing packet {} for connection from {}", packet, networkmanager.getRemoteAddress(), exception);
+ LOGGER.error("Error whilst processing packet {} for connection from {}", packet, playerIP, exception); // Paper + LOGGER.error("Error whilst processing packet {} for connection from {}", packet, playerIP, exception); // Paper
} }
net.minecraft.network.chat.TextComponent error = new net.minecraft.network.chat.TextComponent("Packet processing error"); net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error");
networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), (future) -> { networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), (future) -> {
diff --git a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java diff --git a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
index 53e87ea23dacd123cc47bd8ca43d0f19e69acaf2..a03cb44f2296b7df60fa39879e54a5c56b22a3d5 100644 index 53e87ea23dacd123cc47bd8ca43d0f19e69acaf2..a03cb44f2296b7df60fa39879e54a5c56b22a3d5 100644
@ -52,23 +52,23 @@ index 53e87ea23dacd123cc47bd8ca43d0f19e69acaf2..a03cb44f2296b7df60fa39879e54a5c5
InetSocketAddress virtualHost = com.destroystokyo.paper.network.PaperNetworkClient.prepareVirtualHost(host, port); InetSocketAddress virtualHost = com.destroystokyo.paper.network.PaperNetworkClient.prepareVirtualHost(host, port);
com.destroystokyo.paper.event.server.PaperServerListPingEvent event = com.destroystokyo.paper.network.PaperLegacyStatusClient.processRequest( com.destroystokyo.paper.event.server.PaperServerListPingEvent event = com.destroystokyo.paper.network.PaperLegacyStatusClient.processRequest(
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index af4d9244102bd0ac204f44a8de7f3a7706e3692d..058fb3696c7ece4a7b6971886b1760b26add733b 100644 index af3e70920221b6bd127bb3aed7f1e0a7e9e4c322..510a1fc4e315483809035b1e5c28b441f18a7c14 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -204,7 +204,7 @@ public class ServerConnectionListener { @@ -205,7 +205,7 @@ public class ServerConnectionListener {
throw new ReportedException(CrashReport.forThrowable(exception, "Ticking memory connection")); throw new ReportedException(CrashReport.forThrowable(exception, "Ticking memory connection"));
} }
- ServerConnectionListener.LOGGER.warn("Failed to handle packet for {}", networkmanager.getRemoteAddress(), exception); - ServerConnectionListener.LOGGER.warn("Failed to handle packet for {}", networkmanager.getRemoteAddress(), exception);
+ ServerConnectionListener.LOGGER.warn("Failed to handle packet for {}", com.destroystokyo.paper.PaperConfig.logPlayerIpAddresses ? String.valueOf(networkmanager.getRemoteAddress()) : "<ip address withheld>", exception); // Paper + ServerConnectionListener.LOGGER.warn("Failed to handle packet for {}", com.destroystokyo.paper.PaperConfig.logPlayerIpAddresses ? String.valueOf(networkmanager.getRemoteAddress()) : "<ip address withheld>", exception); // Paper
TextComponent chatcomponenttext = new TextComponent("Internal server error"); MutableComponent ichatmutablecomponent = Component.literal("Internal server error");
networkmanager.send(new ClientboundDisconnectPacket(chatcomponenttext), (future) -> { networkmanager.send(new ClientboundDisconnectPacket(ichatmutablecomponent), (future) -> {
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 4cd92875d60c2f1dcce67ac99e9ba257a10f87b1..f5c1dff1d571e89f960f11400edbcbbea0620575 100644 index b146fc81ebd4adb8c15b10ed05c92db202a2c89e..38521660c6fa7c1a19c5268dac05928b5ec983f4 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -220,7 +220,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener @@ -230,7 +230,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
} }
public String getUserName() { public String getUserName() {
@ -79,12 +79,12 @@ index 4cd92875d60c2f1dcce67ac99e9ba257a10f87b1..f5c1dff1d571e89f960f11400edbcbbe
+ // Paper end + // Paper end
} }
@Override @Nullable
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 6b3ab58a4446e9ce6f91f870ef8b2511522e0da0..2aa31d8ad15100b3a25dd7da41bf17b126ba937e 100644 index ed0e162c39f1f1ed9b02cdb2fc353a3fcbe79182..082a16f49c07faadce68fc118b2fff859da422d0 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
@@ -238,7 +238,7 @@ public abstract class PlayerList { @@ -240,7 +240,7 @@ public abstract class PlayerList {
final String s1; final String s1;
if (connection.getRemoteAddress() != null) { if (connection.getRemoteAddress() != null) {

Datei anzeigen

@ -79,10 +79,10 @@ index 98bcdc50770d9ebd5a07b20f872cfc7ef78daa94..409cffcf74b32beba09b2fe800d1329e
return getIntOrDefault(behaviorTickRates, typeName, entityType, def); return getIntOrDefault(behaviorTickRates, typeName, entityType, def);
} }
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
index a3af8b892a01756addc8c24e0726b5a8a700cbba..d5930d8ced9566c5494bed3685cf2d536eef6d50 100644 index 36940a873b2f891a50009fd44a2793c1940d2b05..05c8b3f54ecb4221dcbf37574240401d93e14e7a 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -535,7 +535,7 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource { @@ -530,7 +530,7 @@ public abstract class ChunkGenerator {
int j = list.size(); int j = list.size();
try { try {
@ -91,7 +91,7 @@ index a3af8b892a01756addc8c24e0726b5a8a700cbba..d5930d8ced9566c5494bed3685cf2d53
int k = Math.max(GenerationStep.Decoration.values().length, j); int k = Math.max(GenerationStep.Decoration.values().length, j);
for (int l = 0; l < k; ++l) { for (int l = 0; l < k; ++l) {
@@ -608,7 +608,15 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource { @@ -603,7 +603,15 @@ public abstract class ChunkGenerator {
return (String) optional.orElseGet(placedfeature::toString); return (String) optional.orElseGet(placedfeature::toString);
}; };

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] VanillaCommandWrapper didnt account for entity senders
diff --git a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java diff --git a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
index e9d1fb479855194da5a05e86861848158736cbb4..4aa1dc543950b5de64345b3403a6d0bc41c521df 100644 index 8dca2ad7d25f740941187698d77819af8ebc2805..6df44aa60d2b41b95fe79ed4cf92a6d3369400ea 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java --- a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java +++ b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
@@ -64,8 +64,10 @@ public final class VanillaCommandWrapper extends BukkitCommand { @@ -64,8 +64,10 @@ public final class VanillaCommandWrapper extends BukkitCommand {

Datei anzeigen

@ -57,10 +57,10 @@ index 0000000000000000000000000000000000000000..6bd0afddbcc461149dfe9a5c7a86fff6
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 939745227346e6d23e50f942eb48ab97c4ab6190..e28e09aae1d95d9bed50a137e999e6d457e62478 100644 index 5cc3a55b90135f0aa97c5faaf6c1b6f4d6fe9a0e..1236c3ce776ad6bea9a3a5156e89b0e9c0b9afb5 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -191,6 +191,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -184,6 +184,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
} }

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] don't attempt to teleport dead entities
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 ac6e01dbf4fe30b9e8301d995392a9c6581eae7b..53588a621fb922112da7c585a09ba331fa03e858 100644 index d5c715f436afe3adbe63cc6958318a50fbd2b87e..757abf11362fa9e402dd6dd44c3bfc0ad74c5021 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
@@ -716,7 +716,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -738,7 +738,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
// CraftBukkit start // CraftBukkit start
public void postTick() { public void postTick() {
// No clean way to break out of ticking once the entity has been copied to a new world, so instead we move the portalling later in the tick cycle // No clean way to break out of ticking once the entity has been copied to a new world, so instead we move the portalling later in the tick cycle

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent excessive velocity through repeated crits
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 d49d9d60a839d5ac5d67a677fcbae2897e54dada..18dfc235f17510ae9eda3ffd7c04b7aa8c4aac89 100644 index a32aa337c890eabeb400903df153aff323bc8645..abae967b466ed64c2c995130589320c8a58128d2 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
@@ -2594,14 +2594,27 @@ public abstract class LivingEntity extends Entity { @@ -2626,14 +2626,27 @@ public abstract class LivingEntity extends Entity {
return this.hasEffect(MobEffects.JUMP) ? (double) (0.1F * (float) (this.getEffect(MobEffects.JUMP).getAmplifier() + 1)) : 0.0D; return this.hasEffect(MobEffects.JUMP) ? (double) (0.1F * (float) (this.getEffect(MobEffects.JUMP).getAmplifier() + 1)) : 0.0D;
} }

Datei anzeigen

@ -7,10 +7,10 @@ Subject: [PATCH] Remove client-side code using deprecated for removal
Fixes warnings on build Fixes warnings on build
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index ab524d5bd579ad56fd6fc7808e9060953a1c21c3..f09ac28a49863c02491d38342ecd6237c0511d5c 100644 index e8f5f87962cd3dbd383096fc4df9c3f0d5399211..c540b695282e2cca97cc4e3320d641befa19c1c6 100644
--- a/src/main/java/net/minecraft/Util.java --- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java
@@ -23,7 +23,6 @@ import java.net.URL; @@ -27,7 +27,6 @@ import java.net.URL;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.spi.FileSystemProvider; import java.nio.file.spi.FileSystemProvider;
@ -18,7 +18,7 @@ index ab524d5bd579ad56fd6fc7808e9060953a1c21c3..f09ac28a49863c02491d38342ecd6237
import java.security.PrivilegedActionException; import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction; import java.security.PrivilegedExceptionAction;
import java.time.Duration; import java.time.Duration;
@@ -763,21 +762,7 @@ public class Util { @@ -883,21 +882,7 @@ public class Util {
} }
public void openUrl(URL url) { public void openUrl(URL url) {

Datei anzeigen

@ -332,10 +332,10 @@ index 0000000000000000000000000000000000000000..4a04eb6449d33d3f15c354b2ac98198f
+} +}
diff --git a/src/main/java/ca/spottedleaf/starlight/common/light/SWMRNibbleArray.java b/src/main/java/ca/spottedleaf/starlight/common/light/SWMRNibbleArray.java diff --git a/src/main/java/ca/spottedleaf/starlight/common/light/SWMRNibbleArray.java b/src/main/java/ca/spottedleaf/starlight/common/light/SWMRNibbleArray.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..5d4feec98b0d2ca014fe963daccebebb07af6394 index 0000000000000000000000000000000000000000..4ffb4ffe01c4628d52742c5c0bbd35220eea6294
--- /dev/null --- /dev/null
+++ b/src/main/java/ca/spottedleaf/starlight/common/light/SWMRNibbleArray.java +++ b/src/main/java/ca/spottedleaf/starlight/common/light/SWMRNibbleArray.java
@@ -0,0 +1,436 @@ @@ -0,0 +1,440 @@
+package ca.spottedleaf.starlight.common.light; +package ca.spottedleaf.starlight.common.light;
+ +
+import net.minecraft.world.level.chunk.DataLayer; +import net.minecraft.world.level.chunk.DataLayer;
@ -515,13 +515,17 @@ index 0000000000000000000000000000000000000000..5d4feec98b0d2ca014fe963daccebebb
+ final byte[] src = other.storageUpdating; + final byte[] src = other.storageUpdating;
+ final byte[] into; + final byte[] into;
+ +
+ if (this.storageUpdating != null) { + if (!this.updatingDirty) {
+ into = this.storageUpdating; + if (this.storageUpdating != null) {
+ into = this.storageUpdating = allocateBytes();
+ } else {
+ this.storageUpdating = into = allocateBytes();
+ this.stateUpdating = INIT_STATE_INIT;
+ }
+ this.updatingDirty = true;
+ } else { + } else {
+ this.storageUpdating = into = allocateBytes(); + into = this.storageUpdating;
+ this.stateUpdating = INIT_STATE_INIT;
+ } + }
+ this.updatingDirty = true;
+ +
+ final int start = 0; + final int start = 0;
+ final int end = (15 | (15 << 4)) >>> 1; + final int end = (15 | (15 << 4)) >>> 1;
@ -4104,10 +4108,10 @@ index 0000000000000000000000000000000000000000..177d0a969f3d72a34e773e8309c3719a
+} +}
diff --git a/src/main/java/ca/spottedleaf/starlight/common/util/SaveUtil.java b/src/main/java/ca/spottedleaf/starlight/common/util/SaveUtil.java diff --git a/src/main/java/ca/spottedleaf/starlight/common/util/SaveUtil.java b/src/main/java/ca/spottedleaf/starlight/common/util/SaveUtil.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..28c946390221613a442fba90901ba6af94e38902 index 0000000000000000000000000000000000000000..9892863af9f94ab8e378652df2a7ccfebb8c7f41
--- /dev/null --- /dev/null
+++ b/src/main/java/ca/spottedleaf/starlight/common/util/SaveUtil.java +++ b/src/main/java/ca/spottedleaf/starlight/common/util/SaveUtil.java
@@ -0,0 +1,183 @@ @@ -0,0 +1,187 @@
+package ca.spottedleaf.starlight.common.util; +package ca.spottedleaf.starlight.common.util;
+ +
+import ca.spottedleaf.starlight.common.light.SWMRNibbleArray; +import ca.spottedleaf.starlight.common.light.SWMRNibbleArray;
@ -4126,7 +4130,11 @@ index 0000000000000000000000000000000000000000..28c946390221613a442fba90901ba6af
+ +
+ private static final Logger LOGGER = LogUtils.getLogger(); + private static final Logger LOGGER = LogUtils.getLogger();
+ +
+ private static final int STARLIGHT_LIGHT_VERSION = 6; + private static final int STARLIGHT_LIGHT_VERSION = 8;
+
+ public static int getLightVersion() {
+ return STARLIGHT_LIGHT_VERSION;
+ }
+ +
+ private static final String BLOCKLIGHT_STATE_TAG = "starlight.blocklight_state"; + private static final String BLOCKLIGHT_STATE_TAG = "starlight.blocklight_state";
+ private static final String SKYLIGHT_STATE_TAG = "starlight.skylight_state"; + private static final String SKYLIGHT_STATE_TAG = "starlight.skylight_state";
@ -4249,7 +4257,7 @@ index 0000000000000000000000000000000000000000..28c946390221613a442fba90901ba6af
+ SWMRNibbleArray[] skyNibbles = StarLightEngine.getFilledEmptyLight(world); + SWMRNibbleArray[] skyNibbles = StarLightEngine.getFilledEmptyLight(world);
+ +
+ +
+ // start copy from from the original method + // start copy from the original method
+ boolean lit = tag.get("isLightOn") != null && tag.getInt(STARLIGHT_VERSION_TAG) == STARLIGHT_LIGHT_VERSION; + boolean lit = tag.get("isLightOn") != null && tag.getInt(STARLIGHT_VERSION_TAG) == STARLIGHT_LIGHT_VERSION;
+ boolean canReadSky = world.dimensionType().hasSkyLight(); + boolean canReadSky = world.dimensionType().hasSkyLight();
+ ChunkStatus status = ChunkStatus.byName(tag.getString("Status")); + ChunkStatus status = ChunkStatus.byName(tag.getString("Status"));
@ -4419,7 +4427,7 @@ index dcda01dd8668c7ef7c63709179135deafb83eee5..5f079cf06b0d1505bfb3fda5c326b2d7
Deque<ChunkPos> queue = new ArrayDeque<>(MCUtil.getSpiralOutChunks(center, radius)); Deque<ChunkPos> queue = new ArrayDeque<>(MCUtil.getSpiralOutChunks(center, radius));
updateLight(sender, world, lightengine, queue); updateLight(sender, world, lightengine, queue);
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 09616415e8f11d40435dc81282b818ac9cbbdcbe..d061dc4b5de6b629d6ddcdbfe9ca652dfcec8952 100644 index 7471e5e94b9b4a4f9100b445ca85c74875007330..100c33b8c96c9e0b20a641e31f671147c04df94e 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -55,7 +55,7 @@ public class ChunkHolder { @@ -55,7 +55,7 @@ public class ChunkHolder {
@ -4432,10 +4440,10 @@ index 09616415e8f11d40435dc81282b818ac9cbbdcbe..d061dc4b5de6b629d6ddcdbfe9ca652d
private final DebugBuffer<ChunkHolder.ChunkSaveDebug> chunkToSaveHistory; private final DebugBuffer<ChunkHolder.ChunkSaveDebug> chunkToSaveHistory;
public int oldTicketLevel; public int oldTicketLevel;
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 9999f9743184ba929635d625c60836c046ededd4..727ee42ec573fd1d008f526f49d0e63396ef0a9d 100644 index 85c0d3f07b4ede0864f6ab54ad9392b4708330cb..6bae8378c14aa1ae35cf31f284bda2fcc61f1322 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -133,7 +133,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -136,7 +136,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public final LongSet entitiesInLevel; public final LongSet entitiesInLevel;
public final ServerLevel level; public final ServerLevel level;
private final ThreadedLevelLightEngine lightEngine; private final ThreadedLevelLightEngine lightEngine;
@ -4443,7 +4451,7 @@ index 9999f9743184ba929635d625c60836c046ededd4..727ee42ec573fd1d008f526f49d0e633
+ public final BlockableEventLoop<Runnable> mainThreadExecutor; // Paper - public + public final BlockableEventLoop<Runnable> mainThreadExecutor; // Paper - public
final java.util.concurrent.Executor mainInvokingExecutor; // Paper final java.util.concurrent.Executor mainInvokingExecutor; // Paper
public ChunkGenerator generator; public ChunkGenerator generator;
public final Supplier<DimensionDataStorage> overworldDataStorage; private RandomState randomState;
diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java
index ea4e46c113d3f0a5db6c891021e2e4c5eb275cd4..b22c771ca35466574d5a73f2da3fc8762cb29487 100644 index ea4e46c113d3f0a5db6c891021e2e4c5eb275cd4..b22c771ca35466574d5a73f2da3fc8762cb29487 100644
--- a/src/main/java/net/minecraft/server/level/DistanceManager.java --- a/src/main/java/net/minecraft/server/level/DistanceManager.java
@ -4458,7 +4466,7 @@ index ea4e46c113d3f0a5db6c891021e2e4c5eb275cd4..b22c771ca35466574d5a73f2da3fc876
while (objectiterator.hasNext()) { while (objectiterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java diff --git a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java
index bd475554a630fb68433dd6e6640586cf5240cfed..d572d44bdc053c29b2b10f4720d4b940fc47252f 100644 index 5539f2a7e069cbe98997b734f3b1cd498148f09b..53a4bf5815eb05bf1a4c82c08dd5a51c9ce913b8 100644
--- a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java --- a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java
+++ b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java +++ b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java
@@ -23,6 +23,17 @@ import net.minecraft.world.level.chunk.LightChunkGetter; @@ -23,6 +23,17 @@ import net.minecraft.world.level.chunk.LightChunkGetter;
@ -4712,7 +4720,7 @@ index bd475554a630fb68433dd6e6640586cf5240cfed..d572d44bdc053c29b2b10f4720d4b940
this.addTask(pos.x, pos.z, () -> { this.addTask(pos.x, pos.z, () -> {
return 0; return 0;
}, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { }, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> {
@@ -262,6 +430,37 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl @@ -274,6 +442,37 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
} }
public CompletableFuture<ChunkAccess> lightChunk(ChunkAccess chunk, boolean excludeBlocks) { public CompletableFuture<ChunkAccess> lightChunk(ChunkAccess chunk, boolean excludeBlocks) {
@ -4750,7 +4758,7 @@ index bd475554a630fb68433dd6e6640586cf5240cfed..d572d44bdc053c29b2b10f4720d4b940
ChunkPos chunkPos = chunk.getPos(); ChunkPos chunkPos = chunk.getPos();
// Paper start // Paper start
//ichunkaccess.b(false); // Don't need to disable this //ichunkaccess.b(false); // Don't need to disable this
@@ -304,7 +503,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl @@ -316,7 +515,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
} }
public void tryScheduleUpdate() { public void tryScheduleUpdate() {
@ -4759,7 +4767,7 @@ index bd475554a630fb68433dd6e6640586cf5240cfed..d572d44bdc053c29b2b10f4720d4b940
this.taskMailbox.tell(() -> { this.taskMailbox.tell(() -> {
this.runUpdate(); this.runUpdate();
this.scheduled.set(false); this.scheduled.set(false);
@@ -321,12 +520,12 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl @@ -333,12 +532,12 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl
if (queue.poll(pre, post)) { if (queue.poll(pre, post)) {
pre.forEach(Runnable::run); pre.forEach(Runnable::run);
pre.clear(); pre.clear();
@ -4787,18 +4795,18 @@ index 41ddcf6775f99c56cf4b13b284420061e5dd6bdc..ae46429264e6a7e5c88b6b6a41a6df4d
public static <T> TicketType<T> create(String name, Comparator<T> argumentComparator) { public static <T> TicketType<T> create(String name, Comparator<T> argumentComparator) {
return new TicketType<>(name, argumentComparator, 0L); return new TicketType<>(name, argumentComparator, 0L);
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index 471c4600c6663375eb340c190edaee330bf59ef2..d545b05cfbb14e5a15b26efe372509e498605016 100644 index 254ac28e692cf06c3286c8f4c6edb9de412851a2..b8541b54886fc1f48b4c99cf449284ffece1a78a 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -686,6 +686,7 @@ public abstract class BlockBehaviour { @@ -700,6 +700,7 @@ public abstract class BlockBehaviour {
this.isViewBlocking = blockbase_info.isViewBlocking;
this.hasPostProcess = blockbase_info.hasPostProcess; this.hasPostProcess = blockbase_info.hasPostProcess;
this.emissiveRendering = blockbase_info.emissiveRendering; this.emissiveRendering = blockbase_info.emissiveRendering;
this.offsetType = (BlockBehaviour.OffsetType) blockbase_info.offsetType.apply(this.asState());
+ this.conditionallyFullOpaque = this.isOpaque() & this.isTransparentOnSomeFaces(); // Paper + this.conditionallyFullOpaque = this.isOpaque() & this.isTransparentOnSomeFaces(); // Paper
} }
// Paper start - impl cached craft block data, lazy load to fix issue with loading at the wrong time // Paper start - impl cached craft block data, lazy load to fix issue with loading at the wrong time
private org.bukkit.craftbukkit.block.data.CraftBlockData cachedCraftBlockData; private org.bukkit.craftbukkit.block.data.CraftBlockData cachedCraftBlockData;
@@ -706,6 +707,18 @@ public abstract class BlockBehaviour { @@ -720,6 +721,18 @@ public abstract class BlockBehaviour {
protected boolean isTicking; protected boolean isTicking;
protected FluidState fluid; protected FluidState fluid;
// Paper end // Paper end
@ -4817,7 +4825,7 @@ index 471c4600c6663375eb340c190edaee330bf59ef2..d545b05cfbb14e5a15b26efe372509e4
public void initCache() { public void initCache() {
this.fluid = this.getBlock().getFluidState(this.asState()); // Paper - moved from getFluid() this.fluid = this.getBlock().getFluidState(this.asState()); // Paper - moved from getFluid()
@@ -714,6 +727,7 @@ public abstract class BlockBehaviour { @@ -728,6 +741,7 @@ public abstract class BlockBehaviour {
this.cache = new BlockBehaviour.BlockStateBase.Cache(this.asState()); this.cache = new BlockBehaviour.BlockStateBase.Cache(this.asState());
} }
this.shapeExceedsCube = this.cache == null || this.cache.largeCollisionShape; // Paper - moved from actual method to here this.shapeExceedsCube = this.cache == null || this.cache.largeCollisionShape; // Paper - moved from actual method to here
@ -4826,10 +4834,10 @@ index 471c4600c6663375eb340c190edaee330bf59ef2..d545b05cfbb14e5a15b26efe372509e4
} }
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
index 20b288fdef75c9994b174cb4d7d082c5e69eb26b..08433670b54c67319ce13ac3ef0f24bd3f819ea0 100644 index bef890d2e8d883165a48a7f5b39a865198749a0b..8d7d10f620b30c35d2ef580ea914f2c62054a785 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java --- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
@@ -84,6 +84,47 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom @@ -81,6 +81,47 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
private static final org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry(); private static final org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry();
public org.bukkit.craftbukkit.persistence.DirtyCraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.DirtyCraftPersistentDataContainer(ChunkAccess.DATA_TYPE_REGISTRY); public org.bukkit.craftbukkit.persistence.DirtyCraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.DirtyCraftPersistentDataContainer(ChunkAccess.DATA_TYPE_REGISTRY);
// CraftBukkit end // CraftBukkit end
@ -4921,7 +4929,7 @@ index a9c65c8d36e5c7080133706df1363b3ce52e3370..d1b175f2bb1bc96e4f044a97b14721fe
@Override @Override
public BlockState getBlockState(int x, int y, int z) { public BlockState getBlockState(int x, int y, int z) {
diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
index 37e7f766e0de7b47c7240c9365bb134fda26a756..cac036ac3c7abb520fbd97b9cea4fb1c275a494b 100644 index ca46ed27fdc1eef979829d19b9e90db6d5c59e09..c37bb3125334a3a4c6c05e57289d758ffabe0558 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java
@@ -31,6 +31,48 @@ public class ImposterProtoChunk extends ProtoChunk { @@ -31,6 +31,48 @@ public class ImposterProtoChunk extends ProtoChunk {
@ -4974,7 +4982,7 @@ index 37e7f766e0de7b47c7240c9365bb134fda26a756..cac036ac3c7abb520fbd97b9cea4fb1c
super(wrapped.getPos(), UpgradeData.EMPTY, wrapped.levelHeightAccessor, wrapped.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), wrapped.getBlendingData()); super(wrapped.getPos(), UpgradeData.EMPTY, wrapped.levelHeightAccessor, wrapped.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), wrapped.getBlendingData());
this.wrapped = wrapped; this.wrapped = wrapped;
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 14f956ad7c305a4d22370d705a70f77e65861007..72b5d63127fbcd2913309f2c3c438b88728b4673 100644 index b57e8e21d75fae24a31effedce2e3c53d9e7d66f..9cce218623a71955687817a6317ed519f3300368 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -100,6 +100,10 @@ public class LevelChunk extends ChunkAccess { @@ -100,6 +100,10 @@ public class LevelChunk extends ChunkAccess {
@ -5002,10 +5010,10 @@ index 14f956ad7c305a4d22370d705a70f77e65861007..72b5d63127fbcd2913309f2c3c438b88
while (iterator.hasNext()) { while (iterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
index 73d0a52e0b9bcd81caf5c8a91c3d8052ad6d1da8..a34a52c827a631336ec08d037fd662ed1a026742 100644 index 6fb87dcdc4fab4b430a5c9003548c874e6b26734..08e1309e618377d170c446a1568c21b7bf4e5683 100644
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
@@ -186,7 +186,7 @@ public class PalettedContainer<T> implements PaletteResize<T> { @@ -204,7 +204,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
return this.get(this.strategy.getIndex(x, y, z)); return this.get(this.strategy.getIndex(x, y, z));
} }
@ -5015,7 +5023,7 @@ index 73d0a52e0b9bcd81caf5c8a91c3d8052ad6d1da8..a34a52c827a631336ec08d037fd662ed
return data.palette.valueFor(data.storage.get(index)); return data.palette.valueFor(data.storage.get(index));
} }
diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
index d3d2bd5ea57254a4af0572d5dab460127718ce09..3cd5c346425c63e511324ad11b120e281df4a56a 100644 index 5ce6a2b83546f4dbc3183a386f51b4bacc173744..a7231ceda4f3e96c0e0c11eee953f129dc9e4487 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
@@ -55,6 +55,12 @@ public class ProtoChunk extends ChunkAccess { @@ -55,6 +55,12 @@ public class ProtoChunk extends ChunkAccess {
@ -5032,12 +5040,12 @@ index d3d2bd5ea57254a4af0572d5dab460127718ce09..3cd5c346425c63e511324ad11b120e28
this.fluidTicks = fluidTickScheduler; this.fluidTicks = fluidTickScheduler;
} }
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 61b26c2cb332afd7215c013fbdf144b4a023d898..54ade15cdab222e9818f2635a8a12418e78e1ce6 100644 index be9c15fe141ede1132dbe07ba4bfcf22036ab194..3c220d833ca6bb9409bc71d6f61e61783dba236b 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
@@ -87,6 +87,14 @@ public class ChunkSerializer { @@ -94,6 +94,14 @@ public class ChunkSerializer {
private static final String BLOCK_TICKS_TAG = "block_ticks"; public static final String BLOCK_LIGHT_TAG = "BlockLight";
private static final String FLUID_TICKS_TAG = "fluid_ticks"; public static final String SKY_LIGHT_TAG = "SkyLight";
+ // Paper start - replace light engine impl + // Paper start - replace light engine impl
+ private static final int STARLIGHT_LIGHT_VERSION = 7; + private static final int STARLIGHT_LIGHT_VERSION = 7;
@ -5050,7 +5058,7 @@ index 61b26c2cb332afd7215c013fbdf144b4a023d898..54ade15cdab222e9818f2635a8a12418
public ChunkSerializer() {} public ChunkSerializer() {}
// Paper start - guard against serializing mismatching coordinates // Paper start - guard against serializing mismatching coordinates
@@ -146,13 +154,20 @@ public class ChunkSerializer { @@ -153,13 +161,20 @@ public class ChunkSerializer {
} }
UpgradeData chunkconverter = nbt.contains("UpgradeData", 10) ? new UpgradeData(nbt.getCompound("UpgradeData"), world) : UpgradeData.EMPTY; UpgradeData chunkconverter = nbt.contains("UpgradeData", 10) ? new UpgradeData(nbt.getCompound("UpgradeData"), world) : UpgradeData.EMPTY;
@ -5069,10 +5077,10 @@ index 61b26c2cb332afd7215c013fbdf144b4a023d898..54ade15cdab222e9818f2635a8a12418
+ final int maxSection = io.papermc.paper.util.WorldUtil.getMaxLightSection(world); + final int maxSection = io.papermc.paper.util.WorldUtil.getMaxLightSection(world);
+ boolean canReadSky = world.dimensionType().hasSkyLight(); + boolean canReadSky = world.dimensionType().hasSkyLight();
+ // Paper end + // Paper end
Registry<Biome> iregistry = world.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY);
if (flag) { Codec<PalettedContainer<Holder<Biome>>> codec = ChunkSerializer.makeBiomeCodecRW(iregistry); // CraftBukkit - read/write
tasksToExecuteOnMain.add(() -> { // Paper - delay this task since we're executing off-main boolean flag2 = false;
@@ -166,7 +181,7 @@ public class ChunkSerializer { @@ -167,7 +182,7 @@ public class ChunkSerializer {
DataResult dataresult; DataResult dataresult;
for (int j = 0; j < nbttaglist.size(); ++j) { for (int j = 0; j < nbttaglist.size(); ++j) {
@ -5081,69 +5089,72 @@ index 61b26c2cb332afd7215c013fbdf144b4a023d898..54ade15cdab222e9818f2635a8a12418
byte b0 = nbttagcompound1.getByte("Y"); byte b0 = nbttagcompound1.getByte("Y");
int k = world.getSectionIndexFromSectionY(b0); int k = world.getSectionIndexFromSectionY(b0);
@@ -211,23 +226,29 @@ public class ChunkSerializer { @@ -214,31 +229,32 @@ public class ChunkSerializer {
} boolean flag3 = nbttagcompound1.contains("BlockLight", 7);
boolean flag4 = flag1 && nbttagcompound1.contains("SkyLight", 7);
if (flag) { - if (flag3 || flag4) {
- if (nbttagcompound1.contains("BlockLight", 7)) { - if (!flag2) {
+ // Paper start - rewrite the light engine
+ if (true || flag3 || flag4) {
+ if ((flag3 || flag4) && !flag2) {
tasksToExecuteOnMain.add(() -> { // Paper - delay this task since we're executing off-main
lightengine.retainData(chunkPos, true);
}); // Paper - delay this task since we're executing off-main
flag2 = true;
}
+ int y = sectionData.getByte("Y");
if (flag3) {
- // Paper start - delay this task since we're executing off-main - // Paper start - delay this task since we're executing off-main
- DataLayer blockLight = new DataLayer(nbttagcompound1.getByteArray("BlockLight")); - DataLayer blockLight = new DataLayer(nbttagcompound1.getByteArray("BlockLight").clone());
- tasksToExecuteOnMain.add(() -> { - tasksToExecuteOnMain.add(() -> {
- lightengine.queueSectionData(LightLayer.BLOCK, SectionPos.of(chunkcoordintpair1, b0), blockLight, true); - lightengine.queueSectionData(LightLayer.BLOCK, SectionPos.of(chunkPos, b0), blockLight, true);
- }); - });
- // Paper end - delay this task since we're executing off-main - // Paper end - delay this task since we're executing off-main
+ // Paper start - rewrite light engine
+ int y = sectionData.getByte("Y");
+
+ if (sectionData.contains("BlockLight", 7)) {
+ // this is where our diff is + // this is where our diff is
+ blockNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(sectionData.getByteArray("BlockLight").clone(), sectionData.getInt(BLOCKLIGHT_STATE_TAG)); // clone for data safety + blockNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(sectionData.getByteArray("BlockLight").clone(), sectionData.getInt(BLOCKLIGHT_STATE_TAG)); // clone for data safety
+ } else { + } else {
+ blockNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(null, sectionData.getInt(BLOCKLIGHT_STATE_TAG)); + blockNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(null, sectionData.getInt(BLOCKLIGHT_STATE_TAG));
} }
- if (flag1 && nbttagcompound1.contains("SkyLight", 7)) { if (flag4) {
- // Paper start - delay this task since we're executing off-main - // Paper start - delay this task since we're executing off-main
- DataLayer skyLight = new DataLayer(nbttagcompound1.getByteArray("SkyLight")); - DataLayer skyLight = new DataLayer(nbttagcompound1.getByteArray("SkyLight").clone());
- tasksToExecuteOnMain.add(() -> { - tasksToExecuteOnMain.add(() -> {
- lightengine.queueSectionData(LightLayer.SKY, SectionPos.of(chunkcoordintpair1, b0), skyLight, true); - lightengine.queueSectionData(LightLayer.SKY, SectionPos.of(chunkPos, b0), skyLight, true);
- }); - });
- // Paper end - delay this task since we're executing off-mai - // Paper end - delay this task since we're executing off-mai
+ if (canReadSky) { + // we store under the same key so mod programs editing nbt
+ if (sectionData.contains("SkyLight", 7)) { + // can still read the data, hopefully.
+ // we store under the same key so mod programs editing nbt + // however, for compatibility we store chunks as unlit so vanilla
+ // can still read the data, hopefully. + // is forced to re-light them if it encounters our data. It's too much of a burden
+ // however, for compatibility we store chunks as unlit so vanilla + // to try and maintain compatibility with a broken and inferior skylight management system.
+ // is forced to re-light them if it encounters our data. It's too much of a burden + skyNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(sectionData.getByteArray("SkyLight").clone(), sectionData.getInt(SKYLIGHT_STATE_TAG)); // clone for data safety
+ // to try and maintain compatibility with a broken and inferior skylight management system.
+ skyNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(sectionData.getByteArray("SkyLight").clone(), sectionData.getInt(SKYLIGHT_STATE_TAG)); // clone for data safety
+ } else {
+ skyNibbles[y - minSection] = new ca.spottedleaf.starlight.common.light.SWMRNibbleArray(null, sectionData.getInt(SKYLIGHT_STATE_TAG));
+ }
} }
+ // Paper end - rewrite light engine + // Paper end - rewrite light engine
} }
} }
@@ -256,6 +277,8 @@ public class ChunkSerializer { @@ -267,6 +283,8 @@ public class ChunkSerializer {
}, chunkPos); }, chunkPos);
object = new LevelChunk(world.getLevel(), chunkPos, chunkconverter, levelchunkticks, levelchunkticks1, l, achunksection, ChunkSerializer.postLoadChunk(world, nbt), blendingdata); object1 = new LevelChunk(world.getLevel(), chunkPos, chunkconverter, levelchunkticks, levelchunkticks1, l, achunksection, ChunkSerializer.postLoadChunk(world, nbt), blendingdata);
+ ((LevelChunk)object).setBlockNibbles(blockNibbles); // Paper - replace light impl + ((LevelChunk)object1).setBlockNibbles(blockNibbles); // Paper - replace light impl
+ ((LevelChunk)object).setSkyNibbles(skyNibbles); // Paper - replace light impl + ((LevelChunk)object1).setSkyNibbles(skyNibbles); // Paper - replace light impl
} else { } else {
ProtoChunkTicks<Block> protochunkticklist = ProtoChunkTicks.load(nbt.getList("block_ticks", 10), (s) -> { ProtoChunkTicks<Block> protochunkticklist = ProtoChunkTicks.load(nbt.getList("block_ticks", 10), (s) -> {
return Registry.BLOCK.getOptional(ResourceLocation.tryParse(s)); return Registry.BLOCK.getOptional(ResourceLocation.tryParse(s));
@@ -264,6 +287,8 @@ public class ChunkSerializer { @@ -275,6 +293,8 @@ public class ChunkSerializer {
return Registry.FLUID.getOptional(ResourceLocation.tryParse(s)); return Registry.FLUID.getOptional(ResourceLocation.tryParse(s));
}, chunkPos); }, chunkPos);
ProtoChunk protochunk = new ProtoChunk(chunkPos, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, world, iregistry, blendingdata); ProtoChunk protochunk = new ProtoChunk(chunkPos, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, world, iregistry, blendingdata);
+ protochunk.setBlockNibbles(blockNibbles); // Paper - replace light impl + protochunk.setBlockNibbles(blockNibbles); // Paper - replace light impl
+ protochunk.setSkyNibbles(skyNibbles); // Paper - replace light impl + protochunk.setSkyNibbles(skyNibbles); // Paper - replace light impl
object = protochunk; object1 = protochunk;
protochunk.setInhabitedTime(l); protochunk.setInhabitedTime(l);
@@ -409,7 +434,7 @@ public class ChunkSerializer { @@ -420,7 +440,7 @@ public class ChunkSerializer {
DataLayer[] blockLight = new DataLayer[lightenginethreaded.getMaxLightSection() - lightenginethreaded.getMinLightSection()]; DataLayer[] blockLight = new DataLayer[lightenginethreaded.getMaxLightSection() - lightenginethreaded.getMinLightSection()];
DataLayer[] skyLight = new DataLayer[lightenginethreaded.getMaxLightSection() - lightenginethreaded.getMinLightSection()]; DataLayer[] skyLight = new DataLayer[lightenginethreaded.getMaxLightSection() - lightenginethreaded.getMinLightSection()];
@ -5152,7 +5163,7 @@ index 61b26c2cb332afd7215c013fbdf144b4a023d898..54ade15cdab222e9818f2635a8a12418
DataLayer blockArray = lightenginethreaded.getLayerListener(LightLayer.BLOCK).getDataLayerData(SectionPos.of(chunkPos, i)); DataLayer blockArray = lightenginethreaded.getLayerListener(LightLayer.BLOCK).getDataLayerData(SectionPos.of(chunkPos, i));
DataLayer skyArray = lightenginethreaded.getLayerListener(LightLayer.SKY).getDataLayerData(SectionPos.of(chunkPos, i)); DataLayer skyArray = lightenginethreaded.getLayerListener(LightLayer.SKY).getDataLayerData(SectionPos.of(chunkPos, i));
@@ -461,6 +486,12 @@ public class ChunkSerializer { @@ -478,6 +498,12 @@ public class ChunkSerializer {
} }
public static CompoundTag saveChunk(ServerLevel world, ChunkAccess chunk, @org.checkerframework.checker.nullness.qual.Nullable AsyncSaveData asyncsavedata) { public static CompoundTag saveChunk(ServerLevel world, ChunkAccess chunk, @org.checkerframework.checker.nullness.qual.Nullable AsyncSaveData asyncsavedata) {
// Paper end // Paper end
@ -5165,7 +5176,7 @@ index 61b26c2cb332afd7215c013fbdf144b4a023d898..54ade15cdab222e9818f2635a8a12418
ChunkPos chunkcoordintpair = chunk.getPos(); ChunkPos chunkcoordintpair = chunk.getPos();
CompoundTag nbttagcompound = new CompoundTag(); CompoundTag nbttagcompound = new CompoundTag();
@@ -511,20 +542,14 @@ public class ChunkSerializer { @@ -528,20 +554,14 @@ public class ChunkSerializer {
for (int i = lightenginethreaded.getMinLightSection(); i < lightenginethreaded.getMaxLightSection(); ++i) { for (int i = lightenginethreaded.getMinLightSection(); i < lightenginethreaded.getMaxLightSection(); ++i) {
int j = chunk.getSectionIndexFromSectionY(i); int j = chunk.getSectionIndexFromSectionY(i);
boolean flag1 = j >= 0 && j < achunksection.length; boolean flag1 = j >= 0 && j < achunksection.length;
@ -5193,7 +5204,7 @@ index 61b26c2cb332afd7215c013fbdf144b4a023d898..54ade15cdab222e9818f2635a8a12418
if (flag1) { if (flag1) {
LevelChunkSection chunksection = achunksection[j]; LevelChunkSection chunksection = achunksection[j];
@@ -539,13 +564,27 @@ public class ChunkSerializer { @@ -556,13 +576,27 @@ public class ChunkSerializer {
nbttagcompound1.put("biomes", (Tag) dataresult1.getOrThrow(false, logger1::error)); nbttagcompound1.put("biomes", (Tag) dataresult1.getOrThrow(false, logger1::error));
} }
@ -5225,7 +5236,7 @@ index 61b26c2cb332afd7215c013fbdf144b4a023d898..54ade15cdab222e9818f2635a8a12418
if (!nbttagcompound1.isEmpty()) { if (!nbttagcompound1.isEmpty()) {
nbttagcompound1.putByte("Y", (byte) i); nbttagcompound1.putByte("Y", (byte) i);
@@ -556,7 +595,8 @@ public class ChunkSerializer { @@ -573,7 +607,8 @@ public class ChunkSerializer {
nbttagcompound.put("sections", nbttaglist); nbttagcompound.put("sections", nbttaglist);
if (flag) { if (flag) {