2014-01-24 23:07:13 +00:00
|
|
|
package WayofTime.alchemicalWizardry.common.block;
|
|
|
|
|
2014-02-02 13:48:11 +00:00
|
|
|
import java.util.Arrays;
|
2014-01-24 23:07:13 +00:00
|
|
|
import java.util.List;
|
|
|
|
|
2014-02-02 13:48:11 +00:00
|
|
|
import net.minecraft.client.Minecraft;
|
2014-01-24 23:07:13 +00:00
|
|
|
import net.minecraft.client.renderer.texture.IconRegister;
|
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
2014-02-02 13:48:11 +00:00
|
|
|
import net.minecraft.entity.Entity;
|
2014-01-24 23:07:13 +00:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2014-02-02 13:48:11 +00:00
|
|
|
import net.minecraft.entity.player.EntityPlayerMP;
|
2014-01-24 23:07:13 +00:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2014-02-02 13:48:11 +00:00
|
|
|
import net.minecraft.util.AxisAlignedBB;
|
2014-01-24 23:07:13 +00:00
|
|
|
import net.minecraft.util.Icon;
|
2014-02-02 13:48:11 +00:00
|
|
|
import net.minecraft.util.MovingObjectPosition;
|
|
|
|
import net.minecraft.util.Vec3;
|
|
|
|
import net.minecraft.world.IBlockAccess;
|
2014-01-24 23:07:13 +00:00
|
|
|
import net.minecraft.world.World;
|
2014-02-02 13:48:11 +00:00
|
|
|
import net.minecraftforge.common.ForgeDirection;
|
2014-01-24 23:07:13 +00:00
|
|
|
import WayofTime.alchemicalWizardry.ModBlocks;
|
|
|
|
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
|
|
|
|
{
|
2014-02-02 13:48:11 +00:00
|
|
|
public static final float minPos = (3f/16f);
|
|
|
|
public static final float maxPos = (13f/16f);
|
|
|
|
|
2014-01-24 23:07:13 +00:00
|
|
|
Icon[] projectileIcons = new Icon[7];
|
|
|
|
|
|
|
|
public BlockSpellParadigm(int id)
|
|
|
|
{
|
|
|
|
super(id);
|
|
|
|
setUnlocalizedName("blockSpellParadigm");
|
2014-02-02 13:48:11 +00:00
|
|
|
//setBlockBounds(minPos, minPos, minPos, maxPos, maxPos, maxPos);
|
2014-01-24 23:07:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@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);
|
|
|
|
}
|
2014-02-02 13:48:11 +00:00
|
|
|
|
|
|
|
// @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);
|
|
|
|
}
|
|
|
|
*/
|
2014-01-24 23:07:13 +00:00
|
|
|
}
|