Fix getBrightness and getRawBrightness throwing exception in BlockStateListPopulator (#9111)

This commit is contained in:
Redned 2023-04-10 03:06:49 -05:00 committed by GitHub
parent ab72b123ec
commit 8be7a60b76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View file

@ -55,4 +55,5 @@ TheFruxz <cedricspitzer@outlook.de>
Kieran Wallbanks <kieran.wallbanks@gmail.com>
Denery <dorofeevij@gmail.com>
Jakubk15 <jakubk15@protonmail.com>
Redned <redned235@gmail.com>
```

View file

@ -6,7 +6,7 @@ Subject: [PATCH] Add missing important BlockStateListPopulator methods
Without these methods it causes exceptions due to these being used by certain feature generators.
diff --git a/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java b/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java
index 4bd59614606962a5371fd0da54bde25bf6a01325..602ce766f00dfde057c735eae3351068d09feab1 100644
index 4bd59614606962a5371fd0da54bde25bf6a01325..216b413ce29c2557d12b80b29072e7fc822de551 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java
@@ -128,7 +128,7 @@ public class BlockStateListPopulator extends DummyGeneratorAccess {
@ -18,7 +18,7 @@ index 4bd59614606962a5371fd0da54bde25bf6a01325..602ce766f00dfde057c735eae3351068
}
@Override
@@ -140,4 +140,28 @@ public class BlockStateListPopulator extends DummyGeneratorAccess {
@@ -140,4 +140,38 @@ public class BlockStateListPopulator extends DummyGeneratorAccess {
public RegistryAccess registryAccess() {
return this.world.registryAccess();
}
@ -45,6 +45,16 @@ index 4bd59614606962a5371fd0da54bde25bf6a01325..602ce766f00dfde057c735eae3351068
+ public net.minecraft.world.level.storage.LevelData getLevelData() {
+ return world.getLevelData();
+ }
+
+ @Override
+ public int getRawBrightness(BlockPos pos, int ambientDarkness) {
+ return world.getRawBrightness(pos, ambientDarkness);
+ }
+
+ @Override
+ public int getBrightness(net.minecraft.world.level.LightLayer type, BlockPos pos) {
+ return world.getBrightness(type, pos);
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java