Search in sources :

Example 1 with AttributeMap

use of net.minecraft.world.entity.ai.attributes.AttributeMap in project Denizen-For-Bukkit by DenizenScript.

the class ImprovedOfflinePlayerImpl method getAttributes.

private AttributeMap getAttributes() {
    AttributeMap amb = new AttributeMap(DefaultAttributes.getSupplier(net.minecraft.world.entity.EntityType.PLAYER));
    amb.load(((CompoundTagImpl) this.compound).toNMSTag().getList("Attributes", 10));
    return amb;
}
Also used : AttributeMap(net.minecraft.world.entity.ai.attributes.AttributeMap) CompoundTagImpl(com.denizenscript.denizen.nms.v1_17.impl.jnbt.CompoundTagImpl)

Example 2 with AttributeMap

use of net.minecraft.world.entity.ai.attributes.AttributeMap in project Denizen-For-Bukkit by DenizenScript.

the class ImprovedOfflinePlayerImpl method setMaxHealth.

@Override
public void setMaxHealth(double input) {
    AttributeMap attributes = getAttributes();
    AttributeInstance maxHealth = attributes.getInstance(Attributes.MAX_HEALTH);
    maxHealth.setBaseValue(input);
    setAttributes(attributes);
}
Also used : AttributeMap(net.minecraft.world.entity.ai.attributes.AttributeMap) AttributeInstance(net.minecraft.world.entity.ai.attributes.AttributeInstance)

Example 3 with AttributeMap

use of net.minecraft.world.entity.ai.attributes.AttributeMap in project Denizen-For-Bukkit by DenizenScript.

the class ImprovedOfflinePlayerImpl method getAttributes.

private AttributeMap getAttributes() {
    AttributeMap amb = new AttributeMap(DefaultAttributes.getSupplier(net.minecraft.world.entity.EntityType.PLAYER));
    amb.load(((CompoundTagImpl) this.compound).toNMSTag().getList("Attributes", 10));
    return amb;
}
Also used : AttributeMap(net.minecraft.world.entity.ai.attributes.AttributeMap) CompoundTagImpl(com.denizenscript.denizen.nms.v1_18.impl.jnbt.CompoundTagImpl)

Example 4 with AttributeMap

use of net.minecraft.world.entity.ai.attributes.AttributeMap in project Denizen-For-Bukkit by DenizenScript.

the class ImprovedOfflinePlayerImpl method setMaxHealth.

@Override
public void setMaxHealth(double input) {
    AttributeMap attributes = getAttributes();
    AttributeInstance maxHealth = attributes.getInstance(Attributes.MAX_HEALTH);
    maxHealth.setBaseValue(input);
    setAttributes(attributes);
}
Also used : AttributeMap(net.minecraft.world.entity.ai.attributes.AttributeMap) AttributeInstance(net.minecraft.world.entity.ai.attributes.AttributeInstance)

Aggregations

AttributeMap (net.minecraft.world.entity.ai.attributes.AttributeMap)4 AttributeInstance (net.minecraft.world.entity.ai.attributes.AttributeInstance)2 CompoundTagImpl (com.denizenscript.denizen.nms.v1_17.impl.jnbt.CompoundTagImpl)1 CompoundTagImpl (com.denizenscript.denizen.nms.v1_18.impl.jnbt.CompoundTagImpl)1