mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-11-21 12:07:38 +01:00
Fix 1.20.5->1.20.3 darkness effect transition
This commit is contained in:
parent
4f119d26d7
commit
b1f4a88050
@ -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 -> {
|
||||
|
Loading…
Reference in New Issue
Block a user