3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-27 00:22:53 +01:00

Use a hanging bat for sitting parrot

Dieser Commit ist enthalten in:
Matsv 2017-06-14 15:16:52 +02:00
Ursprung 4928dab3f0
Commit a23204a86c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 97CEC2A2EA31350F
2 geänderte Dateien mit 17 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -16,4 +16,5 @@ import nl.matsv.viabackwards.api.entities.storage.EntityStorage;
@Data @Data
public class ParrotStorage extends EntityStorage { public class ParrotStorage extends EntityStorage {
private boolean tamed = true; private boolean tamed = true;
private boolean sitting = true;
} }

Datei anzeigen

@ -413,15 +413,29 @@ public class EntityPackets1_12 extends EntityRewriter<Protocol1_11_1To1_12> {
// Parrot remove animal metadata // Parrot remove animal metadata
registerMetaHandler().filter(EntityType.PARROT, 12).removed(); // Is baby registerMetaHandler().filter(EntityType.PARROT, 12).removed(); // Is baby
registerMetaHandler().filter(EntityType.PARROT, 13).handle(e -> { registerMetaHandler().filter(EntityType.PARROT, 13).handle(e -> {
Metadata data = e.getData();
ParrotStorage storage = e.getEntity().get(ParrotStorage.class); ParrotStorage storage = e.getEntity().get(ParrotStorage.class);
boolean isTamed = (((byte) e.getData().getValue()) & 0x04) == 0x04; boolean isSitting = (((byte) data.getValue()) & 0x01) == 0x01;
boolean isTamed = (((byte) data.getValue()) & 0x04) == 0x04;
if (!storage.isTamed() && isTamed) { if (!storage.isTamed() && isTamed) {
// TODO do something to let the user know it's done // TODO do something to let the user know it's done
} }
storage.setTamed(isTamed); storage.setTamed(isTamed);
if (isSitting) {
data.setId(12);
data.setValue((byte) 0x01);
storage.setSitting(true);
} else if (storage.isSitting()) {
data.setId(12);
data.setValue((byte) 0x00);
storage.setSitting(false);
} else
throw new RemovedValueException(); throw new RemovedValueException();
return data;
}); // Flags (Is sitting etc, might be useful in the future }); // Flags (Is sitting etc, might be useful in the future
registerMetaHandler().filter(EntityType.PARROT, 14).removed(); // Owner registerMetaHandler().filter(EntityType.PARROT, 14).removed(); // Owner
registerMetaHandler().filter(EntityType.PARROT, 15).removed(); // Variant registerMetaHandler().filter(EntityType.PARROT, 15).removed(); // Variant