Remove compound spells since they weren't being used

This commit is contained in:
Sollace 2022-09-16 22:12:51 +02:00
parent 88e078cfc7
commit 3ba4040bb9
3 changed files with 0 additions and 57 deletions

View file

@ -1,46 +0,0 @@
package com.minelittlepony.unicopia.ability.magic.spell;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import com.minelittlepony.unicopia.ability.magic.spell.effect.CustomisedSpellType;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
public class CompoundSpell extends AbstractDelegatingSpell {
private final List<Spell> spells = new ArrayList<>();
public CompoundSpell(CustomisedSpellType<?> type) {
super(type);
}
@Override
public Collection<Spell> getDelegates() {
return spells;
}
@Override
public Spell combineWith(Spell other) {
if (other instanceof AbstractDelegatingSpell) {
spells.addAll(((AbstractDelegatingSpell)other).getDelegates());
} else {
spells.add(other);
}
return this;
}
@Override
protected void loadDelegates(NbtCompound compound) {
spells.clear();
if (compound.contains("spells", NbtElement.LIST_TYPE)) {
spells.addAll(Spell.SERIALIZER.readAll(compound.getList("spells", NbtElement.COMPOUND_TYPE)).toList());
}
}
@Override
protected void saveDelegates(NbtCompound compound) {
compound.put("spells", Spell.SERIALIZER.writeAll(spells));
}
}

View file

@ -90,15 +90,6 @@ public interface Spell extends NbtSerialisable, Affine {
*/
void onDestroyed(Caster<?> caster);
/**
* Used by crafting to combine two spells into one.
*
* Returns a compound spell representing the union of this and the other spell.
*/
default Spell combineWith(Spell other) {
return SpellType.COMPOUND_SPELL.withTraits().create().combineWith(this).combineWith(other);
}
/**
* Converts this spell into a placeable spell.
*/

View file

@ -12,7 +12,6 @@ import com.minelittlepony.unicopia.Unicopia;
import com.minelittlepony.unicopia.ability.magic.Affine;
import com.minelittlepony.unicopia.ability.magic.SpellPredicate;
import com.minelittlepony.unicopia.ability.magic.spell.AbstractDisguiseSpell;
import com.minelittlepony.unicopia.ability.magic.spell.CompoundSpell;
import com.minelittlepony.unicopia.ability.magic.spell.DispersableDisguiseSpell;
import com.minelittlepony.unicopia.ability.magic.spell.RainboomAbilitySpell;
import com.minelittlepony.unicopia.ability.magic.spell.PlaceableSpell;
@ -37,7 +36,6 @@ public final class SpellType<T extends Spell> implements Affine, SpellPredicate<
public static final Registry<SpellType<?>> REGISTRY = Registries.createSimple(Unicopia.id("spells"));
private static final Map<Affinity, Set<SpellType<?>>> BY_AFFINITY = new EnumMap<>(Affinity.class);
public static final SpellType<CompoundSpell> COMPOUND_SPELL = register("compound", Affinity.NEUTRAL, 0, false, SpellTraits.EMPTY, CompoundSpell::new);
public static final SpellType<PlaceableSpell> PLACED_SPELL = register("placed", Affinity.NEUTRAL, 0, false, SpellTraits.EMPTY, PlaceableSpell::new);
public static final SpellType<ThrowableSpell> THROWN_SPELL = register("thrown", Affinity.NEUTRAL, 0, false, SpellTraits.EMPTY, ThrowableSpell::new);