mirror of
https://github.com/JonasunderscoreJones/nicer-skies.git
synced 2025-10-23 11:49:17 +02:00
new: lil refactor
This commit is contained in:
parent
498d17818d
commit
d12988e914
11 changed files with 546 additions and 417 deletions
|
@ -1,7 +1,7 @@
|
|||
package codes.ztereohype.example.mixin;
|
||||
|
||||
import codes.ztereohype.example.sky.StarManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import codes.ztereohype.example.ExampleMod;
|
||||
import codes.ztereohype.example.star.SkyManager;
|
||||
import com.mojang.blaze3d.vertex.*;
|
||||
import com.mojang.math.Matrix4f;
|
||||
import net.minecraft.client.Camera;
|
||||
|
@ -27,16 +27,16 @@ public abstract class MixinStarRendering {
|
|||
|
||||
@Inject(at = @At("HEAD"), method = "createStars", cancellable = true)
|
||||
private void generateStars(CallbackInfo ci) {
|
||||
StarManager.generateSky();
|
||||
SkyManager.generateSky();
|
||||
starBuffer = new VertexBuffer();
|
||||
StarManager.updateStars(ticks, starBuffer);
|
||||
SkyManager.updateStars(ticks, starBuffer);
|
||||
ci.cancel();
|
||||
}
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "tick")
|
||||
private void tickStars(CallbackInfo ci) {
|
||||
if (this.level.getStarBrightness(0) < 0.0F) return;
|
||||
StarManager.updateStars(ticks, starBuffer);
|
||||
SkyManager.updateStars(ticks, starBuffer);
|
||||
}
|
||||
|
||||
@ModifyArg(
|
||||
|
@ -53,58 +53,7 @@ public abstract class MixinStarRendering {
|
|||
at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;disableTexture()V", ordinal = 2, shift = At.Shift.AFTER),
|
||||
locals = LocalCapture.CAPTURE_FAILHARD
|
||||
)
|
||||
private void drawNebulas(PoseStack poseStack, Matrix4f projectionMatrix, float partialTick, Camera camera, boolean bl, Runnable skyFogSetup, CallbackInfo ci, FogType fogType, Vec3 vec3, float f, float g, float h, BufferBuilder bufferBuilder, ShaderInstance shaderInstance, float[] fs, float i, Matrix4f matrix4f2, float k, int r, int s, int m, float t, float o, float p, float q) {
|
||||
Matrix4f matrix = matrix4f2;
|
||||
// matrix.multiply(projectionMatrix);
|
||||
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.setShaderTexture(0, StarManager.skyTexture.getId());
|
||||
|
||||
BufferBuilder leBufferBuilder = Tesselator.getInstance().getBuilder();
|
||||
leBufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX);
|
||||
|
||||
// +z face
|
||||
leBufferBuilder.vertex(matrix, -1F, -1F, 1F).uv(0.25f, 0.25f).endVertex();
|
||||
leBufferBuilder.vertex(matrix, -1F, 1F, 1F).uv(0.25f, 0.5f).endVertex();
|
||||
leBufferBuilder.vertex(matrix, 1F, 1F, 1F).uv(0.5f, 0.5f).endVertex();
|
||||
leBufferBuilder.vertex(matrix, 1F, -1F, 1F).uv(0.5f, 0.25f).endVertex();
|
||||
|
||||
// -z face
|
||||
leBufferBuilder.vertex(matrix, -1F, -1F, -1F).uv(0.75f, 0.25f).endVertex();
|
||||
leBufferBuilder.vertex(matrix, 1F, -1F, -1F).uv(1f, 0.25f).endVertex();
|
||||
leBufferBuilder.vertex(matrix, 1F, 1F, -1F).uv(1f, 0.5f).endVertex();
|
||||
leBufferBuilder.vertex(matrix, -1F, 1F, -1F).uv(0.75f, 0.5f).endVertex();
|
||||
|
||||
// bottom face
|
||||
leBufferBuilder.vertex(matrix, -1F, -1F, -1F).uv(0.5f, 0.5f).endVertex();
|
||||
leBufferBuilder.vertex(matrix, -1F, -1F, 1F).uv(0.5f, 0.75f).endVertex();
|
||||
leBufferBuilder.vertex(matrix, 1F, -1F, 1F).uv(0.75f, 0.75f).endVertex();
|
||||
leBufferBuilder.vertex(matrix, 1F, -1F, -1F).uv(0.75f, 0.5f).endVertex();
|
||||
|
||||
// leBufferBuilder.vertex(matrix, -1F, -1F, -1F).uv(0f, 0f).endVertex();
|
||||
// leBufferBuilder.vertex(matrix, -1F, -1F, 1F).uv(0f, 1f).endVertex();
|
||||
// leBufferBuilder.vertex(matrix, 1F, -1F, 1F).uv(1f, 1f).endVertex();
|
||||
// leBufferBuilder.vertex(matrix, 1F, -1F, -1F).uv(1f, 0f).endVertex();
|
||||
|
||||
// top face
|
||||
leBufferBuilder.vertex(matrix, -1F, 1F, -1F).uv(0.5f, 0f).endVertex();
|
||||
leBufferBuilder.vertex(matrix, 1F, 1F, -1F).uv(0.75f, 0f).endVertex();
|
||||
leBufferBuilder.vertex(matrix, 1F, 1F, 1F).uv(0.75f, 0.25f).endVertex();
|
||||
leBufferBuilder.vertex(matrix, -1F, 1F, 1F).uv(0.5f, 0.25f).endVertex();
|
||||
|
||||
// +x face
|
||||
leBufferBuilder.vertex(matrix, 1F, -1F, -1F).uv(0.5f, 0.25f).endVertex();
|
||||
leBufferBuilder.vertex(matrix, 1F, -1F, 1F).uv(0.75f, 0.25f).endVertex();
|
||||
leBufferBuilder.vertex(matrix, 1F, 1F, 1F).uv(0.75f, 0.5f).endVertex();
|
||||
leBufferBuilder.vertex(matrix, 1F, 1F, -1F).uv(0.5f, 0.5f).endVertex();
|
||||
|
||||
// -x face
|
||||
leBufferBuilder.vertex(matrix, -1F, -1F, -1F).uv(0f, 0.25f).endVertex();
|
||||
leBufferBuilder.vertex(matrix, -1F, 1F, -1F).uv(0f, 0.5f).endVertex();
|
||||
leBufferBuilder.vertex(matrix, -1F, 1F, 1F).uv(0.25f, 0.5f).endVertex();
|
||||
leBufferBuilder.vertex(matrix, -1F, -1F, 1F).uv(0.25f, 0.25f).endVertex();
|
||||
|
||||
BufferUploader.drawWithShader(leBufferBuilder.end());
|
||||
private void drawSkybox(PoseStack poseStack, Matrix4f projectionMatrix, float partialTick, Camera camera, boolean bl, Runnable skyFogSetup, CallbackInfo ci, FogType fogType, Vec3 vec3, float f, float g, float h, BufferBuilder bufferBuilder, ShaderInstance shaderInstance, float[] fs, float i, Matrix4f matrix4f2, float k, int r, int s, int m, float t, float o, float p, float q) {
|
||||
ExampleMod.nebulaSkybox.render(poseStack, projectionMatrix);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue