mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-21 04:32:23 +00:00
Fixed a bunch of stuff in the mod not rendering properly if something disables the OpenGL Lighting capability (See: NEI, Neat). Also using glPushAttrib now
This commit is contained in:
1 parent
351d78bbc9
commit
8b40d7420c
7 files changed
+23
-21
No files matched your search
@@ -39,8 +39,10 @@ public final class BoundTileRenderer {
|
||||
@SubscribeEvent
|
||||
public void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
Tessellator.renderingWorldRenderer = false;
|
||||
@@ -85,6 +87,7 @@ public final class BoundTileRenderer {
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,11 @@ public final class MultiblockRenderHandler {
|
||||
int anchorY = anchor != null ? anchor.posY : src.blockY;
|
||||
int anchorZ = anchor != null ? anchor.posZ : src.blockZ;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
rendering = true;
|
||||
Multiblock mb = anchor != null ? currentMultiblock.getForIndex(angle) : currentMultiblock.getForEntity(player);
|
||||
boolean didAny = false;
|
||||
@@ -93,7 +98,9 @@ public final class MultiblockRenderHandler {
|
||||
if(renderComponentInWorld(player.worldObj, mb, comp, anchorX, anchorY, anchorZ))
|
||||
didAny = true;
|
||||
rendering = false;
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
if(!didAny) {
|
||||
setMultiblock(null);
|
||||
player.addChatComponentMessage(new ChatComponentTranslation("botaniamisc.structureComplete").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN)));
|
||||
|
||||
@@ -35,11 +35,10 @@ public final class RedStringRenderer {
|
||||
public static void renderAll() {
|
||||
if(!redStringTiles.isEmpty()) {
|
||||
GL11.glPushMatrix();
|
||||
boolean lighting = GL11.glGetBoolean(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
if(lighting)
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1F, 0F, 0F, sizeAlpha);
|
||||
|
||||
@@ -48,10 +47,9 @@ public final class RedStringRenderer {
|
||||
while((tile = redStringTiles.poll()) != null)
|
||||
renderTile(tile);
|
||||
|
||||
if(lighting)
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
@@ -66,10 +66,9 @@ public final class SubTileRadiusRenderHandler {
|
||||
if(descriptor == null)
|
||||
return;
|
||||
|
||||
boolean light = GL11.glGetBoolean(GL11.GL_LIGHTING);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
@@ -79,10 +78,9 @@ public final class SubTileRadiusRenderHandler {
|
||||
renderCircle(descriptor.getSubtileCoords(), descriptor.getCircleRadius());
|
||||
else renderRectangle(descriptor.getAABB());
|
||||
|
||||
if(light)
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
@@ -186,16 +186,15 @@ public final class TooltipAdditionDisplayHandler {
|
||||
Gui.drawRect(mouseX + offx + rainbowWidth, mouseY - offy - height, mouseX + offx + width, mouseY - offy, 0xFF555555);
|
||||
|
||||
String rank = StatCollector.translateToLocal("botania.rank" + level).replaceAll("&", "\u00a7");
|
||||
boolean light = GL11.glGetBoolean(GL11.GL_LIGHTING);
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
font.drawStringWithShadow(rank, mouseX + offx, mouseY - offy - 12, 0xFFFFFF);
|
||||
if(!ss) {
|
||||
rank = StatCollector.translateToLocal("botania.rank" + (level + 1)).replaceAll("&", "\u00a7");
|
||||
font.drawStringWithShadow(rank, mouseX + offx + width - font.getStringWidth(rank), mouseY - offy - 12, 0xFFFFFF);
|
||||
}
|
||||
if(light)
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
private static void drawManaBar(ItemStack stack, IManaTooltipDisplay display, int mouseX, int mouseY, int offx, int offy, int width, int height) {
|
||||
|
||||
@@ -30,15 +30,14 @@ public final class ParticleRenderDispatcher {
|
||||
public static void dispatch() {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
boolean isLightingEnabled = GL11.glGetBoolean(GL11.GL_LIGHTING);
|
||||
Profiler profiler = Minecraft.getMinecraft().mcProfiler;
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
|
||||
if(isLightingEnabled)
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
profiler.startSection("sparkle");
|
||||
FXSparkle.dispatchQueuedRenders(tessellator);
|
||||
@@ -46,11 +45,10 @@ public final class ParticleRenderDispatcher {
|
||||
FXWisp.dispatchQueuedRenders(tessellator);
|
||||
profiler.endSection();
|
||||
|
||||
if(isLightingEnabled)
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public class ModelHourglass extends ModelBase {
|
||||
base2.render(f);
|
||||
Color c = new Color(color);
|
||||
GL11.glColor3ub((byte) c.getRed(), (byte) c.getGreen(), (byte) c.getBlue());
|
||||
boolean normalize = GL11.glGetBoolean(GL11.GL_NORMALIZE);
|
||||
GL11.glPushAttrib(GL11.GL_NORMALIZE);
|
||||
GL11.glEnable(GL11.GL_NORMALIZE);
|
||||
|
||||
if(fract1 > 0) {
|
||||
@@ -97,8 +97,7 @@ public class ModelHourglass extends ModelBase {
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if(!normalize)
|
||||
GL11.glDisable(GL11.GL_NORMALIZE);
|
||||
GL11.glPopAttrib();
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
glass1.render(f);
|
||||
glass2.render(f);
|
||||
|
||||
Reference in new issue
Block a user