Search in sources :

Example 1 with SPacketEntityProperties

use of net.minecraft.network.play.server.SPacketEntityProperties in project SpongeCommon by SpongePowered.

the class MixinEntityPlayerMP method refreshScaledHealth.

@Override
public void refreshScaledHealth() {
    // We need to use the dirty instances to signify that the player needs to ahve it updated, instead
    // of modifying the attribute instances themselves, we bypass other potentially detrimental logi
    // that would otherwise break the actual health scaling.
    final Set<IAttributeInstance> dirtyInstances = ((AttributeMap) this.getAttributeMap()).getDirtyInstances();
    injectScaledHealth(dirtyInstances, true);
    // Send the new information to the client.
    sendHealthUpdate();
    this.connection.sendPacket(new SPacketEntityProperties(this.getEntityId(), dirtyInstances));
    // Reset the dirty instances since they've now been manually updated on the client.
    dirtyInstances.clear();
}
Also used : SPacketEntityProperties(net.minecraft.network.play.server.SPacketEntityProperties) AttributeMap(net.minecraft.entity.ai.attributes.AttributeMap) IAttributeInstance(net.minecraft.entity.ai.attributes.IAttributeInstance)

Aggregations

AttributeMap (net.minecraft.entity.ai.attributes.AttributeMap)1 IAttributeInstance (net.minecraft.entity.ai.attributes.IAttributeInstance)1 SPacketEntityProperties (net.minecraft.network.play.server.SPacketEntityProperties)1