use of net.minecraft.network.protocol.game.ClientboundSetHealthPacket in project SpongeCommon by SpongePowered.
the class ServerPlayerMixin_HealthScale method bridge$refreshScaledHealth.
@Override
public void bridge$refreshScaledHealth() {
// We need to use the dirty instances to signify that the player needs to have it updated, instead
// of modifying the attribute instances themselves, we bypass other potentially detrimental logic
// that would otherwise break the actual health scaling.
final Set<AttributeInstance> dirtyInstances = this.shadow$getAttributes().getDirtyAttributes();
this.bridge$injectScaledHealth(dirtyInstances);
// Send the new information to the client.
final FoodData foodData = this.shadow$getFoodData();
this.connection.send(new ClientboundSetHealthPacket(this.bridge$getInternalScaledHealth(), foodData.getFoodLevel(), foodData.getSaturationLevel()));
this.connection.send(new ClientboundUpdateAttributesPacket(this.shadow$getId(), dirtyInstances));
// Reset the dirty instances since they've now been manually updated on the client.
dirtyInstances.clear();
}
Aggregations