Added awkward gems

This commit is contained in:
Sollace 2019-02-04 22:05:37 +02:00
parent 322419970b
commit 4033b48e24
3 changed files with 70 additions and 0 deletions

View file

@ -0,0 +1,63 @@
package com.minelittlepony.unicopia.spell;
import java.util.List;
import com.google.common.collect.Lists;
import com.minelittlepony.util.shape.Sphere;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.MathHelper;
public class SpellAwkward extends AbstractSpell {
private final List<String> names = Lists.newArrayList(EnumParticleTypes.getParticleNames());
private final int max = names.size();
@Override
public String getName() {
return "awkward";
}
@Override
public SpellAffinity getAffinity() {
return SpellAffinity.NEUTRAL;
}
@Override
public int getTint() {
return 0x248712;
}
@Override
public boolean update(ICaster<?> source, int level) {
return true;
}
@Override
public void render(ICaster<?> source, int level) {
source.spawnParticles(new Sphere(false, (1 + level) * 8), 10, pos -> {
int index = (int)MathHelper.nextDouble(source.getWorld().rand, 0, max);
EnumParticleTypes type = EnumParticleTypes.getByName(names.get(index));
if (shouldSpawnParticle(type)) {
int[] arguments = new int[type.getArgumentCount()];
source.getWorld().spawnParticle(type, pos.x, pos.y, pos.z, 0, 0, 0, arguments);
}
});
}
protected boolean shouldSpawnParticle(EnumParticleTypes type) {
switch (type) {
case BARRIER:
case SMOKE_LARGE:
case MOB_APPEARANCE:
case EXPLOSION_HUGE:
case EXPLOSION_LARGE:
case EXPLOSION_NORMAL: return false;
default: return true;
}
}
}

View file

@ -39,6 +39,7 @@ public class SpellRegistry {
registerSpell(SpellVortex::new); registerSpell(SpellVortex::new);
registerSpell(SpellDisguise::new); registerSpell(SpellDisguise::new);
registerSpell(SpellNecromancy::new); registerSpell(SpellNecromancy::new);
registerSpell(SpellAwkward::new);
} }
@Nullable @Nullable

View file

@ -33,6 +33,9 @@ item.corrupted_gem.enchanted.name=Fractured Gem of %s
spell.shield.name=Defense spell.shield.name=Defense
spell.shield.tagline=Protection I spell.shield.tagline=Protection I
spell.awkward.name=Awkwardness
spell.awkward.tagline=*Derp*
spell.portal.name=Transportation spell.portal.name=Transportation
spell.portal.tagline=Teleportation I spell.portal.tagline=Teleportation I
@ -51,6 +54,9 @@ spell.ice.tagline=Ice I
curse.shield.name=Repulsion curse.shield.name=Repulsion
curse.shield.tagline=Hostility I curse.shield.tagline=Hostility I
curse.awkward.name=Awkwardness
curse.awkward.tagline=*Derp*
curse.vortex.name=Suffering curse.vortex.name=Suffering
curse.vortex.tagline=Torture I curse.vortex.tagline=Torture I