Reset wolf color, if not tamed

Fix baby metadata
This commit is contained in:
Marco 2020-04-19 10:57:37 +02:00
parent 2dc9a7186e
commit 46989fb6b5
2 changed files with 15 additions and 5 deletions

View file

@ -43,10 +43,8 @@ public class AgeableEntity extends CreatureEntity {
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
if (entityMetadata.getId() == 15) { if (entityMetadata.getId() == 15) {
boolean isBaby = (boolean) entityMetadata.getValue(); boolean isBaby = (boolean) entityMetadata.getValue();
if (isBaby) { metadata.put(EntityData.SCALE, isBaby ? .55f : 1f);
metadata.put(EntityData.SCALE, .55f); metadata.getFlags().setFlag(EntityFlag.BABY, isBaby);
metadata.getFlags().setFlag(EntityFlag.BABY, true);
}
} }
super.updateBedrockMetadata(entityMetadata, session); super.updateBedrockMetadata(entityMetadata, session);

View file

@ -44,9 +44,21 @@ public class WolfEntity extends TameableEntity {
if (entityMetadata.getId() == 18) { if (entityMetadata.getId() == 18) {
metadata.getFlags().setFlag(EntityFlag.INTERESTED, (boolean) entityMetadata.getValue()); metadata.getFlags().setFlag(EntityFlag.INTERESTED, (boolean) entityMetadata.getValue());
} }
//Reset wolf color
if (entityMetadata.getId() == 16) {
byte xd = (byte) entityMetadata.getValue();
boolean angry = (xd & 0x02) == 0x02;
boolean tamed = (xd & 0x04) == 0x04;
if (angry || !tamed) {
metadata.put(EntityData.COLOR, (byte) 0);
}
}
// Wolf collar color // Wolf collar color
// Relies on EntityData.OWNER_EID being set in TameableEntity.java // Relies on EntityData.OWNER_EID being set in TameableEntity.java
if (entityMetadata.getId() == 19) { boolean tamed = !metadata.getFlags().getFlag(EntityFlag.ANGRY) && metadata.getFlags().getFlag(EntityFlag.TAMED);
if (entityMetadata.getId() == 19 && tamed) {
metadata.put(EntityData.COLOR, (byte) (int) entityMetadata.getValue()); metadata.put(EntityData.COLOR, (byte) (int) entityMetadata.getValue());
} }
super.updateBedrockMetadata(entityMetadata, session); super.updateBedrockMetadata(entityMetadata, session);