3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-03 14:50:30 +01:00

Handle dog color changes

Dieser Commit ist enthalten in:
Matsv 2018-03-19 20:09:07 +01:00
Ursprung d6df48430b
Commit a6af99fdbc
3 geänderte Dateien mit 12 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -2,7 +2,6 @@ package us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.entities.Entity1_12Types;
import us.myles.ViaVersion.api.entities.Entity1_13Types;
import us.myles.ViaVersion.api.minecraft.item.Item;
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
@ -31,6 +30,11 @@ public class MetadataRewriter {
}
}
// Handle new colors
if (type.is(Entity1_13Types.EntityType.WOLF) && metadata.getId() == 17) {
metadata.setValue(15 - (int) metadata.getValue());
}
// 1.13 changed item to flat item (no data)
if (metadata.getMetaType() == MetaType1_13.Slot) {
metadata.setMetaType(MetaType1_13.Slot);

Datei anzeigen

@ -2,6 +2,7 @@ package us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.entities.Entity1_13Types;
import us.myles.ViaVersion.api.platform.providers.ViaProviders;
import us.myles.ViaVersion.api.protocol.Protocol;
import us.myles.ViaVersion.api.remapper.PacketHandler;
@ -125,6 +126,10 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
// Store the player
int entityId = wrapper.get(Type.INT, 0);
wrapper.user().get(EntityTracker.class).addEntity(entityId, Entity1_13Types.EntityType.PLAYER);
ClientWorld clientChunks = wrapper.user().get(ClientWorld.class);
int dimensionId = wrapper.get(Type.INT, 1);
clientChunks.setEnvironment(dimensionId);

Datei anzeigen

@ -2,7 +2,6 @@ package us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.packets;
import com.google.common.base.Optional;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.entities.Entity1_13Types;
import us.myles.ViaVersion.api.protocol.Protocol;
import us.myles.ViaVersion.api.remapper.PacketHandler;
@ -33,17 +32,12 @@ public class EntityPackets {
public void handle(PacketWrapper wrapper) throws Exception {
int entityId = wrapper.get(Type.VAR_INT, 0);
byte type = wrapper.get(Type.BYTE, 0);
Optional<Entity1_13Types.ObjectTypes> entType = Entity1_13Types.ObjectTypes.findById(type);
if (!entType.isPresent()) {
Via.getPlatform().getLogger().severe("No object type id registered! " + type);
return;
}
Entity1_13Types.EntityType entType = Entity1_13Types.getTypeFromId(type, true);
// TODO no object type changes so far
// Register Type ID
wrapper.user().get(EntityTracker.class).addEntity(entityId, entType.get().getType());
wrapper.user().get(EntityTracker.class).addEntity(entityId, entType);
}
});
}
@ -77,7 +71,6 @@ public class EntityPackets {
type = optNewType.or(type);
Entity1_13Types.EntityType entType = Entity1_13Types.getTypeFromId(type, false);
wrapper.set(Type.VAR_INT, 1, type);
@ -144,7 +137,6 @@ public class EntityPackets {
int entityId = wrapper.get(Type.VAR_INT, 0);
Optional<Entity1_13Types.EntityType> type = wrapper.user().get(EntityTracker.class).get(entityId);
MetadataRewriter.handleMetadata(entityId, type.orNull(), wrapper.get(Types1_13.METADATA_LIST, 0), wrapper.user());
}
});