HolesModule: Fixes render bugs, Updated version to 3.1.5

This commit is contained in:
noil 2021-01-07 16:47:34 -05:00
parent cd60dea84a
commit 59773448ce
3 changed files with 9 additions and 16 deletions

View File

@ -18,7 +18,7 @@ apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: "com.github.johnrengelman.shadow"
version = "3.1.4"
version = "3.1.5"
group = "me.rigamortis"
archivesBaseName = "seppuku"
def buildmode = "IDE"

View File

@ -452,12 +452,14 @@ public final class RenderUtil {
GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.disableTexture2D();
GlStateManager.disableDepth();
//GlStateManager.disableLighting();
GL11.glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
}
public static void end3D() {
GL11.glDisable(GL_LINE_SMOOTH);
//GlStateManager.enableLighting();
GlStateManager.enableDepth();
GlStateManager.enableTexture2D();
GlStateManager.enableBlend();

View File

@ -1,9 +1,11 @@
package me.rigamortis.seppuku.impl.module.render;
import me.rigamortis.seppuku.Seppuku;
import me.rigamortis.seppuku.api.event.player.EventPlayerUpdate;
import me.rigamortis.seppuku.api.event.render.EventRender3D;
import me.rigamortis.seppuku.api.module.Module;
import me.rigamortis.seppuku.api.util.MathUtil;
import me.rigamortis.seppuku.api.util.RenderUtil;
import me.rigamortis.seppuku.api.value.Value;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
@ -73,7 +75,10 @@ public final class HolesModule extends Module {
@Listener
public void onRender(EventRender3D event) {
final Minecraft mc = Minecraft.getMinecraft();
if (mc.getRenderViewEntity() == null)
return;
RenderUtil.begin3D();
for (Hole hole : this.holes) {
final AxisAlignedBB bb = new AxisAlignedBB(
hole.getX() - mc.getRenderManager().viewerPosX,
@ -92,29 +97,15 @@ public final class HolesModule extends Module {
bb.maxY + mc.getRenderManager().viewerPosY,
bb.maxZ + mc.getRenderManager().viewerPosZ))) {
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.disableDepth();
GlStateManager.tryBlendFuncSeparate(770, 771, 0, 1);
GlStateManager.disableTexture2D();
GlStateManager.depthMask(false);
glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glLineWidth(1.5f);
final double dist = mc.player.getDistance(hole.getX() + 0.5f, hole.getY() + 0.5f, hole.getZ() + 0.5f) * 0.75f;
float alpha = MathUtil.clamp((float) (dist * 255.0f / (this.radius.getValue()) / 255.0f), 0.0f, 0.3f);
RenderGlobal.renderFilledBox(bb, 0, 1, 0, this.fade.getValue() ? alpha : 0.25f);
RenderGlobal.drawBoundingBox(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ, 0, 1, 0, this.fade.getValue() ? alpha : 0.25f);
glDisable(GL_LINE_SMOOTH);
GlStateManager.depthMask(true);
GlStateManager.enableDepth();
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
}
}
RenderUtil.end3D();
}
private boolean isBlockValid(IBlockState blockState, BlockPos blockPos) {