-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix chest flickering when a barrel is in sight (#33)
* fix chest flickering * refactor which should not change anything
- Loading branch information
1 parent
6435914
commit ea798c4
Showing
2 changed files
with
32 additions
and
3 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
src/main/java/mcp/mobius/betterbarrels/client/render/SurfaceItemRenderHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package mcp.mobius.betterbarrels.client.render; | ||
|
||
import java.nio.FloatBuffer; | ||
|
||
import net.minecraft.client.renderer.GLAllocation; | ||
|
||
import org.lwjgl.opengl.GL11; | ||
|
||
/** | ||
* RenderHelper but no directional light setting | ||
*/ | ||
public class SurfaceItemRenderHelper { | ||
|
||
private static final FloatBuffer ambientColorBuffer = (FloatBuffer) GLAllocation.createDirectFloatBuffer(16) | ||
.put(0.4f).put(0.4f).put(0.4f).put(1.0f).flip(); | ||
private static final FloatBuffer cachedAmbientColor = GLAllocation.createDirectFloatBuffer(16); | ||
|
||
public static void disableStandardItemLighting() { | ||
GL11.glDisable(GL11.GL_COLOR_MATERIAL); | ||
GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, cachedAmbientColor); | ||
} | ||
|
||
public static void enableStandardItemLighting() { | ||
GL11.glEnable(GL11.GL_COLOR_MATERIAL); | ||
GL11.glColorMaterial(GL11.GL_FRONT_AND_BACK, GL11.GL_AMBIENT_AND_DIFFUSE); | ||
GL11.glShadeModel(GL11.GL_FLAT); | ||
GL11.glGetFloat(GL11.GL_LIGHT_MODEL_AMBIENT, cachedAmbientColor); | ||
GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, ambientColorBuffer); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters