Fix Piglin bartering animation (Fixes #863)

This commit is contained in:
rtm516 2020-07-07 16:11:52 +01:00
parent a16deb269a
commit c2be7a181d
2 changed files with 12 additions and 0 deletions

View file

@ -31,6 +31,7 @@ import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.item.ItemRegistry;
public class PiglinEntity extends MonsterEntity {
@ -56,4 +57,13 @@ public class PiglinEntity extends MonsterEntity {
super.updateBedrockMetadata(entityMetadata, session);
}
@Override
public void updateEquipment(GeyserSession session) {
// Check if the Piglin is holding Gold and set the ADMIRING flag accordingly
metadata.getFlags().setFlag(EntityFlag.ADMIRING, offHand.getId() == ItemRegistry.GOLD);
super.updateBedrockMetadata(session);
super.updateEquipment(session);
}
}

View file

@ -60,6 +60,8 @@ public class ItemRegistry {
public static final int SHIELD = 829;
// Boat ID, used in BedrockInventoryTransactionTranslator.java
public static final int BOAT = 333;
// Gold ID, used in PiglinEntity.java
public static final int GOLD = 266;
public static int BARRIER_INDEX = 0;