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

fix velocity in item and arrow

Dieser Commit ist enthalten in:
creeper123123321 2019-04-21 13:46:17 -03:00
Ursprung 32d6fd5386
Commit e34c291bd6
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 0AC57D54786721D1

Datei anzeigen

@ -40,6 +40,9 @@ public class EntityPackets {
map(Type.BYTE); // 6 - Pitch
map(Type.BYTE); // 7 - Yaw
map(Type.INT); // 8 - Data
map(Type.SHORT); // 9 - Velocity X
map(Type.SHORT); // 10 - Velocity Y
map(Type.SHORT); // 11 - Velocity Z
// Track Entity
handler(new PacketHandler() {
@ -54,11 +57,10 @@ public class EntityPackets {
Entity1_14Types.EntityType type1_14 = Entity1_14Types.getTypeFromId(typeId);
if (type1_14 != null) {
int data = wrapper.get(Type.INT, 0);
if (type1_14.is(Entity1_14Types.EntityType.FALLING_BLOCK)) {
int data = wrapper.get(Type.INT, 0);
wrapper.set(Type.INT, 0, Protocol1_14To1_13_2.getNewBlockStateId(data));
} else if (type1_14.is(Entity1_14Types.EntityType.MINECART)) {
int data = wrapper.get(Type.INT, 0);
// default is 0 = rideable minecart
switch (data) {
case 1:
@ -80,6 +82,22 @@ public class EntityPackets {
typeId = Entity1_14Types.EntityType.COMMANDBLOCK_MINECART.getId();
break;
}
} else if ((type1_14.is(Entity1_14Types.EntityType.ITEM) && data > 0)
|| type1_14.is(Entity1_14Types.EntityType.ARROW)
|| type1_14.is(Entity1_14Types.EntityType.SPECTRAL_ARROW)
|| type1_14.is(Entity1_14Types.EntityType.TRIDENT)) {
if (type1_14.is(Entity1_14Types.EntityType.ARROW)
|| type1_14.is(Entity1_14Types.EntityType.SPECTRAL_ARROW)
|| type1_14.is(Entity1_14Types.EntityType.TRIDENT))) { // todo check if trident needs it
wrapper.set(Type.INT, 0, data - 1);
}
// send velocity in separate packet, 1.14 is now ignoring the velocity
PacketWrapper velocity = wrapper.create(0x45);
velocity.write(Type.VAR_INT, entityId);
velocity.write(Type.SHORT, wrapper.get(Type.SHORT, 0));
velocity.write(Type.SHORT, wrapper.get(Type.SHORT, 1));
velocity.write(Type.SHORT, wrapper.get(Type.SHORT, 2));
velocity.send(Protocol1_14To1_13_2.class);
}
}