diff --git a/src/main/java/com/minelittlepony/unicopia/Unicopia.java b/src/main/java/com/minelittlepony/unicopia/Unicopia.java index 2e8052fb..a284c33b 100644 --- a/src/main/java/com/minelittlepony/unicopia/Unicopia.java +++ b/src/main/java/com/minelittlepony/unicopia/Unicopia.java @@ -22,6 +22,7 @@ import com.minelittlepony.unicopia.command.Commands; import com.minelittlepony.unicopia.container.SpellbookChapterLoader; import com.minelittlepony.unicopia.container.UScreenHandlers; import com.minelittlepony.unicopia.entity.UEntities; +import com.minelittlepony.unicopia.entity.damage.UDamageTypes; import com.minelittlepony.unicopia.entity.effect.UPotions; import com.minelittlepony.unicopia.entity.player.Pony; import com.minelittlepony.unicopia.item.UItems; @@ -93,6 +94,7 @@ public class Unicopia implements ModInitializer { UScreenHandlers.bootstrap(); UTreeGen.bootstrap(); UGameRules.bootstrap(); + UDamageTypes.bootstrap(); } public interface SidedAccess { diff --git a/src/main/java/com/minelittlepony/unicopia/entity/damage/UDamageTypes.java b/src/main/java/com/minelittlepony/unicopia/entity/damage/UDamageTypes.java index cd102c01..faeb083b 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/damage/UDamageTypes.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/damage/UDamageTypes.java @@ -1,12 +1,19 @@ package com.minelittlepony.unicopia.entity.damage; +import java.util.ArrayList; +import java.util.List; + import com.minelittlepony.unicopia.Unicopia; +import net.fabricmc.fabric.api.event.registry.DynamicRegistrySetupCallback; import net.minecraft.entity.damage.DamageType; +import net.minecraft.registry.Registry; import net.minecraft.registry.RegistryKey; import net.minecraft.registry.RegistryKeys; public interface UDamageTypes { + List> REGISTRY = new ArrayList<>(); + RegistryKey EXHAUSTION = register("magical_exhaustion"); RegistryKey ALICORN_AMULET = register("alicorn_amulet"); RegistryKey FOOD_POISONING = register("food_poisoning"); @@ -25,10 +32,18 @@ public interface UDamageTypes { RegistryKey PETRIFIED = register("petrified"); private static RegistryKey register(String name) { - return RegistryKey.of(RegistryKeys.DAMAGE_TYPE, Unicopia.id(name)); + var key = RegistryKey.of(RegistryKeys.DAMAGE_TYPE, Unicopia.id(name)); + REGISTRY.add(key); + return key; } static void bootstrap() { - + DynamicRegistrySetupCallback.EVENT.register(registries -> { + registries.getOptional(RegistryKeys.DAMAGE_TYPE).ifPresent(registry -> { + REGISTRY.forEach(key -> { + Registry.register(registry, key.getValue(), new DamageType(key.getValue().getNamespace() + "." + key.getValue().getPath(), 0)); + }); + }); + }); } } diff --git a/src/main/resources/assets/unicopia/lang/en_us.json b/src/main/resources/assets/unicopia/lang/en_us.json index 009c8e68..7423b963 100644 --- a/src/main/resources/assets/unicopia/lang/en_us.json +++ b/src/main/resources/assets/unicopia/lang/en_us.json @@ -634,50 +634,50 @@ "unicopia.race.bat": "Bat Pony", "unicopia.race.bat.alt": "Bat Ponies", - "death.attack.generic.and_also": "%1$s and %2$s", - "death.attack.generic.whilst_flying": "%1$s whilst flying", - "death.attack.tribe_swap": "%1$s was reborn into a different tribe", - "death.attack.tribe_swap.player": "%1$s was doomed to be reborn into a different tribe by %2$s", - "death.attack.sun": "%1$s stared into the sun", - "death.attack.sun.player": "%1$s stared into the sun whilst fighting %2$s", - "death.attack.sunlight": "%1$s was burned by the sun", - "death.attack.sunlight.player": "%1$s was burned by the sun whilst fighting %2$s", - "death.attack.petrified": "%1$s turned to stone", - "death.attack.petrified.player": "%1$s turned to stone whilst fighting %2$s", - "death.attack.magical_exhaustion": "%1$s exhausted themselves", - "death.attack.magical_exhaustion.player": "%1$s exhausted themselves whilst fighting %2$s", - "death.attack.alicorn_amulet": "%1$s was driven insane", - "death.attack.alicorn_amulet.player": "%1$s went insane whilst fighting %2$s", - "death.attack.darkness": "%1$s went missing", - "death.attack.love_draining": "%1$s was drained of all life", - "death.attack.love_draining.player": "%1$s died to feed %2$s", - "death.attack.life_draining": "%1$s was drained of all life", - "death.attack.life_draining.self": "%1$s was killed by their own spell", - "death.attack.life_draining.player": "%1$s was killed by a spell cast by %2$s", - "death.attack.bat_screech": "%1$s was frightened to death", - "death.attack.bat_screech.player": "%2$s scared %1$s", - "death.attack.bat_screech.item": "%1$s was frightened to death by %2$s using %3$s", - "death.attack.bat_screech.self": "%1$s scared themselves to death", - "death.attack.gravity_well_recoil": "%1$s turned into spaghetti", - "death.attack.gravity_well_recoil.player": "%1$s turned into spaghetti by a spell cast by %2$s", - "death.attack.gravity_well_recoil.item": "%1$s turned into spaghetti by a spell cast by %2$s using %3$s", - "death.attack.gravity_well_recoil.self": "%1$s cast a spell that turned them into spaghetti", - "death.attack.smash": "%1$s was crushed under hoof", - "death.attack.smash.player": "%1$s was crushed by %2$s", - "death.attack.zap": "%1$s bit into a Zap Apple", - "death.attack.zap.player": "%1$s bit into a Zap Apple whilst fighting %2$s", - "death.attack.paradox": "%1$s imploded", - "death.attack.paradox.player": "%1$s imploded with some help from %2$s", - "death.attack.food_poisoning": "%1$s died of food poisoning", - "death.attack.food_poisoning.player": "%2$s poisoned %1$s to death", - "death.attack.black_hole": "%1$s was sucked into a black hole", - "death.attack.black_hole.player": "%1$s got sucked into %2$s's black hole", - "death.attack.kick": "%1$s was kicked really hard", - "death.attack.kick.player": "%2$s kicked %1$s really hard", - "death.attack.steamroller": "%1$s was flattened", - "death.attack.steamroller.player": "%2$s steamrolled %1$s", - "death.attack.stalagmite.pegasus": "%1$s tried to perch on a stalagmite", - "death.attack.stalagmite.pegasus.player": "%1$s flew into a stalagmite whilst fighting %2$s", + "death.attack.unicopia.generic.and_also": "%1$s and %2$s", + "death.attack.unicopia.generic.whilst_flying": "%1$s whilst flying", + "death.attack.unicopia.tribe_swap": "%1$s was reborn into a different tribe", + "death.attack.unicopia.tribe_swap.player": "%1$s was doomed to be reborn into a different tribe by %2$s", + "death.attack.unicopia.sun": "%1$s stared into the sun", + "death.attack.unicopia.sun.player": "%1$s stared into the sun whilst fighting %2$s", + "death.attack.unicopia.sunlight": "%1$s was burned by the sun", + "death.attack.unicopia.sunlight.player": "%1$s was burned by the sun whilst fighting %2$s", + "death.attack.unicopia.petrified": "%1$s turned to stone", + "death.attack.unicopia.petrified.player": "%1$s turned to stone whilst fighting %2$s", + "death.attack.unicopia.magical_exhaustion": "%1$s exhausted themselves", + "death.attack.unicopia.magical_exhaustion.player": "%1$s exhausted themselves whilst fighting %2$s", + "death.attack.unicopia.alicorn_amulet": "%1$s was driven insane", + "death.attack.unicopia.alicorn_amulet.player": "%1$s went insane whilst fighting %2$s", + "death.attack.unicopia.darkness": "%1$s went missing", + "death.attack.unicopia.love_draining": "%1$s was drained of all life", + "death.attack.unicopia.love_draining.player": "%1$s died to feed %2$s", + "death.attack.unicopia.life_draining": "%1$s was drained of all life", + "death.attack.unicopia.life_draining.self": "%1$s was killed by their own spell", + "death.attack.unicopia.life_draining.player": "%1$s was killed by a spell cast by %2$s", + "death.attack.unicopia.bat_screech": "%1$s was frightened to death", + "death.attack.unicopia.bat_screech.player": "%2$s scared %1$s", + "death.attack.unicopia.bat_screech.item": "%1$s was frightened to death by %2$s using %3$s", + "death.attack.unicopia.bat_screech.self": "%1$s scared themselves to death", + "death.attack.unicopia.gravity_well_recoil": "%1$s turned into spaghetti", + "death.attack.unicopia.gravity_well_recoil.player": "%1$s turned into spaghetti by a spell cast by %2$s", + "death.attack.unicopia.gravity_well_recoil.item": "%1$s turned into spaghetti by a spell cast by %2$s using %3$s", + "death.attack.unicopia.gravity_well_recoil.self": "%1$s cast a spell that turned them into spaghetti", + "death.attack.unicopia.smash": "%1$s was crushed under hoof", + "death.attack.unicopia.smash.player": "%1$s was crushed by %2$s", + "death.attack.unicopia.zap": "%1$s bit into a Zap Apple", + "death.attack.unicopia.zap.player": "%1$s bit into a Zap Apple whilst fighting %2$s", + "death.attack.unicopia.paradox": "%1$s imploded", + "death.attack.unicopia.paradox.player": "%1$s imploded with some help from %2$s", + "death.attack.unicopia.food_poisoning": "%1$s died of food poisoning", + "death.attack.unicopia.food_poisoning.player": "%2$s poisoned %1$s to death", + "death.attack.unicopia.black_hole": "%1$s was sucked into a black hole", + "death.attack.unicopia.black_hole.player": "%1$s got sucked into %2$s's black hole", + "death.attack.unicopia.kick": "%1$s was kicked really hard", + "death.attack.unicopia.kick.player": "%2$s kicked %1$s really hard", + "death.attack.unicopia.steamroller": "%1$s was flattened", + "death.attack.unicopia.steamroller.player": "%2$s steamrolled %1$s", + "death.attack.unicopia.stalagmite.pegasus": "%1$s tried to perch on a stalagmite", + "death.attack.unicopia.stalagmite.pegasus.player": "%1$s flew into a stalagmite whilst fighting %2$s", "death.fell.accident.ladder.pegasus": "%1$s forgot they could fly and fell off a ladder", "death.fell.accident.vines.pegasus": "%1$s forgot they could fly and fell off some vines",