mirror of
https://github.com/ViaVersion/ViaLegacy.git
synced 2024-12-22 16:38:16 +01:00
Fixed walk speed not being applied to player in <=1.5.2
This commit is contained in:
parent
07146da8c2
commit
09e9732de6
@ -278,8 +278,22 @@ public class Protocol1_6_1to1_5_2 extends AbstractProtocol<ClientboundPackets1_5
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.BYTE); // flags
|
||||
map(Type.BYTE, Type.FLOAT, b -> b / 255F); // fly speed
|
||||
map(Type.BYTE, Type.FLOAT, b -> b / 255F); // walk speed
|
||||
handler(wrapper -> {
|
||||
final float flySpeed = wrapper.read(Type.BYTE) / 255F; // fly speed
|
||||
final float walkSpeed = wrapper.read(Type.BYTE) / 255F; // walk speed
|
||||
wrapper.write(Type.FLOAT, flySpeed);
|
||||
wrapper.write(Type.FLOAT, walkSpeed);
|
||||
|
||||
final PacketWrapper entityProperties = PacketWrapper.create(ClientboundPackets1_6_1.ENTITY_PROPERTIES, wrapper.user());
|
||||
entityProperties.write(Type.INT, wrapper.user().get(EntityTracker.class).getPlayerID()); // entity id
|
||||
entityProperties.write(Type.INT, 1); // count
|
||||
entityProperties.write(Types1_6_4.STRING, "generic.movementSpeed"); // id
|
||||
entityProperties.write(Type.DOUBLE, (double) walkSpeed); // value
|
||||
|
||||
wrapper.send(Protocol1_6_1to1_5_2.class);
|
||||
entityProperties.send(Protocol1_6_1to1_5_2.class);
|
||||
wrapper.cancel();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user