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

@ -71,7 +71,6 @@ public class BlockHomHeart extends BlockContainer
return false;
}
BlockGrass d;
ItemStack playerItem = player.getCurrentEquippedItem();
if (playerItem != null)

View file

@ -15,16 +15,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockOrientable extends BlockContainer
{
@SideOnly(Side.CLIENT)
private static Icon topIcon;
@SideOnly(Side.CLIENT)
private static Icon sideIcon1;
@SideOnly(Side.CLIENT)
private static Icon sideIcon2;
@SideOnly(Side.CLIENT)
private static Icon bottomIcon;
{
@SideOnly(Side.CLIENT)
private static Icon[] fireIcons;
@ -41,17 +32,12 @@ public class BlockOrientable extends BlockContainer
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
this.topIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
this.sideIcon1 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
this.sideIcon2 = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
this.bottomIcon = iconRegister.registerIcon("AlchemicalWizardry:BloodSocket");
{
this.fireIcons = this.registerIconsWithString(iconRegister, "fireEffectBlock");
}
@SideOnly(Side.CLIENT)
public Icon[] registerIconsWithString(IconRegister iconRegister, String blockString)
public static Icon[] registerIconsWithString(IconRegister iconRegister, String blockString)
{
Icon[] icons = new Icon[7];
@ -70,20 +56,11 @@ public class BlockOrientable extends BlockContainer
@SideOnly(Side.CLIENT)
public Icon getIcon(int side, int meta)
{
Icon[] icons = this.getIconsForMeta(meta);
switch (side)
{
case 0:
return bottomIcon;
case 1:
return topIcon;
//case 2: return sideIcon1;
//case 3: return sideIcon1;
//case 4: return sideIcon2;
//case 5: return sideIcon2;
default:
return sideIcon2;
case 4: return icons[1];
default: return icons[6];
}
}

View file

@ -1,12 +1,21 @@
package WayofTime.alchemicalWizardry.common.block;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock;
public class BlockSpellEffect extends BlockOrientable
{
public BlockSpellEffect(int id)
{
super(id);
setUnlocalizedName("blockSpellEffect");
}
@Override
public TileEntity createNewTileEntity(World world)
{
return new TESpellEffectBlock();
}
}

View file

@ -0,0 +1,45 @@
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.world.World;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEnhancementBlock;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellModifierBlock;
public class BlockSpellEnhancement extends BlockOrientable
{
public BlockSpellEnhancement(int id)
{
super(id);
setUnlocalizedName("blockSpellEnhancement");
}
@Override
public TileEntity createNewTileEntity(World world)
{
return new TESpellEnhancementBlock();
}
@SideOnly(Side.CLIENT)
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
if (this.blockID == ModBlocks.blockSpellEnhancement.blockID)
{
for(int i=0; i<15; i++)
{
par3List.add(new ItemStack(par1, 1, i));
}
} else
{
super.getSubBlocks(par1, par2CreativeTabs, par3List);
}
}
}

View file

@ -0,0 +1,44 @@
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.world.World;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock;
import WayofTime.alchemicalWizardry.common.tileEntity.TESpellModifierBlock;
public class BlockSpellModifier extends BlockOrientable
{
public BlockSpellModifier(int id)
{
super(id);
setUnlocalizedName("blockSpellModifier");
}
@Override
public TileEntity createNewTileEntity(World world)
{
return new TESpellModifierBlock();
}
@SideOnly(Side.CLIENT)
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
if (this.blockID == ModBlocks.blockSpellModifier.blockID)
{
for(int i=0; i<4; i++)
{
par3List.add(new ItemStack(par1, 1, i));
}
} else
{
super.getSubBlocks(par1, par2CreativeTabs, par3List);
}
}
}

View file

@ -0,0 +1,89 @@
package WayofTime.alchemicalWizardry.common.block;
import java.util.List;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
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;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockSpellParadigm extends BlockOrientable
{
Icon[] projectileIcons = new Icon[7];
public BlockSpellParadigm(int id)
{
super(id);
setUnlocalizedName("blockSpellParadigm");
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
{
this.projectileIcons = this.registerIconsWithString(iconRegister, "projectileParadigmBlock");
}
// @Override
// public Icon[] getIconsForMeta(int metadata)
// {
// return this.projectileIcons;
// }
@Override
public TileEntity createNewTileEntity(World world)
{
return new TESpellParadigmBlock();
}
@SideOnly(Side.CLIENT)
/**
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
*/
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
if (this.blockID == ModBlocks.blockSpellParadigm.blockID)
{
par3List.add(new ItemStack(par1, 1, 0));
par3List.add(new ItemStack(par1, 1, 1));
par3List.add(new ItemStack(par1, 1, 2));
} else
{
super.getSubBlocks(par1, par2CreativeTabs, par3List);
}
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
{
ItemStack stack = player.getCurrentEquippedItem();
if(stack != null && stack.getItem() instanceof ItemComplexSpellCrystal)
{
if (stack.stackTagCompound == null)
{
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound itemTag = stack.stackTagCompound;
itemTag.setInteger("xCoord", x);
itemTag.setInteger("yCoord", y);
itemTag.setInteger("zCoord", z);
itemTag.setInteger("dimensionId", world.provider.dimensionId);
return true;
}
return super.onBlockActivated(world, x, y, z, player, side, what, these, are);
}
}