That's one heck of a commit you've got there...
I may have got a bit behind with version control. A lot behind, in fact. Maybe I'll go back and split this sometime - then again, I probably won't. But hey, at least it's here!
This commit is contained in:
@@ -2,35 +2,18 @@ package electroblob.wizardry.spell;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.constants.Element;
|
||||
import electroblob.wizardry.constants.SpellType;
|
||||
import electroblob.wizardry.constants.Tier;
|
||||
import electroblob.wizardry.entity.living.EntitySkeletonMinion;
|
||||
import electroblob.wizardry.entity.living.EntityWitherSkeletonMinion;
|
||||
import electroblob.wizardry.registry.WizardrySounds;
|
||||
import electroblob.wizardry.entity.living.*;
|
||||
import electroblob.wizardry.util.NBTExtras;
|
||||
import electroblob.wizardry.util.ParticleBuilder;
|
||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import electroblob.wizardry.util.WizardryUtilities;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.EntityCaveSpider;
|
||||
import net.minecraft.entity.monster.EntityHusk;
|
||||
import net.minecraft.entity.monster.EntityMagmaCube;
|
||||
import net.minecraft.entity.monster.EntityPigZombie;
|
||||
import net.minecraft.entity.monster.EntitySkeleton;
|
||||
import net.minecraft.entity.monster.EntitySlime;
|
||||
import net.minecraft.entity.monster.EntitySpider;
|
||||
import net.minecraft.entity.monster.EntityStray;
|
||||
import net.minecraft.entity.monster.EntityWitherSkeleton;
|
||||
import net.minecraft.entity.monster.EntityZombie;
|
||||
import net.minecraft.entity.passive.EntityBat;
|
||||
import net.minecraft.entity.passive.EntityChicken;
|
||||
import net.minecraft.entity.passive.EntityCow;
|
||||
import net.minecraft.entity.passive.EntityMooshroom;
|
||||
import net.minecraft.entity.passive.EntityPig;
|
||||
import net.minecraft.entity.monster.*;
|
||||
import net.minecraft.entity.passive.*;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -46,10 +29,11 @@ public class Metamorphosis extends SpellRay {
|
||||
addTransformation(EntityCow.class, EntityMooshroom.class);
|
||||
addTransformation(EntityChicken.class, EntityBat.class);
|
||||
addTransformation(EntityZombie.class, EntityHusk.class);
|
||||
addTransformation(EntitySkeleton.class, EntityWitherSkeleton.class, EntityStray.class);
|
||||
addTransformation(EntitySkeleton.class, EntityStray.class, EntityWitherSkeleton.class);
|
||||
addTransformation(EntitySpider.class, EntityCaveSpider.class);
|
||||
addTransformation(EntitySlime.class, EntityMagmaCube.class);
|
||||
addTransformation(EntitySkeletonMinion.class, EntityWitherSkeletonMinion.class);
|
||||
addTransformation(EntityZombieMinion.class, EntityHuskMinion.class);
|
||||
addTransformation(EntitySkeletonMinion.class, EntityStrayMinion.class, EntityWitherSkeletonMinion.class);
|
||||
}
|
||||
|
||||
/** Adds circular mappings between the given entity classes to the transformations map. In other words, given an
|
||||
@@ -64,23 +48,24 @@ public class Metamorphosis extends SpellRay {
|
||||
}
|
||||
|
||||
public Metamorphosis(){
|
||||
super("metamorphosis", Tier.APPRENTICE, Element.NECROMANCY, SpellType.UTILITY, 15, 30, false, 10, WizardrySounds.SPELL_DEFLECTION);
|
||||
this.soundValues(0.5f, 0.8f, 0);
|
||||
super("metamorphosis", false, EnumAction.NONE);
|
||||
this.soundValues(0.5f, 1f, 0);
|
||||
}
|
||||
|
||||
@Override public boolean canBeCastByNPCs() { return false; }
|
||||
|
||||
@Override
|
||||
protected boolean onEntityHit(World world, Entity target, EntityLivingBase caster, int ticksInUse, SpellModifiers modifiers){
|
||||
|
||||
protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivingBase caster, Vec3d origin, int ticksInUse, SpellModifiers modifiers){
|
||||
|
||||
if(WizardryUtilities.isLiving(target)){
|
||||
|
||||
|
||||
double xPos = target.posX;
|
||||
double yPos = target.posY;
|
||||
double zPos = target.posZ;
|
||||
|
||||
// Sneaking allows the entities to be cycled through in the other direction.
|
||||
Class<? extends EntityLivingBase> newEntityClass = caster.isSneaking() ?
|
||||
// Dispensers always cycle through entities in the normal direction.
|
||||
Class<? extends EntityLivingBase> newEntityClass = caster != null && caster.isSneaking() ?
|
||||
TRANSFORMATIONS.inverse().get(target.getClass()) : TRANSFORMATIONS.get(target.getClass());
|
||||
|
||||
if(newEntityClass == null) return false;
|
||||
@@ -103,7 +88,7 @@ public class Metamorphosis extends SpellRay {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
target.writeToNBT(tag);
|
||||
// Remove the UUID because keeping it the same causes the entity to disappear
|
||||
WizardryUtilities.removeUniqueId(tag, "UUID");
|
||||
NBTExtras.removeUniqueId(tag, "UUID");
|
||||
newEntity.readFromNBT(tag);
|
||||
|
||||
target.setDead();
|
||||
@@ -111,22 +96,27 @@ public class Metamorphosis extends SpellRay {
|
||||
world.spawnEntity(newEntity);
|
||||
|
||||
}else{
|
||||
for(int i=0; i<5; i++){
|
||||
ParticleBuilder.create(Type.DARK_MAGIC).pos(xPos, yPos, zPos).clr(0.1f, 0, 0).spawn(world);
|
||||
for(int i=0; i<20; i++){
|
||||
ParticleBuilder.create(Type.DARK_MAGIC, world.rand, xPos, yPos + 1, zPos, 1, false)
|
||||
.clr(0.1f, 0, 0).spawn(world);
|
||||
}
|
||||
ParticleBuilder.create(Type.BUFF).pos(xPos, yPos, zPos).clr(0xd363cb).spawn(world);
|
||||
}
|
||||
|
||||
this.playSound(world, (EntityLivingBase)target, ticksInUse, -1, modifiers);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onBlockHit(World world, BlockPos pos, EnumFacing side, EntityLivingBase caster, int ticksInUse, SpellModifiers modifiers){
|
||||
protected boolean onBlockHit(World world, BlockPos pos, EnumFacing side, Vec3d hit, EntityLivingBase caster, Vec3d origin, int ticksInUse, SpellModifiers modifiers){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onMiss(World world, EntityLivingBase caster, int ticksInUse, SpellModifiers modifiers){
|
||||
protected boolean onMiss(World world, EntityLivingBase caster, Vec3d origin, Vec3d direction, int ticksInUse, SpellModifiers modifiers){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user