mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 01:27:27 +00:00
Fix Blocks not showing in Hanging Banners
This commit is contained in:
1 parent
6d0df76447
commit
ee8e876e79
1 file changed
+55
-7
@@ -3,10 +3,14 @@ package noppes.npcs.client.renderer.blocks;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.blocks.BlockWallBanner;
|
||||
import noppes.npcs.blocks.tiles.TileWallBanner;
|
||||
@@ -54,23 +58,67 @@ public class BlockWallBannerRenderer extends BlockRendererInterface{
|
||||
}
|
||||
public void doRender(double par2, double par4, double par6, int meta, ItemStack iicon)
|
||||
{
|
||||
if (iicon.getItemSpriteNumber() == 0 && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(iicon.getItem()).getRenderType()))
|
||||
return;
|
||||
GL11.glPushMatrix();
|
||||
bindTexture(TextureMap.locationItemsTexture);
|
||||
GL11.glTranslatef((float)par2 + 0.5f, (float)par4 +0.2f, (float)par6 + 0.5f);
|
||||
GL11.glTranslatef((float)par2 + 0.5f, (float)par4 +1.3f, (float)par6 + 0.5f);
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
GL11.glRotatef(90 * meta, 0, 1, 0);
|
||||
GL11.glTranslatef(0, 0, 0.26f);
|
||||
GL11.glRotatef(90 * meta, 0, 1, 0);
|
||||
GL11.glTranslatef(0, 0, -0.14f);
|
||||
GL11.glDepthMask(false);
|
||||
float f2 = 0.05f;
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
GL11.glScalef(f2, f2, f2);
|
||||
renderer.renderItemIntoGUI(this.func_147498_b(), mc.renderEngine, iicon, -8, -8);
|
||||
renderItemBanner(mc.renderEngine, iicon, -8, -8, false);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
public void renderItemBanner(TextureManager txtMng, ItemStack item, int p_77015_4_, int p_77015_5_, boolean renderEffect)
|
||||
{
|
||||
Object object = item.getIconIndex();
|
||||
int l;
|
||||
float f;
|
||||
float f3;
|
||||
float f4;
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
ResourceLocation resourcelocation = txtMng.getResourceLocation(item.getItemSpriteNumber());
|
||||
txtMng.bindTexture(resourcelocation);
|
||||
|
||||
if (object == null)
|
||||
{
|
||||
object = ((TextureMap)Minecraft.getMinecraft().getTextureManager().getTexture(resourcelocation)).getAtlasSprite("missingno");
|
||||
}
|
||||
|
||||
l = item.getItem().getColorFromItemStack(item, 0);
|
||||
f3 = (float)(l >> 16 & 255) / 255.0F;
|
||||
f4 = (float)(l >> 8 & 255) / 255.0F;
|
||||
f = (float)(l & 255) / 255.0F;
|
||||
|
||||
if (renderer.renderWithColor)
|
||||
{
|
||||
GL11.glColor4f(f3, f4, f, 1.0F);
|
||||
}
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING); //Forge: Make sure that render states are reset, a renderEffect can derp them up.
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
renderer.renderIcon(p_77015_4_, p_77015_5_, (IIcon)object, 16, 16);
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
if (renderEffect && item.hasEffect(0))
|
||||
{
|
||||
renderer.renderEffect(txtMng, p_77015_4_, p_77015_5_);
|
||||
}
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user