fix writePositionSource always throws IllegalStateException (issue #738) (#739)

(cherry picked from commit bf269a2d50)
This commit is contained in:
cxzlw 2023-07-02 07:34:24 +08:00 committed by GitHub
parent caa35c7be4
commit ee030499b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -521,10 +521,10 @@ public class MinecraftCodecHelper extends BasePacketCodecHelper {
} else if (positionSource instanceof EntityPositionSource) { } else if (positionSource instanceof EntityPositionSource) {
this.writeVarInt(buf, ((EntityPositionSource) positionSource).getEntityId()); this.writeVarInt(buf, ((EntityPositionSource) positionSource).getEntityId());
buf.writeFloat(((EntityPositionSource) positionSource).getYOffset()); buf.writeFloat(((EntityPositionSource) positionSource).getYOffset());
} } else {
throw new IllegalStateException("Unknown position source type!"); throw new IllegalStateException("Unknown position source type!");
} }
}
public VillagerData readVillagerData(ByteBuf buf) { public VillagerData readVillagerData(ByteBuf buf) {
return new VillagerData(this.readVarInt(buf), this.readVarInt(buf), this.readVarInt(buf)); return new VillagerData(this.readVarInt(buf), this.readVarInt(buf), this.readVarInt(buf));