Working on small parts of the spell system
This commit is contained in:
parent
e159a6795c
commit
2bb7a5fffb
|
@ -713,6 +713,7 @@ public class AlchemicalWizardry
|
||||||
|
|
||||||
GameRegistry.registerBlock(ModBlocks.blockSpellEffect, ItemSpellEffectBlock.class,"AlchemicalWizardry" + (ModBlocks.blockSpellEffect.getUnlocalizedName()));
|
GameRegistry.registerBlock(ModBlocks.blockSpellEffect, ItemSpellEffectBlock.class,"AlchemicalWizardry" + (ModBlocks.blockSpellEffect.getUnlocalizedName()));
|
||||||
LanguageRegistry.addName(new ItemStack(ModBlocks.blockSpellEffect, 1, 0), "Crucible of Fire");
|
LanguageRegistry.addName(new ItemStack(ModBlocks.blockSpellEffect, 1, 0), "Crucible of Fire");
|
||||||
|
LanguageRegistry.addName(new ItemStack(ModBlocks.blockSpellEffect, 1, 1), "Ice Maker");
|
||||||
|
|
||||||
GameRegistry.registerBlock(ModBlocks.speedRune, "speedRune");
|
GameRegistry.registerBlock(ModBlocks.speedRune, "speedRune");
|
||||||
LanguageRegistry.addName(ModBlocks.speedRune, "Speed Rune");
|
LanguageRegistry.addName(ModBlocks.speedRune, "Speed Rune");
|
||||||
|
@ -759,7 +760,7 @@ public class AlchemicalWizardry
|
||||||
GameRegistry.registerBlock(ModBlocks.spectralBlock, "spectralBlock");
|
GameRegistry.registerBlock(ModBlocks.spectralBlock, "spectralBlock");
|
||||||
GameRegistry.registerBlock(ModBlocks.blockBloodLight, "bloodLight");
|
GameRegistry.registerBlock(ModBlocks.blockBloodLight, "bloodLight");
|
||||||
GameRegistry.registerBlock(ModBlocks.blockConduit,"blockConduit");
|
GameRegistry.registerBlock(ModBlocks.blockConduit,"blockConduit");
|
||||||
GameRegistry.registerBlock(ModBlocks.blockSpellEffect,"blockSpellEffect");
|
//GameRegistry.registerBlock(ModBlocks.blockSpellEffect,"blockSpellEffect");
|
||||||
MinecraftForge.setBlockHarvestLevel(ModBlocks.bloodRune, "pickaxe", 2);
|
MinecraftForge.setBlockHarvestLevel(ModBlocks.bloodRune, "pickaxe", 2);
|
||||||
MinecraftForge.setBlockHarvestLevel(ModBlocks.speedRune, "pickaxe", 2);
|
MinecraftForge.setBlockHarvestLevel(ModBlocks.speedRune, "pickaxe", 2);
|
||||||
MinecraftForge.setBlockHarvestLevel(ModBlocks.efficiencyRune, "pickaxe", 2);
|
MinecraftForge.setBlockHarvestLevel(ModBlocks.efficiencyRune, "pickaxe", 2);
|
||||||
|
|
|
@ -1,7 +1,14 @@
|
||||||
package WayofTime.alchemicalWizardry.common.block;
|
package WayofTime.alchemicalWizardry.common.block;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import WayofTime.alchemicalWizardry.ModBlocks;
|
||||||
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock;
|
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock;
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,4 +25,19 @@ public class BlockSpellEffect extends BlockOrientable
|
||||||
{
|
{
|
||||||
return new TESpellEffectBlock();
|
return new TESpellEffectBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||||
|
{
|
||||||
|
if (this.blockID == ModBlocks.blockSpellEffect.blockID)
|
||||||
|
{
|
||||||
|
for(int i=0; i<2; i++)
|
||||||
|
{
|
||||||
|
par3List.add(new ItemStack(par1, 1, i));
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
super.getSubBlocks(par1, par2CreativeTabs, par3List);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,16 +28,16 @@ public class ItemSpellEffectBlock extends ItemBlock
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
name = "fill";
|
name = "ice";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
name = "empty";
|
name = "wind";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
name = "test";
|
name = "water";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -0,0 +1,177 @@
|
||||||
|
package WayofTime.alchemicalWizardry.common.spell.complex.effect;
|
||||||
|
|
||||||
|
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmMelee;
|
||||||
|
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmProjectile;
|
||||||
|
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmSelf;
|
||||||
|
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.MeleeOffensiveIce;
|
||||||
|
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.SelfDefaultIce;
|
||||||
|
|
||||||
|
public class SpellEffectIce extends SpellEffect
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void defaultModificationProjectile(SpellParadigmProjectile parad)
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void offensiveModificationProjectile(SpellParadigmProjectile parad)
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void defensiveModificationProjectile(SpellParadigmProjectile parad)
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void environmentalModificationProjectile(SpellParadigmProjectile parad)
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void defaultModificationSelf(SpellParadigmSelf parad)
|
||||||
|
{
|
||||||
|
parad.addSelfSpellEffect(new SelfDefaultIce(this.powerEnhancement,this.potencyEnhancement, this.costEnhancement));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void offensiveModificationSelf(SpellParadigmSelf parad)
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void defensiveModificationSelf(SpellParadigmSelf parad)
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void environmentalModificationSelf(SpellParadigmSelf parad)
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void defaultModificationMelee(SpellParadigmMelee parad)
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void offensiveModificationMelee(SpellParadigmMelee parad)
|
||||||
|
{
|
||||||
|
parad.addEntityEffect(new MeleeOffensiveIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void defensiveModificationMelee(SpellParadigmMelee parad)
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void environmentalModificationMelee(SpellParadigmMelee parad)
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getCostForDefaultProjectile()
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getCostForOffenseProjectile()
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getCostForDefenseProjectile()
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getCostForEnvironmentProjectile()
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getCostForDefaultSelf()
|
||||||
|
{
|
||||||
|
return (int)(20*(this.powerEnhancement+1)*Math.pow(0.85, costEnhancement));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getCostForOffenseSelf()
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getCostForDefenseSelf()
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getCostForEnvironmentSelf()
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getCostForDefaultMelee()
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getCostForOffenseMelee()
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getCostForDefenseMelee()
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getCostForEnvironmentMelee()
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -9,6 +9,7 @@ import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class SpellHelper
|
public class SpellHelper
|
||||||
|
@ -43,4 +44,13 @@ public class SpellHelper
|
||||||
{
|
{
|
||||||
return d * ((rand.nextFloat() - 0.5D));
|
return d * ((rand.nextFloat() - 0.5D));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Vec3 getEntityBlockVector(Entity entity)
|
||||||
|
{
|
||||||
|
int posX = (int) Math.round(entity.posX - 0.5f);
|
||||||
|
int posY = (int) entity.posY;
|
||||||
|
int posZ = (int) Math.round(entity.posZ - 0.5f);
|
||||||
|
|
||||||
|
return entity.getLookVec().createVectorHelper(posX, posY, posZ);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,11 +13,19 @@ public abstract class ExtrapolatedMeleeEntityEffect implements IMeleeSpellEntity
|
||||||
{
|
{
|
||||||
protected float range;
|
protected float range;
|
||||||
protected float radius;
|
protected float radius;
|
||||||
|
protected int powerUpgrades;
|
||||||
|
protected int potencyUpgrades;
|
||||||
|
protected int costUpgrades;
|
||||||
|
protected int maxHit;
|
||||||
|
|
||||||
public ExtrapolatedMeleeEntityEffect(int range, int radius)
|
public ExtrapolatedMeleeEntityEffect(int power, int potency, int cost)
|
||||||
{
|
{
|
||||||
this.range = range;
|
this.powerUpgrades = power;
|
||||||
this.radius = radius;
|
this.potencyUpgrades = potency;
|
||||||
|
this.costUpgrades = cost;
|
||||||
|
this.range = 2;
|
||||||
|
this.radius = 2;
|
||||||
|
this.maxHit = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -25,21 +33,29 @@ public abstract class ExtrapolatedMeleeEntityEffect implements IMeleeSpellEntity
|
||||||
{
|
{
|
||||||
Vec3 lookVec = entityPlayer.getLook(range);
|
Vec3 lookVec = entityPlayer.getLook(range);
|
||||||
double x = entityPlayer.posX + lookVec.xCoord;
|
double x = entityPlayer.posX + lookVec.xCoord;
|
||||||
double y = entityPlayer.posY + entityPlayer.getEyeHeight() + lookVec.yCoord;
|
double y = entityPlayer.posY + lookVec.yCoord;
|
||||||
double z = entityPlayer.posZ + lookVec.zCoord;
|
double z = entityPlayer.posZ + lookVec.zCoord;
|
||||||
|
|
||||||
List<Entity> entities = world.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(x-0.5f, y-0.5f, z-0.5f, x + 0.5f, y + 0.5f, z + 0.5f).expand(radius, radius, radius));
|
List<Entity> entities = world.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(x-0.5f, y-0.5f, z-0.5f, x + 0.5f, y + 0.5f, z + 0.5f).expand(radius, radius, radius));
|
||||||
|
int hit = 0;
|
||||||
|
|
||||||
if(entities!=null)
|
if(entities!=null)
|
||||||
{
|
{
|
||||||
for(Entity entity : entities)
|
for(Entity entity : entities)
|
||||||
{
|
{
|
||||||
this.entityEffect(world, entity);
|
if(hit<maxHit)
|
||||||
|
{
|
||||||
|
if(this.entityEffect(world, entity))
|
||||||
|
{
|
||||||
|
hit++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void entityEffect(World world, Entity entity);
|
protected abstract boolean entityEffect(World world, Entity entity);
|
||||||
|
|
||||||
public void setRange(float range)
|
public void setRange(float range)
|
||||||
{
|
{
|
||||||
|
@ -50,4 +66,9 @@ public abstract class ExtrapolatedMeleeEntityEffect implements IMeleeSpellEntity
|
||||||
{
|
{
|
||||||
this.radius = radius;
|
this.radius = radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMaxNumberHit(int maxHit)
|
||||||
|
{
|
||||||
|
this.maxHit = maxHit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||||
|
import cpw.mods.fml.common.network.Player;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import WayofTime.alchemicalWizardry.common.PacketHandler;
|
||||||
|
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||||
|
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ExtrapolatedMeleeEntityEffect;
|
||||||
|
|
||||||
|
public class MeleeOffensiveIce extends ExtrapolatedMeleeEntityEffect
|
||||||
|
{
|
||||||
|
public MeleeOffensiveIce(int power, int potency, int cost)
|
||||||
|
{
|
||||||
|
super(power, potency, cost);
|
||||||
|
this.setMaxNumberHit(2);
|
||||||
|
this.setRadius(1);
|
||||||
|
this.setRange(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean entityEffect(World world, Entity entity)
|
||||||
|
{
|
||||||
|
Vec3 blockVector = SpellHelper.getEntityBlockVector(entity);
|
||||||
|
|
||||||
|
int posX = (int)(blockVector.xCoord);
|
||||||
|
int posY = (int)(blockVector.yCoord);
|
||||||
|
int posZ = (int)(blockVector.zCoord);
|
||||||
|
|
||||||
|
double yVel = 1*(0.4*this.powerUpgrades+0.75);
|
||||||
|
|
||||||
|
entity.motionY = yVel;
|
||||||
|
|
||||||
|
for(int i=0;i<2;i++)
|
||||||
|
{
|
||||||
|
if(world.isAirBlock(posX,posY+i,posZ))
|
||||||
|
{
|
||||||
|
world.setBlock(posX, posY+i, posZ, Block.ice.blockID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
entity.fallDistance = 0.0f;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||||
|
import cpw.mods.fml.common.network.Player;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import WayofTime.alchemicalWizardry.common.PacketHandler;
|
||||||
|
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
|
||||||
|
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
|
||||||
|
|
||||||
|
public class SelfDefaultIce extends SelfSpellEffect
|
||||||
|
{
|
||||||
|
public SelfDefaultIce(int power, int potency, int cost)
|
||||||
|
{
|
||||||
|
super(power, potency, cost);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelfUse(World world, EntityPlayer player)
|
||||||
|
{
|
||||||
|
Vec3 blockVector = SpellHelper.getEntityBlockVector(player);
|
||||||
|
|
||||||
|
int posX = (int)(blockVector.xCoord);
|
||||||
|
int posY = (int)(blockVector.yCoord);
|
||||||
|
int posZ = (int)(blockVector.zCoord);
|
||||||
|
|
||||||
|
double yVel = 1*(0.4*this.powerUpgrades+0.75);
|
||||||
|
|
||||||
|
PacketDispatcher.sendPacketToPlayer(PacketHandler.getPlayerVelocitySettingPacket(player.motionX, yVel, player.motionZ),(Player)player);
|
||||||
|
|
||||||
|
for(int i=0;i<2;i++)
|
||||||
|
{
|
||||||
|
if(world.isAirBlock(posX,posY+i,posZ))
|
||||||
|
{
|
||||||
|
world.setBlock(posX, posY+i, posZ, Block.ice.blockID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
player.fallDistance = 0.0f;
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ package WayofTime.alchemicalWizardry.common.tileEntity;
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
|
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect;
|
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect;
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffectFire;
|
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffectFire;
|
||||||
|
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffectIce;
|
||||||
|
|
||||||
public class TESpellEffectBlock extends TESpellBlock
|
public class TESpellEffectBlock extends TESpellBlock
|
||||||
{
|
{
|
||||||
|
@ -14,6 +15,12 @@ public class TESpellEffectBlock extends TESpellBlock
|
||||||
|
|
||||||
public SpellEffect getSpellEffect()
|
public SpellEffect getSpellEffect()
|
||||||
{
|
{
|
||||||
|
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||||
|
switch(meta)
|
||||||
|
{
|
||||||
|
case 0: return new SpellEffectFire();
|
||||||
|
case 1: return new SpellEffectIce();
|
||||||
|
}
|
||||||
return new SpellEffectFire();
|
return new SpellEffectFire();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue