diff --git a/src/resonantinduction/contractor/BlockEMContractor.java b/src/resonantinduction/contractor/BlockEMContractor.java index 99db93f4e..f216588f3 100644 --- a/src/resonantinduction/contractor/BlockEMContractor.java +++ b/src/resonantinduction/contractor/BlockEMContractor.java @@ -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; @@ -24,6 +26,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) diff --git a/src/resonantinduction/contractor/TileEntityEMContractor.java b/src/resonantinduction/contractor/TileEntityEMContractor.java index d6e610890..5ac6cfab0 100644 --- a/src/resonantinduction/contractor/TileEntityEMContractor.java +++ b/src/resonantinduction/contractor/TileEntityEMContractor.java @@ -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; } diff --git a/src/resonantinduction/render/RenderEMContractor.java b/src/resonantinduction/render/RenderEMContractor.java index 3b393958e..353805ef2 100644 --- a/src/resonantinduction/render/RenderEMContractor.java +++ b/src/resonantinduction/render/RenderEMContractor.java @@ -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 @@ -23,6 +24,27 @@ public class RenderEMContractor extends TileEntitySpecialRenderer this.func_110628_a(TEXTURE); MODEL.render(0.0625f); + + switch(((TileEntityEMContractor)t).facing) + { + case UP: + break; + case DOWN: + GL11.glRotatef(180, 0, 0, 1); + break; + case NORTH: + GL11.glRotatef(-90, 0, 0, 1); + break; + case SOUTH: + GL11.glRotatef(90, 0, 0, 1); + break; + case WEST: + GL11.glRotatef(-90, 1, 0, 0); + break; + case EAST: + GL11.glRotatef(90, 1, 0, 0); + break; + } GL11.glPopMatrix(); }