Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 00:00:28 +01:00
Recalculate pose when using or leaving bed
Dieser Commit ist enthalten in:
Ursprung
d7eff51805
Commit
61b5c90aa7
@ -194,7 +194,7 @@ public class MetadataRewriter {
|
|||||||
return (entityFlags & 0x80) != 0;
|
return (entityFlags & 0x80) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int recalculatePlayerPose(int entityId, EntityTracker tracker) {
|
public static int recalculatePlayerPose(int entityId, EntityTracker tracker) {
|
||||||
byte flags = tracker.getEntityFlags(entityId);
|
byte flags = tracker.getEntityFlags(entityId);
|
||||||
// Mojang overrides the client-side pose updater, see OtherPlayerEntity#updateSize
|
// Mojang overrides the client-side pose updater, see OtherPlayerEntity#updateSize
|
||||||
int pose = 0; // standing
|
int pose = 0; // standing
|
||||||
|
@ -196,11 +196,13 @@ public class EntityPackets {
|
|||||||
short animation = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
short animation = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||||
if (animation == 2) { //Leave bed
|
if (animation == 2) { //Leave bed
|
||||||
EntityTracker tracker = wrapper.user().get(EntityTracker.class);
|
EntityTracker tracker = wrapper.user().get(EntityTracker.class);
|
||||||
tracker.setSleeping(wrapper.get(Type.VAR_INT, 0), false);
|
int entityId = wrapper.get(Type.VAR_INT, 0);
|
||||||
|
tracker.setSleeping(entityId, false);
|
||||||
|
|
||||||
PacketWrapper metadataPacket = wrapper.create(0x43);
|
PacketWrapper metadataPacket = wrapper.create(0x43);
|
||||||
metadataPacket.write(Type.VAR_INT, wrapper.get(Type.VAR_INT, 0));
|
metadataPacket.write(Type.VAR_INT, entityId);
|
||||||
List<Metadata> metadataList = new LinkedList<>();
|
List<Metadata> metadataList = new LinkedList<>();
|
||||||
|
metadataList.add(new Metadata(6, MetaType1_14.Pose, MetadataRewriter.recalculatePlayerPose(entityId, tracker)));
|
||||||
metadataList.add(new Metadata(12, MetaType1_14.OptPosition, null));
|
metadataList.add(new Metadata(12, MetaType1_14.OptPosition, null));
|
||||||
metadataPacket.write(Types1_14.METADATA_LIST, metadataList);
|
metadataPacket.write(Types1_14.METADATA_LIST, metadataList);
|
||||||
metadataPacket.send(Protocol1_14To1_13_2.class);
|
metadataPacket.send(Protocol1_14To1_13_2.class);
|
||||||
@ -219,11 +221,13 @@ public class EntityPackets {
|
|||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
EntityTracker tracker = wrapper.user().get(EntityTracker.class);
|
EntityTracker tracker = wrapper.user().get(EntityTracker.class);
|
||||||
tracker.setSleeping(wrapper.get(Type.VAR_INT, 0), true);
|
int entityId = wrapper.get(Type.VAR_INT, 0);
|
||||||
|
tracker.setSleeping(entityId, true);
|
||||||
|
|
||||||
Position position = wrapper.read(Type.POSITION);
|
Position position = wrapper.read(Type.POSITION);
|
||||||
List<Metadata> metadataList = new LinkedList<>();
|
List<Metadata> metadataList = new LinkedList<>();
|
||||||
metadataList.add(new Metadata(12, MetaType1_14.OptPosition, position));
|
metadataList.add(new Metadata(12, MetaType1_14.OptPosition, position));
|
||||||
|
metadataList.add(new Metadata(6, MetaType1_14.Pose, MetadataRewriter.recalculatePlayerPose(entityId, tracker)));
|
||||||
wrapper.write(Types1_14.METADATA_LIST, metadataList);
|
wrapper.write(Types1_14.METADATA_LIST, metadataList);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren