Spell Work

Finished the spell blocks enough to allow further expansion. Need to
work on textures, as well as the orientation mechanics of the blocks.
Also need to look at Vazkii's block renderer to verify a few feature
additions.
This commit is contained in:
WayofTime 2014-01-24 18:07:13 -05:00
parent 1393a24b6e
commit 5dcef131dc
22 changed files with 765 additions and 85 deletions

View file

@ -1,10 +1,11 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet;
public class TEConduit extends TEOrientable
public class TEConduit extends TESpellBlock
{
@Override
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
@ -22,10 +23,7 @@ public class TEConduit extends TEOrientable
@Override
public void updateEntity()
{
//this.capacity=(int) (10000*this.capacityMultiplier);
// if (!worldObj.isRemote && worldObj.getWorldTime() % 20 == 0)
// {
// }
}
@Override
@ -33,4 +31,10 @@ public class TEConduit extends TEOrientable
{
return PacketHandler.getBlockOrientationPacket(this);
}
@Override
protected void applySpellChange(SpellParadigm parad)
{
return;
}
}

View file

@ -1,6 +1,50 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
public class TESpellBlock extends TEOrientable
{
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffectFire;
public abstract class TESpellBlock extends TEOrientable
{
public void modifySpellParadigm(SpellParadigm parad)
{
this.applySpellChange(parad);
TileEntity tile = this.getTileAtOutput();
if(tile instanceof TESpellBlock)
{
TESpellBlock outputBlock = (TESpellBlock)tile;
outputBlock.modifySpellParadigm(parad);
}
}
protected abstract void applySpellChange(SpellParadigm parad);
public TESpellBlock getTileAtOutput()
{
ForgeDirection output = this.getOutputDirection();
int xOffset = output.offsetX;
int yOffset = output.offsetY;
int zOffset = output.offsetZ;
TileEntity tile = worldObj.getBlockTileEntity(xCoord + xOffset, yCoord + yOffset, zCoord + zOffset);
if(tile instanceof TESpellBlock && ((TESpellBlock)tile).canInputRecieveOutput(output))
{
return (TESpellBlock)tile;
}
return null;
}
public boolean canInputRecieve()
{
return true;
}
public boolean canInputRecieveOutput(ForgeDirection output)
{
return this.canInputRecieve() && this.getInputDirection().getOpposite()==output;
}
}

View file

@ -0,0 +1,19 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffectFire;
public class TESpellEffectBlock extends TESpellBlock
{
@Override
protected void applySpellChange(SpellParadigm parad)
{
parad.addBufferedEffect(this.getSpellEffect());
}
public SpellEffect getSpellEffect()
{
return new SpellEffectFire();
}
}

View file

@ -0,0 +1,56 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancementCost;
public class TESpellEnhancementBlock extends TESpellBlock
{
@Override
protected void applySpellChange(SpellParadigm parad)
{
int i = -1;
switch(this.enhancementType())
{
case 0:
i = parad.getBufferedEffectPower();
break;
case 1:
i = parad.getBufferedEffectCost();
break;
case 2:
i = parad.getBufferedEffectPotency();
break;
}
if(i!=-1 && i<this.getLimit())
{
parad.applyEnhancement(getSpellEnhancement());
}
else if(i<this.getLimit())
{
this.doBadStuff();
}
}
public SpellEnhancement getSpellEnhancement()
{
return new SpellEnhancementCost();
}
public int getLimit()
{
return 5;
}
public int enhancementType() //0 is power, 1 is cost, 2 is potency
{
return 0;
}
public void doBadStuff()
{
}
}

View file

@ -0,0 +1,19 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellModifier;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellModifierDefault;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
public class TESpellModifierBlock extends TESpellBlock
{
@Override
protected void applySpellChange(SpellParadigm parad)
{
parad.modifyBufferedEffect(this.getSpellModifier());
}
public SpellModifier getSpellModifier()
{
return new SpellModifierDefault();
}
}

View file

@ -0,0 +1,33 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmSelf;
public class TESpellParadigmBlock extends TESpellBlock
{
public SpellParadigm getSpellParadigm()
{
return new SpellParadigmSelf();
}
@Override
protected void applySpellChange(SpellParadigm parad)
{
return;
}
public boolean canInputRecieve()
{
return false;
}
public void castSpell(World world, EntityPlayer entity, ItemStack spellCasterStack)
{
SpellParadigm parad = this.getSpellParadigm();
this.modifySpellParadigm(parad);
parad.castSpell(world, entity, spellCasterStack);
}
}