use of net.minecraftforge.event.entity.EntityAttributeCreationEvent in project Magma-1.16.x by magmafoundation.
the class ForgeHooks method modifyAttributes.
/**
* FOR INTERNAL USE ONLY, DO NOT CALL DIRECTLY
*/
@Deprecated
public static void modifyAttributes() {
ModLoader.get().postEvent(new EntityAttributeCreationEvent(FORGE_ATTRIBUTES));
Map<EntityType<? extends LivingEntity>, AttributeModifierMap.MutableAttribute> finalMap = new HashMap<>();
ModLoader.get().postEvent(new EntityAttributeModificationEvent(finalMap));
finalMap.forEach((k, v) -> {
AttributeModifierMap modifiers = GlobalEntityTypeAttributes.getSupplier(k);
AttributeModifierMap.MutableAttribute newMutable = modifiers != null ? new AttributeModifierMap.MutableAttribute(modifiers) : new AttributeModifierMap.MutableAttribute();
newMutable.combine(v);
FORGE_ATTRIBUTES.put(k, newMutable.build());
});
}
use of net.minecraftforge.event.entity.EntityAttributeCreationEvent in project LoliServer by Loli-Server.
the class ForgeHooks method modifyAttributes.
/**
* FOR INTERNAL USE ONLY, DO NOT CALL DIRECTLY
*/
@Deprecated
public static void modifyAttributes() {
ModLoader.get().postEvent(new EntityAttributeCreationEvent(FORGE_ATTRIBUTES));
Map<EntityType<? extends LivingEntity>, AttributeModifierMap.MutableAttribute> finalMap = new HashMap<>();
ModLoader.get().postEvent(new EntityAttributeModificationEvent(finalMap));
finalMap.forEach((k, v) -> {
AttributeModifierMap modifiers = GlobalEntityTypeAttributes.getSupplier(k);
AttributeModifierMap.MutableAttribute newMutable = modifiers != null ? new AttributeModifierMap.MutableAttribute(modifiers) : new AttributeModifierMap.MutableAttribute();
newMutable.combine(v);
FORGE_ATTRIBUTES.put(k, newMutable.build());
});
}
Aggregations