use of net.minecraft.client.renderer.RenderItem in project SilentGems by SilentChaos512.
the class RenderThrownTomahawk method doRender.
@Override
public void doRender(EntityThrownTomahawk entity, double x, double y, double z, float entityYaw, float partialTicks) {
if (entity == null)
return;
ItemStack stack = entity.getThrownStack();
if (stack == null || stack.getItem() == null || StackHelper.isEmpty(stack))
return;
RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
EntityItem entityitem = new EntityItem(entity.world, entity.posX, entity.posY, entity.posZ, stack);
StackHelper.setCount(entityitem.getEntityItem(), 1);
entityitem.hoverStart = 0.0F;
GlStateManager.pushMatrix();
GlStateManager.disableLighting();
Vec3d vec = new Vec3d(0.0, 0.25, 0.0);
GlStateManager.translate(x, y, z);
GlStateManager.rotate(90 - entity.throwYaw, 0, 1, 0);
float rotation = entity.spin + (entity.inAir ? entity.SPIN_RATE * partialTicks : 0);
GlStateManager.rotate(rotation, 0, 0, 1);
GlStateManager.pushAttrib();
RenderHelper.enableStandardItemLighting();
itemRenderer.renderItem(entityitem.getEntityItem(), ItemCameraTransforms.TransformType.FIXED);
RenderHelper.disableStandardItemLighting();
GlStateManager.popAttrib();
GlStateManager.enableLighting();
GlStateManager.popMatrix();
}
use of net.minecraft.client.renderer.RenderItem in project SilentGems by SilentChaos512.
the class RenderTileMaterialGrader method renderItem.
private void renderItem(World world, ItemStack stack, int rotationYaw) {
RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
if (StackHelper.isValid(stack)) {
// GlStateManager.translate(0.5, 0.5, 0.5);
EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, 0.0D, StackHelper.safeCopy(stack));
StackHelper.setCount(entityitem.getEntityItem(), 1);
entityitem.hoverStart = 0.0F;
GlStateManager.pushMatrix();
GlStateManager.disableLighting();
Vec3d vec = new Vec3d(0.0, 0.0, 0.0);
GlStateManager.translate(vec.xCoord, vec.yCoord, vec.zCoord);
GlStateManager.rotate(rotationYaw, 0.0F, 1.0F, 0);
GlStateManager.rotate(-90, 1.0F, 0.0F, 0);
float scale = 0.5f;
GlStateManager.scale(scale, scale, scale);
GlStateManager.pushAttrib();
RenderHelper.enableStandardItemLighting();
itemRenderer.renderItem(entityitem.getEntityItem(), ItemCameraTransforms.TransformType.FIXED);
RenderHelper.disableStandardItemLighting();
GlStateManager.popAttrib();
GlStateManager.enableLighting();
GlStateManager.popMatrix();
}
}
use of net.minecraft.client.renderer.RenderItem in project Wizardry by TeamWizardry.
the class RenderCodex method renderItemStack.
// Manually rendering itemstack overlays because mojang set all their states
// to disabled depth which doesn't work for us
public void renderItemStack(ItemStack stack) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
GlStateManager.enableRescaleNormal();
GlStateManager.pushMatrix();
RenderItem itemRender = Minecraft.getMinecraft().getRenderItem();
itemRender.renderItemAndEffectIntoGUI(stack, 0, 0);
GlStateManager.translate(0, 0, 150);
FontRenderer font = stack.getItem().getFontRenderer(stack);
if (font == null)
font = Minecraft.getMinecraft().fontRenderer;
if (font != null && stack.getCount() != 1) {
GlStateManager.translate(0, 0, 5);
GlStateManager.disableLighting();
GlStateManager.disableBlend();
font.drawStringWithShadow(stack.getCount() + "", 17F - font.getStringWidth(stack.getCount() + ""), 9F, 0xFFFFFF);
GlStateManager.enableDepth();
GlStateManager.enableBlend();
GlStateManager.translate(0, 0, -5);
}
if (stack.getItem().showDurabilityBar(stack)) {
GlStateManager.disableLighting();
GlStateManager.disableTexture2D();
GlStateManager.disableAlpha();
GlStateManager.disableBlend();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
double health = stack.getItem().getDurabilityForDisplay(stack);
int rgbfordisplay = stack.getItem().getRGBDurabilityForDisplay(stack);
int i = Math.round(13.0F - (float) health * 13.0F);
draw(bufferbuilder, 2, 13, 13, 2, 0, 0, 0, 255);
draw(bufferbuilder, 2, 13, i, 1, rgbfordisplay >> 16 & 255, rgbfordisplay >> 8 & 255, rgbfordisplay & 255, 255);
GlStateManager.enableBlend();
GlStateManager.enableAlpha();
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
}
EntityPlayerSP entityplayersp = Minecraft.getMinecraft().player;
float f3 = entityplayersp == null ? 0.0F : entityplayersp.getCooldownTracker().getCooldown(stack.getItem(), Minecraft.getMinecraft().getRenderPartialTicks());
if (f3 > 0.0F) {
GlStateManager.disableLighting();
GlStateManager.disableTexture2D();
Tessellator tessellator1 = Tessellator.getInstance();
BufferBuilder bufferbuilder1 = tessellator1.getBuffer();
this.draw(bufferbuilder1, 0, MathHelper.floor(16.0F * (1.0F - f3)), 16, MathHelper.ceil(16.0F * f3), 255, 255, 255, 127);
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
}
GlStateManager.popMatrix();
GlStateManager.enableLighting();
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
GlStateManager.disableRescaleNormal();
}
use of net.minecraft.client.renderer.RenderItem in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class ClientProxyCombat method registerItemModel.
private void registerItemModel(Item toRegister) {
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
renderItem.getItemModelMesher().register(toRegister, 0, new ModelResourceLocation(ValkyrienWarfareCombatMod.MODID + ":" + toRegister.getUnlocalizedName().substring(5), "inventory"));
;
}
use of net.minecraft.client.renderer.RenderItem in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class ClientProxyWorld method registerItemModel.
private void registerItemModel(Item toRegister) {
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
renderItem.getItemModelMesher().register(toRegister, 0, new ModelResourceLocation(ValkyrienWarfareWorldMod.MODID + ":" + toRegister.getUnlocalizedName().substring(5), "inventory"));
}
Aggregations