From 5150a6972d112b2aff5fc6b0ea88d54a49ef73cc Mon Sep 17 00:00:00 2001 From: allstar69 Date: Tue, 23 Jul 2013 12:31:03 -0700 Subject: [PATCH] Added very early alpha air effects. --- common/MysticWorld/Client/ClientProxy.java | 4 +-- common/MysticWorld/Client/FX/PowerAirFX.java | 4 +-- common/MysticWorld/CommonProxy.java | 2 +- .../MysticWorld/Entity/EntityChargeAir.java | 4 +-- common/MysticWorld/Items/ItemOrbAir.java | 2 +- common/MysticWorld/Items/ItemStaffAir.java | 31 ++++++++++++++++++- 6 files changed, 38 insertions(+), 9 deletions(-) diff --git a/common/MysticWorld/Client/ClientProxy.java b/common/MysticWorld/Client/ClientProxy.java index 97f3eee..4eb249d 100644 --- a/common/MysticWorld/Client/ClientProxy.java +++ b/common/MysticWorld/Client/ClientProxy.java @@ -77,9 +77,9 @@ public class ClientProxy extends CommonProxy { //particles @Override - public void airFeetFX(World worldObj, double x, double y, double z, float scale) + public void airFeetFX(World worldObj, double x, double y, double z, float scale, int age) { - PowerAirFX airFX = new PowerAirFX(worldObj, x, y, z, scale); + PowerAirFX airFX = new PowerAirFX(worldObj, x, y, z, scale, age); ModLoader.getMinecraftInstance().effectRenderer.addEffect(airFX); } diff --git a/common/MysticWorld/Client/FX/PowerAirFX.java b/common/MysticWorld/Client/FX/PowerAirFX.java index def74b1..cb1ec57 100644 --- a/common/MysticWorld/Client/FX/PowerAirFX.java +++ b/common/MysticWorld/Client/FX/PowerAirFX.java @@ -18,7 +18,7 @@ public class PowerAirFX extends EntityFX super(world, x, y, z); } - public PowerAirFX(World world, double x, double y, double z, float scale){ + public PowerAirFX(World world, double x, double y, double z, float scale, int age){ super(world, x, y, z); this.motionX += motionX; this.motionY += motionY; @@ -31,7 +31,7 @@ public class PowerAirFX extends EntityFX this.particleBlue = 1.0F; this.particleScale = scale; this.noClip = true; - this.particleMaxAge = 15; + this.particleMaxAge = age; } public PowerAirFX(World world, double x, double y, double z, double motionX, double motionY, double motionZ, float rotPitch, float rotYaw){ diff --git a/common/MysticWorld/CommonProxy.java b/common/MysticWorld/CommonProxy.java index 925431a..afecafe 100644 --- a/common/MysticWorld/CommonProxy.java +++ b/common/MysticWorld/CommonProxy.java @@ -18,7 +18,7 @@ public class CommonProxy { return 0; } - public void airFeetFX(World worldObj, double x, double y, double z, float scale){ + public void airFeetFX(World worldObj, double x, double y, double z, float scale, int age){ } public void earthFX(World worldObj, double x, double y, double z, float scale){ diff --git a/common/MysticWorld/Entity/EntityChargeAir.java b/common/MysticWorld/Entity/EntityChargeAir.java index 441473c..81982a6 100644 --- a/common/MysticWorld/Entity/EntityChargeAir.java +++ b/common/MysticWorld/Entity/EntityChargeAir.java @@ -144,8 +144,8 @@ public class EntityChargeAir extends Entity { f2 = 0.8F; } - MysticWorld.proxy.airFeetFX(this.worldObj, this.posX + (rand.nextDouble()/2), this.posY + 0.5D, this.posZ + (rand.nextDouble()/2), particleScale); - MysticWorld.proxy.airFeetFX(this.worldObj, this.posX + (rand.nextDouble()/2), this.posY + 0.5D, this.posZ + (rand.nextDouble()/2), particleScale); + MysticWorld.proxy.airFeetFX(this.worldObj, this.posX + (rand.nextDouble()/2), this.posY + 0.5D, this.posZ + (rand.nextDouble()/2), particleScale, 15); + MysticWorld.proxy.airFeetFX(this.worldObj, this.posX + (rand.nextDouble()/2), this.posY + 0.5D, this.posZ + (rand.nextDouble()/2), particleScale, 15); this.setPosition(this.posX, this.posY, this.posZ); } diff --git a/common/MysticWorld/Items/ItemOrbAir.java b/common/MysticWorld/Items/ItemOrbAir.java index 2d48637..7ce463a 100644 --- a/common/MysticWorld/Items/ItemOrbAir.java +++ b/common/MysticWorld/Items/ItemOrbAir.java @@ -32,7 +32,7 @@ public class ItemOrbAir extends ItemOrb if (currentItem.itemID == itemStack.itemID) { player.fallDistance = 0.0F; - MysticWorld.proxy.airFeetFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY, (player.posZ - 0.5D) + rand.nextDouble(), 1.0F); + MysticWorld.proxy.airFeetFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY, (player.posZ - 0.5D) + rand.nextDouble(), 1.0F, 15); } } } diff --git a/common/MysticWorld/Items/ItemStaffAir.java b/common/MysticWorld/Items/ItemStaffAir.java index a0c3809..d683ad7 100644 --- a/common/MysticWorld/Items/ItemStaffAir.java +++ b/common/MysticWorld/Items/ItemStaffAir.java @@ -4,6 +4,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.MathHelper; import net.minecraft.world.World; import org.lwjgl.input.Keyboard; @@ -37,7 +38,7 @@ public class ItemStaffAir extends ItemStaff { player.fallDistance = 0.0F; if (!world.isRemote) - MysticWorld.proxy.airFeetFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY + (player.height/itemStack.stackTagCompound.getInteger("maxChargeTime") * itemStack.stackTagCompound.getInteger("chargeTime")), (player.posZ - 0.5D) + rand.nextDouble(), 1.0f + ((float)(itemStack.stackTagCompound.getInteger("chargeTime")) * (5.0f * (1 / (float)itemStack.stackTagCompound.getInteger("maxChargeTime"))))); + MysticWorld.proxy.airFeetFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY + (player.height/itemStack.stackTagCompound.getInteger("maxChargeTime") * itemStack.stackTagCompound.getInteger("chargeTime")), (player.posZ - 0.5D) + rand.nextDouble(), 1.0f + ((float)(itemStack.stackTagCompound.getInteger("chargeTime")) * (5.0f * (1 / (float)itemStack.stackTagCompound.getInteger("maxChargeTime")))), 15); if (!Mouse.isButtonDown(1)) { @@ -65,22 +66,48 @@ public class ItemStaffAir extends ItemStaff { } itemStack.stackTagCompound.setInteger("chargeTime", 0); + itemStack.stackTagCompound.setFloat("angle", 0); + itemStack.stackTagCompound.setDouble("radius", 0); itemStack.stackTagCompound.setBoolean("charging", false); } else { + if ((Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))) + { + if (!world.isRemote) + MysticWorld.proxy.airFeetFX(world, player.posX + MathHelper.cos(itemStack.stackTagCompound.getFloat("angle")) * itemStack.stackTagCompound.getDouble("radius"), player.posY, player.posZ + MathHelper.sin(itemStack.stackTagCompound.getFloat("angle")) * itemStack.stackTagCompound.getDouble("radius"), 1.0f + ((float)(itemStack.stackTagCompound.getInteger("chargeTime")) * (5.0f * (1 / (float)itemStack.stackTagCompound.getInteger("maxChargeTime")))), 45); + } + if (itemStack.stackTagCompound.getBoolean("charging") == true) { itemStack.stackTagCompound.setInteger("chargeTime", itemStack.stackTagCompound.getInteger("chargeTime") + 1); + itemStack.stackTagCompound.setFloat("angle", itemStack.stackTagCompound.getFloat("angle") + 0.1f); + itemStack.stackTagCompound.setDouble("radius", itemStack.stackTagCompound.getDouble("radius") + 0.1D); } } } + else + { + itemStack.stackTagCompound.setInteger("chargeTime", 0); + itemStack.stackTagCompound.setFloat("angle", 0); + itemStack.stackTagCompound.setDouble("radius", 0); + } } if (itemStack.stackTagCompound.getInteger("chargeTime") > itemStack.stackTagCompound.getInteger("maxChargeTime")) { itemStack.stackTagCompound.setInteger("chargeTime", itemStack.stackTagCompound.getInteger("maxChargeTime")); } + + if (itemStack.stackTagCompound.getDouble("radius") > 7.0D) + { + itemStack.stackTagCompound.setDouble("radius", 7.0D); + } + + if (itemStack.stackTagCompound.getFloat("angle") > 6.0f) + { + itemStack.stackTagCompound.setFloat("angle", 0.0f); + } } @Override @@ -89,6 +116,8 @@ public class ItemStaffAir extends ItemStaff { if (itemStack.stackTagCompound == null) itemStack.setTagCompound(new NBTTagCompound()); + itemStack.stackTagCompound.setDouble("radius", 2.0D); + if (itemStack.stackTagCompound.getBoolean("charging") == false) { itemStack.stackTagCompound.setBoolean("charging", true);