I looked at some other mods and this is what I have now (extra health instead of block reach)
AttributeModifier HEART_CRYSTAL_MODIFIER = new AttributeModifier(UUID.fromString("68a6dc55-32e4-46a2-8707-57fd16f6afdd"), "AuroraAttributeModifier_HeartCrystal", 4, AttributeModifier.Operation.ADDITION);
if (pEvent.phase == TickEvent.Phase.START) {
ItemStack item = new ItemStack(ModItems.HEART_CRYSTAL.get(), 1);
if (player.getInventory().contains(item)) {
if (!Objects.requireNonNull(player.getAttribute(Attributes.MAX_HEALTH)).hasModifier(HEART_CRYSTAL_MODIFIER)) {
Objects.requireNonNull(player.getAttribute(Attributes.MAX_HEALTH)).addTransientModifier(HEART_CRYSTAL_MODIFIER);
}
} else {
Objects.requireNonNull(player.getAttribute(Attributes.MAX_HEALTH)).removeModifier(HEART_CRYSTAL_MODIFIER.getId());
}
}
There are no errors but it doesn't work