From bdf9760e8a5ef07f0641359d7ae9008f9d87c5b1 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Sun, 2 Feb 2014 08:48:11 -0500 Subject: [PATCH] Few more ice effects --- .../common/block/BlockSpellParadigm.java | 132 +++++++++++++++++- .../spell/complex/effect/SpellEffectIce.java | 13 +- .../spell/complex/effect/SpellHelper.java | 10 ++ .../impactEffects/ProjectileUpdateEffect.java | 15 ++ .../ice/ProjectileDefensiveIce.java | 49 +++++++ .../ice/ProjectileEnvironmentalIce.java | 39 ++++++ .../ice/ProjectileOffensiveIce.java | 32 +++++ .../common/tileEntity/TEOrientable.java | 9 ++ 8 files changed, 292 insertions(+), 7 deletions(-) create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ProjectileUpdateEffect.java create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileDefensiveIce.java create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileEnvironmentalIce.java create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileOffensiveIce.java diff --git a/BM_src/WayofTime/alchemicalWizardry/common/block/BlockSpellParadigm.java b/BM_src/WayofTime/alchemicalWizardry/common/block/BlockSpellParadigm.java index ad69671d..e022e4c5 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/block/BlockSpellParadigm.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/block/BlockSpellParadigm.java @@ -1,17 +1,25 @@ package WayofTime.alchemicalWizardry.common.block; +import java.util.Arrays; import java.util.List; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.Icon; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeDirection; import WayofTime.alchemicalWizardry.ModBlocks; -import WayofTime.alchemicalWizardry.common.items.BlankSpell; import WayofTime.alchemicalWizardry.common.items.ItemComplexSpellCrystal; import WayofTime.alchemicalWizardry.common.tileEntity.TESpellParadigmBlock; import cpw.mods.fml.relauncher.Side; @@ -19,12 +27,16 @@ import cpw.mods.fml.relauncher.SideOnly; public class BlockSpellParadigm extends BlockOrientable { + public static final float minPos = (3f/16f); + public static final float maxPos = (13f/16f); + Icon[] projectileIcons = new Icon[7]; public BlockSpellParadigm(int id) { super(id); setUnlocalizedName("blockSpellParadigm"); + //setBlockBounds(minPos, minPos, minPos, maxPos, maxPos, maxPos); } @Override @@ -86,4 +98,122 @@ public class BlockSpellParadigm extends BlockOrientable return super.onBlockActivated(world, x, y, z, player, side, what, these, are); } + +// @Override +// public boolean isOpaqueCube() +// { +// return false; +// } +// +// @Override +// public boolean renderAsNormalBlock() +// { +// return false; +// } + +// @Override +// public int getRenderType() +// { +// return -1; +// } + + //TODO Need to make a renderer for the paradigm blocks and other spell blocks. + /* + @Override + public void addCollisionBoxesToList(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List arraylist, Entity par7Entity) + { + + setBlockBounds(minPos, minPos, minPos, maxPos, maxPos, maxPos); + super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); + + + TileEntity tile1 = world.getBlockTileEntity(i, j, k); + if (tile1 instanceof TESpellParadigmBlock) + { + TESpellParadigmBlock tileG = (TESpellParadigmBlock) tile1; + + + if (tileG.isSideRendered(ForgeDirection.WEST)) + { + setBlockBounds(0.0F, minPos, minPos, maxPos, maxPos, maxPos); + super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); + } + + + if (tileG.isSideRendered(ForgeDirection.EAST)) + { + setBlockBounds(minPos, minPos, minPos, 1.0F, maxPos, maxPos); + super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); + } + + + if (tileG.isSideRendered(ForgeDirection.DOWN)) + { + setBlockBounds(minPos, 0.0F, minPos, maxPos, maxPos, maxPos); + super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); + } + + + if (tileG.isSideRendered(ForgeDirection.UP)) + { + setBlockBounds(minPos, minPos, minPos, maxPos, 1.0F, maxPos); + super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); + } + + + if (tileG.isSideRendered(ForgeDirection.NORTH)) + { + setBlockBounds(minPos, minPos, 0.0F, maxPos, maxPos, maxPos); + super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); + } + + + if (tileG.isSideRendered(ForgeDirection.SOUTH)) + { + setBlockBounds(minPos, minPos, minPos, maxPos, maxPos, 1.0F); + super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); + } + + +// float facadeThickness = TransportConstants.FACADE_THICKNESS; +// +// +// if (tileG.hasFacade(ForgeDirection.EAST)) { +// setBlockBounds(1 - facadeThickness, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); +// super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); +// } +// +// +// if (tileG.hasFacade(ForgeDirection.WEST)) { +// setBlockBounds(0.0F, 0.0F, 0.0F, facadeThickness, 1.0F, 1.0F); +// super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); +// } +// +// +// if (tileG.hasFacade(ForgeDirection.UP)) { +// setBlockBounds(0.0F, 1 - facadeThickness, 0.0F, 1.0F, 1.0F, 1.0F); +// super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); +// } +// +// +// if (tileG.hasFacade(ForgeDirection.DOWN)) { +// setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, facadeThickness, 1.0F); +// super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); +// } +// +// +// if (tileG.hasFacade(ForgeDirection.SOUTH)) { +// setBlockBounds(0.0F, 0.0F, 1 - facadeThickness, 1.0F, 1.0F, 1.0F); +// super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); +// } +// +// +// if (tileG.hasFacade(ForgeDirection.NORTH)) { +// setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, facadeThickness); +// super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity); +// } + } + setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + */ } diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectIce.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectIce.java index eb82567d..b33e632f 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectIce.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectIce.java @@ -5,6 +5,9 @@ import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmProjectile import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmSelf; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.MeleeDefensiveIce; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.MeleeOffensiveIce; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.ProjectileDefensiveIce; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.ProjectileEnvironmentalIce; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.ProjectileOffensiveIce; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.SelfDefaultIce; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.SelfEnvironmentalIce; @@ -20,29 +23,27 @@ public class SpellEffectIce extends SpellEffect @Override public void offensiveModificationProjectile(SpellParadigmProjectile parad) { - // TODO Auto-generated method stub - + parad.damage+=2; + parad.addImpactEffect(new ProjectileOffensiveIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement)); } @Override public void defensiveModificationProjectile(SpellParadigmProjectile parad) { - // TODO Auto-generated method stub + parad.addImpactEffect(new ProjectileDefensiveIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement)); } @Override public void environmentalModificationProjectile(SpellParadigmProjectile parad) { - // TODO Auto-generated method stub - + parad.addUpdateEffect(new ProjectileEnvironmentalIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement)); } @Override public void defaultModificationSelf(SpellParadigmSelf parad) { parad.addSelfSpellEffect(new SelfDefaultIce(this.powerEnhancement,this.potencyEnhancement, this.costEnhancement)); - } @Override diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellHelper.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellHelper.java index 629c2417..fba4bbb6 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellHelper.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellHelper.java @@ -95,4 +95,14 @@ public class SpellHelper return ForgeDirection.EAST; } + + public static void freezeWaterBlock(World world, int posX, int posY, int posZ) + { + int id = world.getBlockId(posX, posY, posZ); + + if(id == Block.waterStill.blockID || id == Block.waterMoving.blockID) + { + world.setBlock(posX, posY, posZ, Block.ice.blockID); + } + } } diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ProjectileUpdateEffect.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ProjectileUpdateEffect.java new file mode 100644 index 00000000..c65b4eff --- /dev/null +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ProjectileUpdateEffect.java @@ -0,0 +1,15 @@ +package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects; + +public abstract class ProjectileUpdateEffect implements IProjectileUpdateEffect +{ + protected int powerUpgrades; + protected int potencyUpgrades; + protected int costUpgrades; + + public ProjectileUpdateEffect(int power, int potency, int cost) + { + this.powerUpgrades = power; + this.potencyUpgrades = potency; + this.costUpgrades = cost; + } +} diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileDefensiveIce.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileDefensiveIce.java new file mode 100644 index 00000000..6b922b8a --- /dev/null +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileDefensiveIce.java @@ -0,0 +1,49 @@ +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 WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileImpactEffect; + +public class ProjectileDefensiveIce extends ProjectileImpactEffect +{ + public ProjectileDefensiveIce(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; + + int posX = mop.blockX; + int posY = mop.blockY; + int posZ = mop.blockZ; + + for(int i=-horizRadius; i<=horizRadius; i++) + { + for(int k=-horizRadius; k<=horizRadius; k++) + { + for(int j=-vertRadius; j<=vertRadius; j++) + { + SpellHelper.freezeWaterBlock(world, posX+i, posY+j, posZ+k); + + if(world.isAirBlock(posX+i, posY+j, posZ+k)&&!world.isAirBlock(posX+i, posY+j-1, posZ+k)) + { + world.setBlock(posX+i, posY+j, posZ+k, Block.snow.blockID); + } + } + } + } + } +} diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileEnvironmentalIce.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileEnvironmentalIce.java new file mode 100644 index 00000000..0bfdee95 --- /dev/null +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileEnvironmentalIce.java @@ -0,0 +1,39 @@ +package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice; + +import net.minecraft.entity.Entity; +import net.minecraft.util.Vec3; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileUpdateEffect; + +public class ProjectileEnvironmentalIce extends ProjectileUpdateEffect +{ + + public ProjectileEnvironmentalIce(int power, int potency, int cost) + { + super(power, potency, cost); + } + + @Override + public void onUpdateEffect(Entity projectile) + { + Vec3 posVec = SpellHelper.getEntityBlockVector(projectile); + + int horizRange = this.powerUpgrades+1; + int vertRange = this.potencyUpgrades+1; + + int posX = (int)(posVec.xCoord); + int posY = (int)(posVec.yCoord); + int posZ = (int)(posVec.zCoord); + + for(int i=-horizRange; i<=horizRange; i++) + { + for(int j=-vertRange; j<=vertRange; j++) + { + for(int k=-horizRange; k<=horizRange; k++) + { + SpellHelper.freezeWaterBlock(projectile.worldObj, posX+i, posY+j, posZ+k); + } + } + } + } +} diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileOffensiveIce.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileOffensiveIce.java new file mode 100644 index 00000000..dbc4ac1c --- /dev/null +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ice/ProjectileOffensiveIce.java @@ -0,0 +1,32 @@ +package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileImpactEffect; + +public class ProjectileOffensiveIce extends ProjectileImpactEffect +{ + public ProjectileOffensiveIce(int power, int potency, int cost) + { + super(power, potency, cost); + } + + @Override + public void onEntityImpact(Entity mop) + { + if(mop instanceof EntityLivingBase) + { + ((EntityLivingBase) mop).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id,60*(this.powerUpgrades+1),this.potencyUpgrades)); + } + } + + @Override + public void onTileImpact(World world, MovingObjectPosition mop) + { + return; + } +} diff --git a/BM_src/WayofTime/alchemicalWizardry/common/tileEntity/TEOrientable.java b/BM_src/WayofTime/alchemicalWizardry/common/tileEntity/TEOrientable.java index 1933a411..6c22e269 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/tileEntity/TEOrientable.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/tileEntity/TEOrientable.java @@ -90,4 +90,13 @@ public class TEOrientable extends TileEntity implements IOrientable { return PacketHandler.getBlockOrientationPacket(this); } + + public boolean isSideRendered(ForgeDirection side) + { + if(side.equals(this.getInputDirection()) || side.equals(this.getOutputDirection())) + { + return true; + } + return false; + } }