Spell Work

Need to work on how the EntitySpellProjectile saves its data. Does not
work properly. Perhaps it was not registered?
This commit is contained in:
WayofTime 2014-01-25 09:22:59 -05:00
parent 5dcef131dc
commit 112b4e6b53
15 changed files with 314 additions and 92 deletions

View file

@ -14,7 +14,7 @@ import WayofTime.alchemicalWizardry.common.tileEntity.TEOrientable;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockConduit extends BlockContainer
public class BlockConduit extends BlockOrientable
{
@SideOnly(Side.CLIENT)
private static Icon topIcon;
@ -27,7 +27,7 @@ public class BlockConduit extends BlockContainer
public BlockConduit(int id)
{
super(id, Material.rock);
super(id);
setHardness(2.0F);
setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
@ -66,44 +66,6 @@ public class BlockConduit extends BlockContainer
}
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
{
if (world.isRemote)
{
return false;
}
ForgeDirection sideClicked = ForgeDirection.getOrientation(side);
TileEntity tile = world.getBlockTileEntity(x, y, z);
if (tile instanceof TEOrientable)
{
//TODO NEEDS WORK
if (((TEOrientable) tile).getInputDirection().equals(sideClicked))
{
((TEOrientable) tile).setInputDirection(((TEConduit) tile).getOutputDirection());
((TEOrientable) tile).setOutputDirection(sideClicked);
} else if (((TEOrientable) tile).getOutputDirection().equals(sideClicked))
{
((TEOrientable) tile).setOutputDirection(((TEConduit) tile).getInputDirection());
((TEOrientable) tile).setInputDirection(sideClicked);
} else
{
if (!player.isSneaking())
{
((TEOrientable) tile).setOutputDirection(sideClicked);
} else
{
((TEOrientable) tile).setOutputDirection(sideClicked.getOpposite());
}
}
}
world.markBlockForUpdate(x, y, z);
return true;
}
@Override
public void breakBlock(World world, int x, int y, int z, int par5, int par6)
{

View file

@ -105,6 +105,7 @@ public class BlockOrientable extends BlockContainer
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are)
{
//Right-click orients the output face. Shift-right-click orients the input face.
if (world.isRemote)
{
return false;
@ -115,25 +116,44 @@ public class BlockOrientable extends BlockContainer
if (tile instanceof TEOrientable)
{
//TODO NEEDS WORK
if (((TEOrientable) tile).getInputDirection().equals(sideClicked))
{
((TEOrientable) tile).setInputDirection(((TEOrientable) tile).getOutputDirection());
((TEOrientable) tile).setOutputDirection(sideClicked);
} else if (((TEOrientable) tile).getOutputDirection().equals(sideClicked))
{
((TEOrientable) tile).setOutputDirection(((TEOrientable) tile).getInputDirection());
((TEOrientable) tile).setInputDirection(sideClicked);
} else
{
if (!player.isSneaking())
{
((TEOrientable) tile).setOutputDirection(sideClicked);
} else
{
((TEOrientable) tile).setOutputDirection(sideClicked.getOpposite());
}
}
TEOrientable newTile = (TEOrientable)tile;
if(player.isSneaking())
{
int nextSide = TEOrientable.getIntForForgeDirection(newTile.getInputDirection())+1;
if(nextSide>5)
{
nextSide = 0;
}
if(ForgeDirection.getOrientation(nextSide)==newTile.getOutputDirection())
{
nextSide++;
if(nextSide>5)
{
nextSide = 0;
}
}
newTile.setInputDirection(ForgeDirection.getOrientation(nextSide));
}else
{
int nextSide = TEOrientable.getIntForForgeDirection(newTile.getOutputDirection())+1;
if(nextSide>5)
{
nextSide = 0;
}
if(ForgeDirection.getOrientation(nextSide)==newTile.getInputDirection())
{
nextSide++;
if(nextSide>5)
{
nextSide = 0;
}
}
newTile.setOutputDirection(ForgeDirection.getOrientation(nextSide));
}
}
world.markBlockForUpdate(x, y, z);
@ -221,4 +241,10 @@ public class BlockOrientable extends BlockContainer
return 0;
}
@Override
public int damageDropped(int metadata)
{
return metadata;
}
}