Re-add droped MapLike spam fix (#11917)

This commit is contained in:
Jake Potrebic 2025-01-05 10:07:35 -08:00 committed by GitHub
parent 9f90b4c324
commit 486e521105
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,14 @@
--- a/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java
+++ b/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java
@@ -123,7 +_,7 @@
public static Codec<VibrationSystem.Data> CODEC = RecordCodecBuilder.create(
instance -> instance.group(
VibrationInfo.CODEC.lenientOptionalFieldOf("event").forGetter(data -> Optional.ofNullable(data.currentVibration)),
- VibrationSelector.CODEC.fieldOf("selector").forGetter(VibrationSystem.Data::getSelectionStrategy),
+ VibrationSelector.CODEC.optionalFieldOf("selector").xmap(o -> o.orElseGet(VibrationSelector::new), Optional::of).forGetter(VibrationSystem.Data::getSelectionStrategy), // Paper - fix MapLike spam for missing "selector" in 1.19.2
ExtraCodecs.NON_NEGATIVE_INT.fieldOf("event_delay").orElse(0).forGetter(VibrationSystem.Data::getTravelTimeInTicks)
)
.apply(
@@ -214,7 +_,14 @@
return false;
} else {