Fixed sky rendering

This commit is contained in:
paulevsGitch 2021-07-08 11:12:00 +03:00
parent c623da26ed
commit 93ca944472
2 changed files with 440 additions and 441 deletions

View file

@ -36,7 +36,7 @@ import ru.betterend.client.ClientOptions;
import java.util.Random;
@Mixin(LevelRenderer.class)
public class WorldRendererMixin {
public class LevelRendererMixin {
private static final ResourceLocation NEBULA_1 = BetterEnd.makeID("textures/sky/nebula_2.png");
private static final ResourceLocation NEBULA_2 = BetterEnd.makeID("textures/sky/nebula_3.png");
private static final ResourceLocation HORIZON = BetterEnd.makeID("textures/sky/nebula_1.png");
@ -95,6 +95,8 @@ public class WorldRendererMixin {
@Inject(method = "renderSky", at = @At("HEAD"), cancellable = true)
private void be_renderBetterEndSky(PoseStack matrices, Matrix4f matrix4f, float tickDelta, Runnable runnable, CallbackInfo info) {
if (ClientOptions.isCustomSky() && minecraft.level.effects().skyType() == DimensionSpecialEffects.SkyType.END) {
runnable.run();
time = (ticks % 360000) * 0.000017453292F;
time2 = time * 2;
time3 = time * 3;
@ -109,9 +111,6 @@ public class WorldRendererMixin {
RenderSystem.depthMask(false);
}
else {
//TODO: Removed in 1.17
//RenderSystem.enableAlphaTest();
//RenderSystem.alphaFunc(516, 0.0F);
RenderSystem.enableBlend();
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
}
@ -184,12 +183,12 @@ public class WorldRendererMixin {
private void be_renderBuffer(PoseStack matrices, Matrix4f matrix4f, VertexBuffer buffer, VertexFormat format, float r, float g, float b, float a) {
RenderSystem.setShaderColor(r, g, b, a);
buffer.bind();
format.setupBufferState();
buffer.drawWithShader(matrices.last().pose(), matrix4f, GameRenderer.getPositionTexShader());
VertexBuffer.unbind();
format.clearBufferState();
if (format == DefaultVertexFormat.POSITION) {
buffer.drawWithShader(matrices.last().pose(), matrix4f, GameRenderer.getPositionShader());
}
else {
buffer.drawWithShader(matrices.last().pose(), matrix4f, GameRenderer.getPositionTexShader());
}
}
private void be_initStars() {

View file

@ -11,7 +11,7 @@
"ClientRecipeBookMixin",
"MinecraftClientMixin",
"PlayerRendererMixin",
"WorldRendererMixin",
"LevelRendererMixin",
"MusicTrackerMixin",
"AnvilScreenMixin",
"BiomeColorsMixin",