Easy way to increment facing

This commit is contained in:
Aidan Brady 2013-08-02 23:36:56 -04:00
parent de2ac756c4
commit 19efceae92
2 changed files with 8 additions and 4 deletions

View file

@ -32,11 +32,9 @@ public class BlockEMContractor extends BlockBase implements ITileEntityProvider
{
if(par1World.isRemote)
{
//debug
TileEntityEMContractor contractor = (TileEntityEMContractor)par1World.getBlockTileEntity(par2, par3, par4);
int toSet = contractor.facing.ordinal() < 5 ? contractor.facing.ordinal()+1 : 0;
contractor.facing = ForgeDirection.getOrientation(toSet);
System.out.println(contractor.facing.ordinal());
contractor.incrementFacing();
return true;
}

View file

@ -6,4 +6,10 @@ import net.minecraftforge.common.ForgeDirection;
public class TileEntityEMContractor extends TileEntity
{
public ForgeDirection facing = ForgeDirection.UP;
public void incrementFacing()
{
int newOrdinal = facing.ordinal() < 5 ? facing.ordinal()+1 : 0;
facing = ForgeDirection.getOrientation(newOrdinal);
}
}