mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-27 23:33:00 +00:00
Fix #854 OpenGL transparency issues
This commit is contained in:
1 parent
8743f29613
commit
3253077466
8 files changed
+22
-29
No files matched your search
@@ -49,6 +49,11 @@ public class RenderLeavesItem implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
renderItem((RenderBlocks) data[0], item, 0f, 0f, 0f);
|
||||
@@ -62,6 +67,8 @@ public class RenderLeavesItem implements IItemRenderer {
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
private static void renderItem(RenderBlocks renderer, ItemStack itemStack, float x, float y, float z) {
|
||||
@@ -79,8 +86,6 @@ public class RenderLeavesItem implements IItemRenderer {
|
||||
leaves.setTree(TreeHelper.treeTemplates.get(0));
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
IIcon leavesIcon = leaves.getIcon(Proxies.render.fancyGraphicsEnabled());
|
||||
if (leavesIcon == null) {
|
||||
return;
|
||||
|
||||
@@ -70,8 +70,6 @@ public class RenderLogItem implements IItemRenderer {
|
||||
|
||||
EnumWoodType woodType = EnumWoodType.getFromCompound(itemStack.getTagCompound());
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
IIcon barkIcon = IconProviderWood.getBarkIcon(woodType);
|
||||
IIcon heartIcon = IconProviderWood.getHeartIcon(woodType);
|
||||
if (barkIcon == null || heartIcon == null) {
|
||||
|
||||
@@ -70,8 +70,6 @@ public class RenderPlankItem implements IItemRenderer {
|
||||
|
||||
EnumWoodType woodType = EnumWoodType.getFromCompound(itemStack.getTagCompound());
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
IIcon plankIcon = IconProviderWood.getPlankIcon(woodType);
|
||||
if (plankIcon == null) {
|
||||
return;
|
||||
|
||||
@@ -60,8 +60,6 @@ public class RenderSlabItem implements IItemRenderer {
|
||||
|
||||
EnumWoodType woodType = EnumWoodType.getFromCompound(itemStack.getTagCompound());
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
IIcon plankIcon = IconProviderWood.getPlankIcon(woodType);
|
||||
if (plankIcon == null) {
|
||||
return;
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.arboriculture.items.ItemBlockWood;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class RenderStairItem implements IItemRenderer {
|
||||
@@ -60,12 +61,16 @@ public class RenderStairItem implements IItemRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
private static void renderStairBlock(RenderBlocks renderBlocks, ItemStack item, float x, float y, float z) {
|
||||
private static void renderStairBlock(RenderBlocks renderBlocks, ItemStack itemStack, float x, float y, float z) {
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
Block block = ItemStackUtil.getBlock(item);
|
||||
Block block = ItemStackUtil.getBlock(itemStack);
|
||||
|
||||
EnumWoodType woodType = EnumWoodType.getFromCompound(item.getTagCompound());
|
||||
if (!(itemStack.getItem() instanceof ItemBlockWood) || block == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
EnumWoodType woodType = EnumWoodType.getFromCompound(itemStack.getTagCompound());
|
||||
IIcon texture = IconProviderWood.getPlankIcon(woodType);
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
@@ -104,7 +109,6 @@ public class RenderStairItem implements IItemRenderer {
|
||||
tessellator.draw();
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -113,7 +113,6 @@ public class PositionedFluidTank {
|
||||
GuiDraw.changeTexture(TextureMap.locationBlocksTexture);
|
||||
int color = this.tank.getFluid().getFluid().getColor(this.tank.getFluid());
|
||||
GL11.glColor3ub((byte) (color >> 16 & 0xFF), (byte) (color >> 8 & 0xFF), (byte) (color & 0xFF));
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
int amount = Math.max(Math.min(this.position.height, this.tank.getFluid().amount * this.position.height / this.tank.getCapacity()), 1);
|
||||
int posY = this.position.y + this.position.height - amount;
|
||||
@@ -141,8 +140,6 @@ public class PositionedFluidTank {
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
if (this.overlayTexture != null && this.overlayTexturePos != null) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GuiDraw.changeTexture(this.overlayTexture);
|
||||
|
||||
@@ -24,11 +24,6 @@ import forestry.farming.blocks.BlockFarm;
|
||||
public class RenderFarmItem implements IItemRenderer {
|
||||
|
||||
private static void renderFarmBlock(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) {
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
BlockFarm block = (BlockFarm) ItemStackUtil.getBlock(item);
|
||||
if (block == null) {
|
||||
@@ -81,8 +76,6 @@ public class RenderFarmItem implements IItemRenderer {
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
|
||||
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,6 +98,11 @@ public class RenderFarmItem implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
renderFarmBlock((RenderBlocks) data[0], item, -0.5f, -0.5f, -0.5f);
|
||||
@@ -118,6 +116,8 @@ public class RenderFarmItem implements IItemRenderer {
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -48,9 +48,6 @@ public class GuiMailboxInfo extends Gui {
|
||||
return;
|
||||
}
|
||||
|
||||
GL11.glEnable(3042);
|
||||
GL11.glEnable(32826);
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Proxies.common.bindTexture(textureAlert);
|
||||
|
||||
@@ -58,10 +55,6 @@ public class GuiMailboxInfo extends Gui {
|
||||
|
||||
fontRendererObj.drawString(Integer.toString(poInfo.playerLetters), x + 27 + getCenteredOffset(Integer.toString(poInfo.playerLetters), 22), y + 5, 0xffffff);
|
||||
fontRendererObj.drawString(Integer.toString(poInfo.tradeLetters), x + 75 + getCenteredOffset(Integer.toString(poInfo.tradeLetters), 22), y + 5, 0xffffff);
|
||||
|
||||
GL11.glDisable(32826);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
}
|
||||
|
||||
protected int getCenteredOffset(String string, int xWidth) {
|
||||
|
||||
Reference in new issue
Block a user