Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-09-06 05:00:09 +02:00
Merge pull request #1565 from Gerrygames/master
fix entity metadata in spawn packet being ignored
Dieser Commit ist enthalten in:
Commit
3d10c56aac
@ -3,6 +3,7 @@ package us.myles.ViaVersion.protocols.protocol1_15to1_14_4.packets;
|
||||
import com.google.common.base.Optional;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.entities.Entity1_15Types;
|
||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
@ -13,6 +14,7 @@ import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.MetadataRewriter;
|
||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4;
|
||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.storage.EntityTracker;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class EntityPackets {
|
||||
@ -72,7 +74,6 @@ public class EntityPackets {
|
||||
map(Type.SHORT); // 9 - Velocity X
|
||||
map(Type.SHORT); // 10 - Velocity Y
|
||||
map(Type.SHORT); // 11 - Velocity Z
|
||||
map(Types1_14.METADATA_LIST, Type.NOTHING); // removed - probably sent in an update packet?
|
||||
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
@ -82,6 +83,13 @@ public class EntityPackets {
|
||||
Entity1_15Types.EntityType entityType = Entity1_15Types.getTypeFromId(getNewEntityId(typeId));
|
||||
wrapper.user().get(EntityTracker.class).addEntity(entityId, entityType);
|
||||
wrapper.set(Type.VAR_INT, 1, entityType.getId());
|
||||
|
||||
List<Metadata> metadata = wrapper.read(Types1_14.METADATA_LIST);
|
||||
MetadataRewriter.handleMetadata(entityId, entityType, metadata, wrapper.user());
|
||||
PacketWrapper metadataUpdate = wrapper.create(0x44);
|
||||
metadataUpdate.write(Type.VAR_INT, entityId);
|
||||
metadataUpdate.write(Types1_14.METADATA_LIST, metadata);
|
||||
metadataUpdate.send(Protocol1_15To1_14_4.class);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -98,15 +106,20 @@ public class EntityPackets {
|
||||
map(Type.DOUBLE); // 4 - Z
|
||||
map(Type.BYTE); // 5 - Yaw
|
||||
map(Type.BYTE); // 6 - Pitch
|
||||
map(Types1_14.METADATA_LIST, Type.NOTHING); // removed - probably sent in an update packet?
|
||||
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
int entityId = wrapper.get(Type.VAR_INT, 0);
|
||||
|
||||
Entity1_15Types.EntityType entityType = Entity1_15Types.EntityType.PLAYER;
|
||||
wrapper.user().get(EntityTracker.class).addEntity(entityId, entityType);
|
||||
|
||||
List<Metadata> metadata = wrapper.read(Types1_14.METADATA_LIST);
|
||||
MetadataRewriter.handleMetadata(entityId, entityType, metadata, wrapper.user());
|
||||
PacketWrapper metadataUpdate = wrapper.create(0x44);
|
||||
metadataUpdate.write(Type.VAR_INT, entityId);
|
||||
metadataUpdate.write(Types1_14.METADATA_LIST, metadata);
|
||||
metadataUpdate.send(Protocol1_15To1_14_4.class);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren