Started working on engineering table matrix rotation
This commit is contained in:
parent
7da8ac4289
commit
24079ee908
3 changed files with 19 additions and 7 deletions
|
@ -11,7 +11,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import resonantinduction.core.prefab.block.BlockRI;
|
||||
import resonantinduction.core.prefab.block.BlockRIRotatable;
|
||||
import universalelectricity.api.vector.Vector2;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.utility.inventory.InventoryUtility;
|
||||
|
@ -26,7 +26,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
*
|
||||
* @author Calclavia
|
||||
*/
|
||||
public class BlockEngineeringTable extends BlockRI
|
||||
public class BlockEngineeringTable extends BlockRIRotatable
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
private Icon iconTop;
|
||||
|
@ -202,18 +202,18 @@ public class BlockEngineeringTable extends BlockRI
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIcon(int par1, int par2)
|
||||
public Icon getIcon(int side, int meta)
|
||||
{
|
||||
return par1 == 1 ? this.iconTop : (par1 == 0 ? this.blockIcon : (par1 != 2 && par1 != 4 ? this.blockIcon : this.iconFront));
|
||||
return side == 1 ? this.iconTop : (side == meta ? this.iconFront : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
{
|
||||
this.blockIcon = par1IconRegister.registerIcon(this.getTextureName() + "_side");
|
||||
this.iconTop = par1IconRegister.registerIcon(this.getTextureName() + "_top");
|
||||
this.iconFront = par1IconRegister.registerIcon(this.getTextureName() + "_front");
|
||||
this.blockIcon = par1IconRegister.registerIcon(this.getTextureName() + "_side");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
package resonantinduction.archaic.engineering;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import calclavia.lib.render.RenderUtility;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.core.render.RenderItemOverlayTile;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
@ -17,8 +21,8 @@ public class RenderEngineeringTable extends RenderItemOverlayTile
|
|||
if (tileEntity instanceof TileEngineeringTable)
|
||||
{
|
||||
TileEngineeringTable tile = (TileEngineeringTable) tileEntity;
|
||||
renderTopOverlay(tileEntity, tile.craftingMatrix, x, y, z);
|
||||
renderItemOnSides(tileEntity, tile.getStackInSlot(9), x, y, z);
|
||||
renderTopOverlay(tileEntity, tile.craftingMatrix, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,12 @@ public abstract class RenderItemOverlayTile extends TileEntitySpecialRenderer
|
|||
|
||||
public void renderTopOverlay(TileEntity tileEntity, ItemStack[] inventory, int matrixX, int matrixZ, double x, double y, double z)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslated(x + 0.5f, y + 0.5f, z + 0.5f);
|
||||
RenderUtility.rotateBlockBasedOnDirection(ForgeDirection.getOrientation(tileEntity.getBlockMetadata()));
|
||||
GL11.glTranslated(-0.5f, -0.5f, -0.5f);
|
||||
|
||||
/**
|
||||
* Render the Crafting Matrix
|
||||
*/
|
||||
|
@ -52,7 +58,7 @@ public abstract class RenderItemOverlayTile extends TileEntitySpecialRenderer
|
|||
{
|
||||
if (inventory[i] != null)
|
||||
{
|
||||
Vector3 translation = new Vector3(x + (double) (i / matrixX) / ((double) matrixX) + (0.5 / (matrixX)), y + 1.1, z + (double) (i % matrixZ) / ((double) matrixZ) + (0.5 / (matrixZ)));
|
||||
Vector3 translation = new Vector3((double) (i / matrixX) / ((double) matrixX) + (0.5 / (matrixX)), 1.1, (double) (i % matrixZ) / ((double) matrixZ) + (0.5 / (matrixZ)));
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(translation.x, translation.y, translation.z);
|
||||
GL11.glScalef(0.7f, 0.7f, 0.7f);
|
||||
|
@ -64,6 +70,8 @@ public abstract class RenderItemOverlayTile extends TileEntitySpecialRenderer
|
|||
RenderUtility.renderFloatingText("" + inventory[i].stackSize, (float) translation.x, (float) translation.y - 2f, (float) translation.z);
|
||||
}
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
public void renderItemOnSides(TileEntity tile, ItemStack itemStack, double x, double y, double z)
|
||||
|
|
Loading…
Reference in a new issue