mirror of
https://github.com/GTNewHorizons/Tainted-Magic.git
synced 2026-11-26 14:53:07 +00:00
Focus changes & cleanup
This commit is contained in:
1 parent
17d15536c8
commit
d20882c5b9
6 files changed
+661
-657
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package taintedmagic.common.items.wand.foci;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -29,130 +30,141 @@ import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
|
||||
public class ItemFocusShockwave extends ItemFocusBasic
|
||||
{
|
||||
private static final AspectList cost = new AspectList().add(Aspect.AIR, 500).add(Aspect.ENTROPY, 300);
|
||||
private static final AspectList COST = new AspectList().add(Aspect.AIR, 150).add(Aspect.ENTROPY, 100);
|
||||
|
||||
public static IIcon depthIcon;
|
||||
IIcon depthIcon;
|
||||
|
||||
public ItemFocusShockwave ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setUnlocalizedName("ItemFocusShockwave");
|
||||
}
|
||||
public ItemFocusShockwave ()
|
||||
{
|
||||
this.setCreativeTab(TaintedMagic.tabTaintedMagic);
|
||||
this.setUnlocalizedName("ItemFocusShockwave");
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.icon = ir.registerIcon("taintedmagic:ItemFocusShockwave");
|
||||
this.depthIcon = ir.registerIcon("taintedmagic:ItemFocusShockwave_depth");
|
||||
}
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void registerIcons (IIconRegister ir)
|
||||
{
|
||||
this.icon = ir.registerIcon("taintedmagic:ItemFocusShockwave");
|
||||
this.depthIcon = ir.registerIcon("taintedmagic:ItemFocusShockwave_depth");
|
||||
}
|
||||
|
||||
public IIcon getFocusDepthLayerIcon (ItemStack s)
|
||||
{
|
||||
return this.depthIcon;
|
||||
}
|
||||
public IIcon getFocusDepthLayerIcon (ItemStack stack)
|
||||
{
|
||||
return this.depthIcon;
|
||||
}
|
||||
|
||||
public String getSortingHelper (ItemStack s)
|
||||
{
|
||||
return "SHOCKWAVE" + super.getSortingHelper(s);
|
||||
}
|
||||
public String getSortingHelper (ItemStack stack)
|
||||
{
|
||||
return "SHOCKWAVE" + super.getSortingHelper(stack);
|
||||
}
|
||||
|
||||
public int getFocusColor (ItemStack s)
|
||||
{
|
||||
return 0xB0B7C4;
|
||||
}
|
||||
public int getFocusColor (ItemStack stack)
|
||||
{
|
||||
return 0xB0B7C4;
|
||||
}
|
||||
|
||||
public AspectList getVisCost (ItemStack s)
|
||||
{
|
||||
return cost;
|
||||
}
|
||||
public AspectList getVisCost (ItemStack stack)
|
||||
{
|
||||
return COST;
|
||||
}
|
||||
|
||||
public int getActivationCooldown (ItemStack s)
|
||||
{
|
||||
return 10000;
|
||||
}
|
||||
public int getActivationCooldown (ItemStack stack)
|
||||
{
|
||||
return 10000;
|
||||
}
|
||||
|
||||
public boolean isVisCostPerTick (ItemStack s)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public boolean isVisCostPerTick (ItemStack stack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemFocusBasic.WandFocusAnimation getAnimation (ItemStack s)
|
||||
{
|
||||
return ItemFocusBasic.WandFocusAnimation.WAVE;
|
||||
}
|
||||
public ItemFocusBasic.WandFocusAnimation getAnimation (ItemStack stack)
|
||||
{
|
||||
return ItemFocusBasic.WandFocusAnimation.WAVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack s, EntityPlayer p, List l, boolean b)
|
||||
{
|
||||
super.addInformation(s, p, l, b);
|
||||
l.add(" ");
|
||||
l.add(EnumChatFormatting.BLUE + "+" + new String(this.isUpgradedWith(s, FocusUpgradeType.enlarge) ? Integer.toString(15 + this.getUpgradeLevel(s, FocusUpgradeType.enlarge)) : "15") + " "
|
||||
+ StatCollector.translateToLocal("text.radius"));
|
||||
}
|
||||
@Override
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean b)
|
||||
{
|
||||
super.addInformation(stack, player, list, b);
|
||||
list.add(" ");
|
||||
list.add(EnumChatFormatting.BLUE + "+"
|
||||
+ new String(this.isUpgradedWith(stack, FocusUpgradeType.enlarge)
|
||||
? Integer.toString(15 + this.getUpgradeLevel(stack, FocusUpgradeType.enlarge)) : "15")
|
||||
+ " " + StatCollector.translateToLocal("text.radius"));
|
||||
}
|
||||
|
||||
public ItemStack onFocusRightClick (ItemStack s, World w, EntityPlayer p, MovingObjectPosition mop)
|
||||
{
|
||||
ItemWandCasting wand = (ItemWandCasting) s.getItem();
|
||||
public ItemStack onFocusRightClick (ItemStack stack, World world, EntityPlayer player, MovingObjectPosition mop)
|
||||
{
|
||||
ItemWandCasting wand = (ItemWandCasting) stack.getItem();
|
||||
|
||||
int pot = wand.getFocusPotency(s);
|
||||
if (wand.consumeAllVis(s, p, getVisCost(s), true, false))
|
||||
{
|
||||
List<EntityLivingBase> ents = w.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(p.posX, p.posY, p.posZ, p.posX + 1, p.posY + 1, p.posZ + 1).expand(15.0D
|
||||
+ this.getUpgradeLevel(s, FocusUpgradeType.enlarge), 15.0D + this.getUpgradeLevel(s, FocusUpgradeType.enlarge), 15.0D + this.getUpgradeLevel(s, FocusUpgradeType.enlarge)));
|
||||
if (ents != null && ents.size() > 0)
|
||||
{
|
||||
for (int a = 0; a < ents.size(); a++)
|
||||
{
|
||||
EntityLivingBase e = ents.get(a);
|
||||
int potency = wand.getFocusPotency(stack);
|
||||
int enlarge = wand.getFocusEnlarge(stack);
|
||||
|
||||
if (e != p && e.isEntityAlive() && !e.isEntityInvulnerable())
|
||||
{
|
||||
double dist = TaintedMagicHelper.getDistanceTo(e.posX, e.posY, e.posZ, p);
|
||||
if (dist < 7.0D) e.attackEntityFrom(DamageSource.magic, 2.0F + this.getUpgradeLevel(s, FocusUpgradeType.potency));
|
||||
Vector3 movement = TaintedMagicHelper.getVectorBetweenEntities(e, p);
|
||||
e.addVelocity(movement.x * (5.0D + this.getUpgradeLevel(s, FocusUpgradeType.potency)), 1.5D + (this.getUpgradeLevel(s, FocusUpgradeType.potency) * 0.1D), movement.z
|
||||
* (5.0D + this.getUpgradeLevel(s, FocusUpgradeType.potency)));
|
||||
if (w.isRemote) spawnParticles(w, p, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
w.playSoundAtEntity(p, "taintedmagic:shockwave", 5.0F, 1.5F * (float) Math.random());
|
||||
return s;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (wand.consumeAllVis(stack, player, getVisCost(stack), true, false))
|
||||
{
|
||||
List<EntityLivingBase> ents =
|
||||
world.getEntitiesWithinAABB(EntityLivingBase.class,
|
||||
AxisAlignedBB.getBoundingBox(player.posX, player.posY, player.posZ, player.posX + 1,
|
||||
player.posY + 1, player.posZ + 1)
|
||||
.expand(15.0D + enlarge, 15.0D + enlarge, 15.0D + enlarge));
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public static void spawnParticles (World w, EntityPlayer p, Entity e)
|
||||
{
|
||||
FXLightningBolt bolt = new FXLightningBolt(w, p, e, w.rand.nextLong(), 4);
|
||||
if (ents != null && ents.size() > 0) for (int i = 0; i < ents.size(); i++)
|
||||
{
|
||||
EntityLivingBase entity = ents.get(i);
|
||||
|
||||
bolt.defaultFractal();
|
||||
bolt.setType(2);
|
||||
bolt.setWidth(0.125F);
|
||||
bolt.finalizeBolt();
|
||||
for (int a = 0; a < 5; a++)
|
||||
{
|
||||
Thaumcraft.proxy.sparkle((float) e.posX + (p.worldObj.rand.nextFloat() - p.worldObj.rand.nextFloat()) * 0.6F, (float) e.posY + (p.worldObj.rand.nextFloat() - p.worldObj.rand.nextFloat())
|
||||
* 0.6F, (float) e.posZ + (p.worldObj.rand.nextFloat() - p.worldObj.rand.nextFloat()) * 0.6F, 2.0F + p.worldObj.rand.nextFloat(), 2, 0.05F + p.worldObj.rand.nextFloat() * 0.05F);
|
||||
}
|
||||
}
|
||||
if (entity != player && entity.isEntityAlive() && !entity.isEntityInvulnerable())
|
||||
{
|
||||
double dist = TaintedMagicHelper.getDistanceTo(player, entity.posX, entity.posY, entity.posZ);
|
||||
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank (ItemStack s, int rank)
|
||||
{
|
||||
switch (rank)
|
||||
{
|
||||
case 1 :
|
||||
return new FocusUpgradeType[]{ FocusUpgradeType.frugal, FocusUpgradeType.enlarge, FocusUpgradeType.potency };
|
||||
case 2 :
|
||||
return new FocusUpgradeType[]{ FocusUpgradeType.frugal, FocusUpgradeType.enlarge, FocusUpgradeType.potency };
|
||||
case 3 :
|
||||
return new FocusUpgradeType[]{ FocusUpgradeType.frugal, FocusUpgradeType.enlarge, FocusUpgradeType.potency };
|
||||
case 4 :
|
||||
return new FocusUpgradeType[]{ FocusUpgradeType.frugal, FocusUpgradeType.enlarge, FocusUpgradeType.potency };
|
||||
case 5 :
|
||||
return new FocusUpgradeType[]{ FocusUpgradeType.frugal, FocusUpgradeType.enlarge, FocusUpgradeType.potency };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (dist < 7.0D) entity.attackEntityFrom(DamageSource.magic, 2.0F + potency);
|
||||
|
||||
Vector3 vel = TaintedMagicHelper.getVectorBetweenEntities(entity, player);
|
||||
entity.addVelocity(vel.x * (5.0D + potency), 1.5D + (potency * 0.1D), vel.z * (5.0D + potency));
|
||||
|
||||
if (world.isRemote) spawnParticles(world, player, entity);
|
||||
}
|
||||
}
|
||||
world.playSoundAtEntity(player, "taintedmagic:shockwave", 5.0F, 1.5F * (float) Math.random());
|
||||
return stack;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public static void spawnParticles (World world, EntityPlayer player, Entity entity)
|
||||
{
|
||||
FXLightningBolt bolt = new FXLightningBolt(world, player, entity, world.rand.nextLong(), 4);
|
||||
|
||||
bolt.defaultFractal();
|
||||
bolt.setType(2);
|
||||
bolt.setWidth(0.125F);
|
||||
bolt.finalizeBolt();
|
||||
|
||||
for (int a = 0; a < 5; a++)
|
||||
{
|
||||
Random random = player.worldObj.rand;
|
||||
float x = (float) entity.posX + (random.nextFloat() - random.nextFloat()) * 0.6F;
|
||||
float y = (float) entity.posY + (random.nextFloat() - random.nextFloat()) * 0.6F;
|
||||
float z = (float) entity.posZ + (random.nextFloat() - random.nextFloat()) * 0.6F;
|
||||
Thaumcraft.proxy.sparkle(x, y, z, 2.0F + random.nextFloat(), 2, 0.05F + random.nextFloat() * 0.05F);
|
||||
}
|
||||
}
|
||||
|
||||
public FocusUpgradeType[] getPossibleUpgradesByRank (ItemStack stack, int rank)
|
||||
{
|
||||
switch (rank)
|
||||
{
|
||||
case 1 :
|
||||
return new FocusUpgradeType[]{ FocusUpgradeType.frugal, FocusUpgradeType.enlarge, FocusUpgradeType.potency };
|
||||
case 2 :
|
||||
return new FocusUpgradeType[]{ FocusUpgradeType.frugal, FocusUpgradeType.enlarge, FocusUpgradeType.potency };
|
||||
case 3 :
|
||||
return new FocusUpgradeType[]{ FocusUpgradeType.frugal, FocusUpgradeType.enlarge, FocusUpgradeType.potency };
|
||||
case 4 :
|
||||
return new FocusUpgradeType[]{ FocusUpgradeType.frugal, FocusUpgradeType.enlarge, FocusUpgradeType.potency };
|
||||
case 5 :
|
||||
return new FocusUpgradeType[]{ FocusUpgradeType.frugal, FocusUpgradeType.enlarge, FocusUpgradeType.potency };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user