mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
Fix NPE in SculkBloomEvent world access (#9857)
This commit is contained in:
parent
0049c47717
commit
64b1b0fc06
1 changed files with 49 additions and 0 deletions
49
patches/server/Fix-NPE-in-SculkBloomEvent-world-access.patch
Normal file
49
patches/server/Fix-NPE-in-SculkBloomEvent-world-access.patch
Normal file
|
@ -0,0 +1,49 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
|
||||
Date: Fri, 20 Oct 2023 19:50:22 +0200
|
||||
Subject: [PATCH] Fix NPE in SculkBloomEvent world access
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/SculkSpreader.java b/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
|
||||
@@ -0,0 +0,0 @@ public class SculkSpreader {
|
||||
private final int additionalDecayRate;
|
||||
private List<SculkSpreader.ChargeCursor> cursors = new ArrayList();
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
- Level level; // CraftBukkit
|
||||
+ public Level level; // CraftBukkit // Paper - package-private -> public
|
||||
|
||||
public SculkSpreader(boolean worldGen, TagKey<Block> replaceableTag, int extraBlockChance, int maxDistance, int spreadChance, int decayChance) {
|
||||
this.isWorldGeneration = worldGen;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
|
||||
@@ -0,0 +0,0 @@ public class SculkCatalystBlockEntity extends BlockEntity implements GameEventLi
|
||||
public SculkCatalystBlockEntity(BlockPos pos, BlockState state) {
|
||||
super(BlockEntityType.SCULK_CATALYST, pos, state);
|
||||
this.catalystListener = new SculkCatalystBlockEntity.CatalystListener(state, new BlockPositionSource(pos));
|
||||
- catalystListener.level = level; // CraftBukkit
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public void setLevel(Level level) {
|
||||
+ super.setLevel(level);
|
||||
+ this.catalystListener.sculkSpreader.level = level;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public static void serverTick(Level world, BlockPos pos, BlockState state, SculkCatalystBlockEntity blockEntity) {
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.sourceBlockOverride = blockEntity.getBlockPos(); // CraftBukkit - SPIGOT-7068: Add source block override, not the most elegant way but better than passing down a BlockPosition up to five methods deep.
|
||||
blockEntity.catalystListener.getSculkSpreader().updateCursors(world, pos, world.getRandom(), true);
|
||||
@@ -0,0 +0,0 @@ public class SculkCatalystBlockEntity extends BlockEntity implements GameEventLi
|
||||
final SculkSpreader sculkSpreader;
|
||||
private final BlockState blockState;
|
||||
private final PositionSource positionSource;
|
||||
- private Level level; // CraftBukkit
|
||||
|
||||
public CatalystListener(BlockState state, PositionSource positionSource) {
|
||||
this.blockState = state;
|
Loading…
Reference in a new issue