mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-11-16 11:15:49 +01:00
Rewrite title/player_combat components in 1.17->1.16.4 (#801)
This commit is contained in:
parent
f461a0b14c
commit
7ccb5634ff
@ -202,10 +202,10 @@ public final class Protocol1_17To1_16_4 extends BackwardsProtocol<ClientboundPac
|
||||
}
|
||||
});
|
||||
|
||||
//TODO translatables
|
||||
mergePacket(ClientboundPackets1_17.SET_TITLE_TEXT, ClientboundPackets1_16_2.SET_TITLES, 0);
|
||||
mergePacket(ClientboundPackets1_17.SET_SUBTITLE_TEXT, ClientboundPackets1_16_2.SET_TITLES, 1);
|
||||
mergePacket(ClientboundPackets1_17.SET_ACTION_BAR_TEXT, ClientboundPackets1_16_2.SET_TITLES, 2);
|
||||
rewriteTitlePacket(ClientboundPackets1_17.SET_TITLE_TEXT, 0);
|
||||
rewriteTitlePacket(ClientboundPackets1_17.SET_SUBTITLE_TEXT, 1);
|
||||
rewriteTitlePacket(ClientboundPackets1_17.SET_ACTION_BAR_TEXT, 2);
|
||||
|
||||
mergePacket(ClientboundPackets1_17.SET_TITLES_ANIMATION, ClientboundPackets1_16_2.SET_TITLES, 3);
|
||||
registerClientbound(ClientboundPackets1_17.CLEAR_TITLES, ClientboundPackets1_16_2.SET_TITLES, wrapper -> {
|
||||
if (wrapper.read(Types.BOOLEAN)) {
|
||||
@ -240,6 +240,14 @@ public final class Protocol1_17To1_16_4 extends BackwardsProtocol<ClientboundPac
|
||||
registerClientbound(newPacketType, oldPacketType, wrapper -> wrapper.write(Types.VAR_INT, type));
|
||||
}
|
||||
|
||||
private void rewriteTitlePacket(ClientboundPackets1_17 newPacketType, int type) {
|
||||
// Also handles translations in the title
|
||||
registerClientbound(newPacketType, ClientboundPackets1_16_2.SET_TITLES, wrapper -> {
|
||||
wrapper.write(Types.VAR_INT, type);
|
||||
translatableRewriter.processText(wrapper.user(), wrapper.passthrough(Types.COMPONENT));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPacketRewriter1_17 getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
|
@ -25,7 +25,6 @@ import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_17;
|
||||
import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_16;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_17;
|
||||
@ -133,10 +132,15 @@ public final class EntityPacketRewriter1_17 extends EntityRewriter<ClientboundPa
|
||||
}
|
||||
});
|
||||
|
||||
// TODO translatables
|
||||
protocol.mergePacket(ClientboundPackets1_17.PLAYER_COMBAT_ENTER, ClientboundPackets1_16_2.PLAYER_COMBAT, 0);
|
||||
protocol.mergePacket(ClientboundPackets1_17.PLAYER_COMBAT_END, ClientboundPackets1_16_2.PLAYER_COMBAT, 1);
|
||||
protocol.mergePacket(ClientboundPackets1_17.PLAYER_COMBAT_KILL, ClientboundPackets1_16_2.PLAYER_COMBAT, 2);
|
||||
protocol.registerClientbound(ClientboundPackets1_17.PLAYER_COMBAT_KILL, ClientboundPackets1_16_2.PLAYER_COMBAT, wrapper -> {
|
||||
wrapper.write(Types.VAR_INT, 2);
|
||||
|
||||
wrapper.passthrough(Types.VAR_INT); // Duration
|
||||
wrapper.passthrough(Types.INT); // Killer id
|
||||
protocol.getComponentRewriter().processText(wrapper.user(), wrapper.passthrough(Types.COMPONENT));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,4 +1,4 @@
|
||||
projectVersion=5.0.1
|
||||
projectVersion=5.0.2-SNAPSHOT
|
||||
|
||||
# Smile emoji
|
||||
mcVersions=1.21,1.20.6,1.20.5,1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10
|
||||
|
Loading…
Reference in New Issue
Block a user