Skip to content

Commit

Permalink
Fix StellarObject
Browse files Browse the repository at this point in the history
  • Loading branch information
FirstMegaGame4 committed Feb 9, 2025
1 parent 4b9a7aa commit 9d179d2
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
import com.mmodding.mmodding_lib.library.stellar.StellarStatus;
import com.mmodding.mmodding_lib.library.utils.MModdingGlobalMaps;
import com.mmodding.mmodding_lib.library.utils.TextureLocation;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.*;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Matrix4f;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3f;
import org.quiltmc.loader.api.minecraft.ClientOnly;

Expand Down Expand Up @@ -48,16 +49,14 @@ public void render(MatrixStack matrices, ClientWorld world, float tickDelta) {

RenderSystem.depthMask(false);
VertexBuffer.unbind();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.enableTexture();
RenderSystem.blendFuncSeparate(
GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO
);

matrices.push();
Vec3d vec3d = world.getSkyColor(MinecraftClient.getInstance().gameRenderer.getCamera().getPos(), tickDelta);
float light = (float) (vec3d.x + vec3d.y + vec3d.z) / 3.0f;

RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f - world.getRainGradient(tickDelta));
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f - light - world.getRainGradient(tickDelta));

matrices.push();

matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(this.getCycle().getBaseZAngle()));
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(this.getCycle().getBaseXAngle()));
Expand All @@ -82,7 +81,6 @@ public void render(MatrixStack matrices, ClientWorld world, float tickDelta) {
matrices.pop();

RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
RenderSystem.disableBlend();
RenderSystem.depthMask(true);
}
}

0 comments on commit 9d179d2

Please sign in to comment.