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

Fix painting id being used too early

Fixes #2893
Dieser Commit ist enthalten in:
Nassim Jahnke 2022-05-19 19:54:27 +02:00
Ursprung 9aa7f5e879
Commit e67501cde3
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
2 geänderte Dateien mit 4 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -228,7 +228,7 @@ public enum Entity1_19Types implements EntityType {
private static final EntityType[] TYPES = EntityTypeUtil.createSizedArray(values());
private final EntityType parent;
private final String identifier;
private int id;
private int id = -1;
Entity1_19Types(final EntityType parent) {
this.parent = parent;
@ -243,7 +243,7 @@ public enum Entity1_19Types implements EntityType {
@Override
public int getId() {
if (id == -1) {
throw new IllegalStateException("Ids have not been initialized yet");
throw new IllegalStateException("Ids have not been initialized yet (type " + name() + ")");
}
return id;
}

Datei anzeigen

@ -159,8 +159,9 @@ public final class EntityPackets extends EntityRewriter<Protocol1_19To1_18_2> {
public void registerMap() {
map(Type.VAR_INT); // Entity id
map(Type.UUID); // Entity UUID
create(Type.VAR_INT, Entity1_19Types.PAINTING.getId());
handler(wrapper -> {
wrapper.write(Type.VAR_INT, Entity1_19Types.PAINTING.getId());
final int motive = wrapper.read(Type.VAR_INT);
final Position blockPosition = wrapper.read(Type.POSITION1_14);
final byte direction = wrapper.read(Type.BYTE);