2020-04-15 17:22:29 +02:00
|
|
|
package com.minelittlepony.unicopia.ability;
|
|
|
|
|
2020-05-06 15:55:25 +02:00
|
|
|
import java.util.EnumMap;
|
|
|
|
import java.util.HashSet;
|
2020-04-25 22:03:36 +02:00
|
|
|
import java.util.Map;
|
2020-05-06 15:55:25 +02:00
|
|
|
import java.util.Set;
|
2020-04-15 17:22:29 +02:00
|
|
|
|
2020-04-25 15:37:17 +02:00
|
|
|
import net.minecraft.util.Identifier;
|
|
|
|
import net.minecraft.util.registry.MutableRegistry;
|
|
|
|
import net.minecraft.util.registry.SimpleRegistry;
|
2020-04-15 17:22:29 +02:00
|
|
|
|
2020-04-25 15:37:17 +02:00
|
|
|
public interface Abilities {
|
2020-05-06 15:55:25 +02:00
|
|
|
Map<AbilitySlot, Set<Ability<?>>> BY_SLOT = new EnumMap<>(AbilitySlot.class);
|
2020-04-25 15:37:17 +02:00
|
|
|
MutableRegistry<Ability<?>> REGISTRY = new SimpleRegistry<>();
|
2020-04-15 17:22:29 +02:00
|
|
|
|
2020-04-25 15:46:29 +02:00
|
|
|
// unicorn / alicorn
|
2020-05-06 15:55:25 +02:00
|
|
|
Ability<?> TELEPORT = register(new UnicornTeleportAbility(), "teleport", AbilitySlot.PRIMARY);
|
|
|
|
Ability<?> CAST = register(new UnicornCastingAbility(), "cast", AbilitySlot.SECONDARY);
|
2020-04-15 17:22:29 +02:00
|
|
|
|
2020-04-25 15:46:29 +02:00
|
|
|
// earth / alicorn
|
2020-05-06 15:55:25 +02:00
|
|
|
Ability<?> STOMP = register(new EarthPonyStompAbility(), "stomp", AbilitySlot.PRIMARY);
|
|
|
|
Ability<?> GROW = register(new EarthPonyGrowAbility(), "grow", AbilitySlot.SECONDARY);
|
2020-04-15 17:22:29 +02:00
|
|
|
|
2020-04-25 15:46:29 +02:00
|
|
|
// pegasus / bat / alicorn / changeling
|
2020-05-06 15:55:25 +02:00
|
|
|
Ability<?> CARRY = register(new CarryAbility(), "carry", AbilitySlot.PASSIVE);
|
2020-04-25 15:46:29 +02:00
|
|
|
|
|
|
|
// pegasus / alicorn
|
2020-05-06 15:55:25 +02:00
|
|
|
Ability<?> CLOUD = register(new PegasusCloudInteractionAbility(), "cloud", AbilitySlot.TERTIARY);
|
2020-04-15 17:22:29 +02:00
|
|
|
|
2020-04-25 15:37:17 +02:00
|
|
|
// changeling
|
2020-05-06 15:55:25 +02:00
|
|
|
Ability<?> DISGUISE = register(new ChangelingDisguiseAbility(), "disguise", AbilitySlot.PRIMARY);
|
|
|
|
Ability<?> FEED = register(new ChangelingFeedAbility(), "feed", AbilitySlot.SECONDARY);
|
|
|
|
Ability<?> TRAP = register(new ChangelingTrapAbility(), "trap", AbilitySlot.TERTIARY);
|
2020-04-15 17:22:29 +02:00
|
|
|
|
2020-05-06 15:55:25 +02:00
|
|
|
static <T extends Ability<?>> T register(T power, String name, AbilitySlot slot) {
|
2020-04-25 15:37:17 +02:00
|
|
|
Identifier id = new Identifier("unicopia", name);
|
2020-05-06 15:55:25 +02:00
|
|
|
BY_SLOT.computeIfAbsent(slot, s -> new HashSet<>()).add(power);
|
2020-04-25 15:37:17 +02:00
|
|
|
return REGISTRY.add(id, power);
|
2020-04-15 17:22:29 +02:00
|
|
|
}
|
|
|
|
}
|