use of net.minecraft.client.renderer.entity.RenderItem in project BluePower by Qmunity.
the class TubeStack method render.
@SideOnly(Side.CLIENT)
public void render(float partialTick) {
if (renderMode == RenderMode.AUTO) {
renderMode = Minecraft.getMinecraft().gameSettings.fancyGraphics ? RenderMode.NORMAL : RenderMode.REDUCED;
}
final RenderMode finalRenderMode = renderMode;
if (customRenderItem == null) {
customRenderItem = new RenderItem() {
@Override
public boolean shouldBob() {
return false;
}
;
@Override
public byte getMiniBlockCount(ItemStack stack, byte original) {
return finalRenderMode == RenderMode.REDUCED ? (byte) 1 : original;
}
};
customRenderItem.setRenderManager(RenderManager.instance);
renderedItem = new EntityItem(FMLClientHandler.instance().getWorldClient());
renderedItem.hoverStart = 0.0F;
}
renderedItem.setEntityItemStack(stack);
double renderProgress = (oldProgress + (progress - oldProgress) * partialTick) * 2 - 1;
GL11.glPushMatrix();
GL11.glTranslated(heading.offsetX * renderProgress * 0.5, heading.offsetY * renderProgress * 0.5, heading.offsetZ * renderProgress * 0.5);
if (finalRenderMode != RenderMode.NONE) {
GL11.glPushMatrix();
if (stack.stackSize > 5) {
GL11.glScaled(0.8, 0.8, 0.8);
}
if (!(stack.getItem() instanceof ItemBlock)) {
GL11.glScaled(0.8, 0.8, 0.8);
GL11.glTranslated(0, -0.15, 0);
}
customRenderItem.doRender(renderedItem, 0, 0, 0, 0, 0);
GL11.glPopMatrix();
} else {
float size = 0.02F;
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glBegin(GL11.GL_QUADS);
RenderHelper.drawColoredCube(new Vec3dCube(-size, -size, -size, size, size, size), 1, 1, 1, 1);
GL11.glEnd();
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
if (color != TubeColor.NONE) {
float size = 0.2F;
int colorInt = ItemDye.field_150922_c[color.ordinal()];
float red = (colorInt >> 16) / 256F;
float green = (colorInt >> 8 & 255) / 256F;
float blue = (colorInt & 255) / 256F;
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glColor3f(red, green, blue);
Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(Refs.MODID, "textures/blocks/tubes/inside_color_border.png"));
RenderHelper.drawTesselatedTexturedCube(new Vec3dCube(-size, -size, -size, size, size, size));
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_LIGHTING);
}
GL11.glPopMatrix();
}
use of net.minecraft.client.renderer.entity.RenderItem in project Engine by VoltzEngine-Project.
the class RenderItemOverlayUtility method renderItem.
public static void renderItem(World world, ForgeDirection dir, ItemStack itemStack, Pos position, float rotationYaw, int angle) {
if (itemStack != null) {
EntityItem entityItem = new EntityItem(world, 0.0D, 0.0D, 0.0D, itemStack.copy());
entityItem.getEntityItem().stackSize = 1;
entityItem.hoverStart = 0.0F;
GL11.glPushMatrix();
GL11.glTranslated(position.x(), position.y(), position.z());
GL11.glRotatef(180.0F + rotationYaw, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(90 * angle, 1, 0, 0);
RenderItem renderItem = ((RenderItem) RenderManager.instance.getEntityClassRenderObject(EntityItem.class));
boolean fancyGraphics = RenderManager.instance.options.fancyGraphics;
RenderManager.instance.options.fancyGraphics = true;
renderItem.doRender(entityItem, 0, 0, 0, 0, 0);
RenderManager.instance.options.fancyGraphics = fancyGraphics;
GL11.glPopMatrix();
}
}
Aggregations