3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-25 15:50:12 +01:00

Fix 1.20.5->1.20.3 darkness effect transition

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-10-23 21:26:12 +02:00
Ursprung 4f119d26d7
Commit b1f4a88050
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F

Datei anzeigen

@ -243,14 +243,26 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
protocol.registerClientbound(ClientboundPackets1_20_5.UPDATE_MOB_EFFECT, wrapper -> {
wrapper.passthrough(Types.VAR_INT); // Entity ID
wrapper.passthrough(Types.VAR_INT); // Effect ID
final int effectId = wrapper.passthrough(Types.VAR_INT);
final int amplifier = wrapper.read(Types.VAR_INT);
wrapper.write(Types.BYTE, (byte) MathUtil.clamp(amplifier, Byte.MIN_VALUE, Byte.MAX_VALUE));
wrapper.passthrough(Types.VAR_INT); // Duration
wrapper.passthrough(Types.BYTE); // Flags
wrapper.write(Types.OPTIONAL_COMPOUND_TAG, null); // Add empty factor data
if (effectId == 32) { // Darkness, keep a stable effect
final CompoundTag factorData = new CompoundTag();
factorData.putInt("padding_duration", 22);
factorData.putBoolean("had_effect_last_tick", true);
factorData.putFloat("factor_previous_frame", 0);
factorData.putFloat("factor_start", 1);
factorData.putFloat("factor_target", 1);
factorData.putFloat("factor_current", 1);
wrapper.write(Types.OPTIONAL_COMPOUND_TAG, factorData);
} else {
wrapper.write(Types.OPTIONAL_COMPOUND_TAG, null);
}
});
protocol.registerClientbound(ClientboundPackets1_20_5.UPDATE_ATTRIBUTES, wrapper -> {