Fixed crash due to attributes not being registered

This commit is contained in:
Sollace 2020-09-22 15:49:11 +02:00
parent c1fb88faae
commit b4e6b3a037

View file

@ -10,10 +10,11 @@ import net.minecraft.entity.attribute.EntityAttributeModifier;
import net.minecraft.entity.attribute.EntityAttributeModifier.Operation; import net.minecraft.entity.attribute.EntityAttributeModifier.Operation;
import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.registry.Registry;
class PlayerAttributes { class PlayerAttributes {
static final EntityAttribute EXTENDED_REACH_DISTANCE = new ClampedEntityAttribute("player.reachDistance", 0, 0, 10); static final EntityAttribute EXTENDED_REACH_DISTANCE = register("unicopia.pegasus.reach", new ClampedEntityAttribute("player.reachDistance", 0, 0, 10));
private static final EntityAttributeModifier EARTH_PONY_STRENGTH = private static final EntityAttributeModifier EARTH_PONY_STRENGTH =
new EntityAttributeModifier(UUID.fromString("777a5505-521e-480b-b9d5-6ea54f259564"), "Earth Pony Strength", 0.6, Operation.MULTIPLY_TOTAL); new EntityAttributeModifier(UUID.fromString("777a5505-521e-480b-b9d5-6ea54f259564"), "Earth Pony Strength", 0.6, Operation.MULTIPLY_TOTAL);
@ -45,4 +46,8 @@ class PlayerAttributes {
instance.tryRemoveModifier(modifier.getId()); instance.tryRemoveModifier(modifier.getId());
} }
} }
private static EntityAttribute register(String id, EntityAttribute attribute) {
return Registry.register(Registry.ATTRIBUTE, id, attribute);
}
} }