3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-04 23:30:24 +01:00

Fix 1.12->1.13 entity tracking

Fixes #2526
Dieser Commit ist enthalten in:
KennyTV 2021-06-10 22:10:22 +02:00
Ursprung 204a81b0ea
Commit 206368b777
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B

Datei anzeigen

@ -53,39 +53,38 @@ public class EntityPackets {
int entityId = wrapper.get(Type.VAR_INT, 0);
byte type = wrapper.get(Type.BYTE, 0);
Entity1_13Types.EntityType entType = Entity1_13Types.getTypeFromId(type, true);
if (entType == null) return;
if (entType != null) {
if (entType.is(Entity1_13Types.EntityType.FALLING_BLOCK)) {
int oldId = wrapper.get(Type.INT, 0);
int combined = (((oldId & 4095) << 4) | (oldId >> 12 & 15));
wrapper.set(Type.INT, 0, WorldPackets.toNewId(combined));
// Register Type ID
wrapper.user().getEntityTracker(Protocol1_13To1_12_2.class).addEntity(entityId, entType);
if (entType.is(Entity1_13Types.EntityType.FALLING_BLOCK)) {
int oldId = wrapper.get(Type.INT, 0);
int combined = (((oldId & 4095) << 4) | (oldId >> 12 & 15));
wrapper.set(Type.INT, 0, WorldPackets.toNewId(combined));
}
// Fix ItemFrame hitbox
if (entType.is(Entity1_13Types.EntityType.ITEM_FRAME)) {
int data = wrapper.get(Type.INT, 0);
switch (data) {
// South
case 0:
data = 3;
break;
// West
case 1:
data = 4;
break;
// North is the same
// East
case 3:
data = 5;
break;
}
// Fix ItemFrame hitbox
if (entType.is(Entity1_13Types.EntityType.ITEM_FRAME)) {
int data = wrapper.get(Type.INT, 0);
switch (data) {
// South
case 0:
data = 3;
break;
// West
case 1:
data = 4;
break;
// North is the same
// East
case 3:
data = 5;
break;
}
wrapper.set(Type.INT, 0, data);
// Register Type ID
wrapper.user().getEntityTracker(Protocol1_13To1_12_2.class).addEntity(entityId, entType);
}
wrapper.set(Type.INT, 0, data);
}
}
});