3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 00:00:28 +01:00

Fix animation for bows

Dieser Commit ist enthalten in:
HugoDaBosss 2016-03-08 21:48:21 +01:00
Ursprung e7bd6245c2
Commit aef8eca790
4 geänderte Dateien mit 21 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -33,6 +33,7 @@ public enum MetaIndex {
PLAYER_HUMAN_BYTE(HumanEntity.class, 16, Type.Byte, NewType.Discontinued), // unused on 1.8 PLAYER_HUMAN_BYTE(HumanEntity.class, 16, Type.Byte, NewType.Discontinued), // unused on 1.8
PLAYER_ADDITIONAL_HEARTS(HumanEntity.class, 17, Type.Float, 10, NewType.Float), PLAYER_ADDITIONAL_HEARTS(HumanEntity.class, 17, Type.Float, 10, NewType.Float),
PLAYER_SCORE(HumanEntity.class, 18, Type.Int, 11, NewType.VarInt), PLAYER_SCORE(HumanEntity.class, 18, Type.Int, 11, NewType.VarInt),
PLAYER_HAND(HumanEntity.class, -1, Type.NonExistent, 5, NewType.Byte), // new in 1.9
// horse // horse
HORSE_INFO(Horse.class, 16, Type.Int, 12, NewType.Byte), HORSE_INFO(Horse.class, 16, Type.Int, 12, NewType.Byte),
HORSE_TYPE(Horse.class, 19, Type.Byte, 13, NewType.VarInt), HORSE_TYPE(Horse.class, 19, Type.Byte, 13, NewType.VarInt),

Datei anzeigen

@ -40,6 +40,14 @@ public class MetadataRewriter {
if (metaIndex.getOldType() == Type.Int) { if (metaIndex.getOldType() == Type.Int) {
output.writeByte(((Integer) value).byteValue()); output.writeByte(((Integer) value).byteValue());
} }
if (metaIndex == MetaIndex.ENTITY_STATUS && type == EntityType.PLAYER) {
output.writeByte(MetaIndex.PLAYER_HAND.getNewIndex());
output.writeByte(MetaIndex.PLAYER_HAND.getNewType().getTypeID());
if((((Byte)value) & 0x10) == 0x10) //Player eating/aiming/drinking
output.writeByte(1); //Using main hand
else
output.writeByte(0); //Not using any hand to stop animation
}
break; break;
case OptUUID: case OptUUID:
String owner = (String) value; String owner = (String) value;

Datei anzeigen

@ -13,7 +13,8 @@ public enum Type {
String(4), String(4),
Slot(5), Slot(5),
Position(6), Position(6),
Rotation(7); Rotation(7),
NonExistent(-1);
private final int typeID; private final int typeID;
public static Type byId(int id) { public static Type byId(int id) {

Datei anzeigen

@ -275,14 +275,13 @@ public class IncomingTransformer {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
short curX = input.readUnsignedByte();
short curX = input.readUnsignedByte(); output.writeByte(curX);
output.writeByte(curX); short curY = input.readUnsignedByte();
short curY = input.readUnsignedByte(); output.writeByte(curY);
output.writeByte(curY); short curZ = input.readUnsignedByte();
short curZ = input.readUnsignedByte(); output.writeByte(curZ);
output.writeByte(curZ); return;
return;
} }
if (packet == PacketType.PLAY_USE_ITEM) { if (packet == PacketType.PLAY_USE_ITEM) {
int hand = PacketUtil.readVarInt(input); int hand = PacketUtil.readVarInt(input);
@ -317,9 +316,9 @@ public class IncomingTransformer {
e.printStackTrace(); e.printStackTrace();
} }
output.writeByte(-1); output.writeByte(0); //Is zero in 1.8, not -1
output.writeByte(-1); output.writeByte(0);
output.writeByte(-1); output.writeByte(0);
return; return;
} }
if (packet == PacketType.PLAY_CREATIVE_INVENTORY_ACTION) { if (packet == PacketType.PLAY_CREATIVE_INVENTORY_ACTION) {