Finished the ice spell effect
This commit is contained in:
parent
1fbaf9a3f4
commit
0716155b7d
4 changed files with 144 additions and 17 deletions
|
@ -0,0 +1,38 @@
|
|||
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.projectile.EntitySnowball;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ExtrapolatedMeleeEntityEffect;
|
||||
|
||||
public class MeleeEnvironmentalIce extends ExtrapolatedMeleeEntityEffect
|
||||
{
|
||||
public MeleeEnvironmentalIce(int power, int potency, int cost)
|
||||
{
|
||||
super(power, potency, cost);
|
||||
this.setMaxNumberHit(1+potency);
|
||||
this.setRadius(2);
|
||||
this.setRange(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean entityEffect(World world, Entity entity)
|
||||
{
|
||||
for(int i=0;i<=this.powerUpgrades;i++)
|
||||
{
|
||||
double randX = (world.rand.nextDouble()-world.rand.nextDouble())*3;
|
||||
double randY = -world.rand.nextDouble()*3;
|
||||
double randZ = (world.rand.nextDouble()-world.rand.nextDouble())*3;
|
||||
|
||||
EntitySnowball snowball = new EntitySnowball(world, entity.posX-3*randX, entity.posY-3*randY, entity.posZ-3*randZ);
|
||||
snowball.motionX = randX;
|
||||
snowball.motionY = randY;
|
||||
snowball.motionZ = randZ;
|
||||
|
||||
world.spawnEntityInWorld(snowball);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileImpactEffect;
|
||||
|
||||
public class ProjectileDefaultIce extends ProjectileImpactEffect
|
||||
{
|
||||
public ProjectileDefaultIce(int power, int potency, int cost)
|
||||
{
|
||||
super(power, potency, cost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityImpact(Entity mop)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTileImpact(World world, MovingObjectPosition mop)
|
||||
{
|
||||
int horizRadius = this.powerUpgrades+1;
|
||||
int vertRadius = this.potencyUpgrades;
|
||||
|
||||
ForgeDirection sideHit = ForgeDirection.getOrientation(mop.sideHit);
|
||||
|
||||
int posX = mop.blockX + sideHit.offsetX;
|
||||
int posY = mop.blockY + sideHit.offsetY;
|
||||
int posZ = mop.blockZ + sideHit.offsetZ;
|
||||
|
||||
if(world.isAirBlock(posX, posY, posZ))
|
||||
{
|
||||
world.setBlock(posX, posY, posZ, Block.ice.blockID);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
|
||||
|
||||
public class SelfOffensiveIce extends SelfSpellEffect
|
||||
{
|
||||
public SelfOffensiveIce(int power, int potency, int cost)
|
||||
{
|
||||
super(power, potency, cost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSelfUse(World world, EntityPlayer player)
|
||||
{
|
||||
double horizRadius = this.powerUpgrades+1;
|
||||
double vertRadius = 0.5*this.powerUpgrades+1;
|
||||
|
||||
List<Entity> entities = SpellHelper.getEntitiesInRange(world, player.posX, player.posY, player.posZ,horizRadius, vertRadius);
|
||||
|
||||
if(entities==null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int i=0;
|
||||
int number = this.powerUpgrades+1;
|
||||
|
||||
for(Entity entity : entities)
|
||||
{
|
||||
if(i>=number)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(entity instanceof EntityLivingBase && !entity.equals(player))
|
||||
{
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id,60*(1+this.powerUpgrades),this.potencyUpgrades));
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue