/** * Sends the entity metadata (DataWatcher) and attributes to all players tracking this entity, including the entity * itself if a player. */ private void sendMetadataToAllAssociatedPlayers() { EntityDataManager entitydatamanager = this.trackedEntity.getDataManager(); if (entitydatamanager.isDirty()) { this.sendToTrackingAndSelf(new SPacketEntityMetadata(this.trackedEntity.getEntityId(), entitydatamanager, false)); } if (this.trackedEntity instanceof EntityLivingBase) { AttributeMap attributemap = (AttributeMap)((EntityLivingBase)this.trackedEntity).getAttributeMap(); Set<IAttributeInstance> set = attributemap.getAttributeInstanceSet(); if (!set.isEmpty()) { this.sendToTrackingAndSelf(new SPacketEntityProperties(this.trackedEntity.getEntityId(), set)); } set.clear(); } }
/** * Returns this entity's attribute map (where all its attributes are stored) */ public AbstractAttributeMap getAttributeMap() { if (this.attributeMap == null) { this.attributeMap = new AttributeMap(); } return this.attributeMap; }
@Override public AbstractAttributeMap getAttributeMap() { //null check because super constructor calls this method if(getSettler() == null) { AbstractAttributeMap map = new AttributeMap(); map.registerAttribute(SharedMonsterAttributes.MAX_HEALTH); return map; } else { return getSettler().getAttributeMap(); } }
public AbstractAttributeMap getAttributeMap() { if (this.attributeMap == null) { this.attributeMap = new AttributeMap(); } return this.attributeMap; }