fix sculk npe

This commit is contained in:
Jake Potrebic 2023-06-08 16:56:02 -07:00
parent c1def9d852
commit a0a2e7287c
No known key found for this signature in database
GPG Key ID: ECE0B3C133C016C5

View File

@ -7,7 +7,7 @@ Subject: [PATCH] Configurable sculk sensor listener range
public-f net.minecraft.world.level.gameevent.vibrations.VibrationListener listenerRange public-f net.minecraft.world.level.gameevent.vibrations.VibrationListener listenerRange
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java
index a6c226da995eecc323d69a3eff1f8d202410e069..ce42474501b4e168b7877df4d071c5f2eca549ea 100644 index a6c226da995eecc323d69a3eff1f8d202410e069..4db0227e24cb5afd9f34307ff9ff920c67be0489 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SculkSensorBlockEntity.java
@@ -48,9 +48,11 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList @@ -48,9 +48,11 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList
@ -26,7 +26,7 @@ index a6c226da995eecc323d69a3eff1f8d202410e069..ce42474501b4e168b7877df4d071c5f2
VibrationSystem.Data.CODEC.encodeStart(NbtOps.INSTANCE, this.vibrationData).resultOrPartial(LOGGER::error).ifPresent((listenerNbt) -> { VibrationSystem.Data.CODEC.encodeStart(NbtOps.INSTANCE, this.vibrationData).resultOrPartial(LOGGER::error).ifPresent((listenerNbt) -> {
nbt.put("listener", listenerNbt); nbt.put("listener", listenerNbt);
}); });
+ if (this.getListener().rangeOverride != null || this.getListener().rangeOverride != VibrationUser.LISTENER_RANGE) nbt.putInt(PAPER_LISTENER_RANGE_NBT_KEY, this.getListener().rangeOverride); // Paper - only save if it's different from the default + if (this.getListener().rangeOverride != null && this.getListener().rangeOverride != VibrationUser.LISTENER_RANGE) nbt.putInt(PAPER_LISTENER_RANGE_NBT_KEY, this.getListener().rangeOverride); // Paper - only save if it's different from the default
} }
@Override @Override