This commit is contained in:
Calclavia 2013-08-02 23:36:10 -04:00
commit a575d4476b
3 changed files with 47 additions and 1 deletions

View file

@ -2,8 +2,10 @@ package resonantinduction.contractor;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.ResonantInduction;
import resonantinduction.base.BlockBase;
import resonantinduction.render.BlockRenderingHandler;
@ -25,6 +27,22 @@ public class BlockEMContractor extends BlockBase implements ITileEntityProvider
return BlockRenderingHandler.INSTANCE.getRenderId();
}
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
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());
return true;
}
return true;
}
@Override
public TileEntity createNewTileEntity(World world)
{

View file

@ -1,8 +1,9 @@
package resonantinduction.contractor;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
public class TileEntityEMContractor extends TileEntity
{
public ForgeDirection facing = ForgeDirection.UP;
}

View file

@ -7,6 +7,7 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import resonantinduction.ResonantInduction;
import resonantinduction.contractor.TileEntityEMContractor;
import resonantinduction.model.ModelEMContractor;
public class RenderEMContractor extends TileEntitySpecialRenderer
@ -21,6 +22,32 @@ public class RenderEMContractor extends TileEntitySpecialRenderer
GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
switch(((TileEntityEMContractor)t).facing)
{
case UP:
break;
case DOWN:
GL11.glRotatef(180, 0, 0, 1);
GL11.glTranslatef(0, -2, 0);
break;
case NORTH:
GL11.glTranslatef(-1, 1, 0);
GL11.glRotatef(-90, 0, 0, 1);
break;
case SOUTH:
GL11.glTranslatef(1, 1, 0);
GL11.glRotatef(90, 0, 0, 1);
break;
case WEST:
GL11.glTranslatef(0, 1, 1);
GL11.glRotatef(-90, 1, 0, 0);
break;
case EAST:
GL11.glTranslatef(0, 1, -1);
GL11.glRotatef(90, 1, 0, 0);
break;
}
this.func_110628_a(TEXTURE);
MODEL.render(0.0625f);