mirror of
https://github.com/JonasunderscoreJones/nicer-skies.git
synced 2025-10-23 11:49:17 +02:00
change: lots of changes
This commit is contained in:
parent
7d37cc3c87
commit
8f7e5a5f57
12 changed files with 230 additions and 78 deletions
|
@ -44,7 +44,7 @@ dependencies {
|
||||||
// modRuntimeOnly include(fabricApi.module("fabric-rendering-data-attachment-v1", project.fabric_version))
|
// modRuntimeOnly include(fabricApi.module("fabric-rendering-data-attachment-v1", project.fabric_version))
|
||||||
// modRuntimeOnly include(fabricApi.module("fabric-rendering-fluids-v1", project.fabric_version))
|
// modRuntimeOnly include(fabricApi.module("fabric-rendering-fluids-v1", project.fabric_version))
|
||||||
// modRuntimeOnly include(fabricApi.module("fabric-resource-loader-v0", project.fabric_version))
|
// modRuntimeOnly include(fabricApi.module("fabric-resource-loader-v0", project.fabric_version))
|
||||||
modRuntimeOnly "maven.modrinth:lithium:${project.lithium_version}"
|
// modRuntimeOnly "maven.modrinth:lithium:${project.lithium_version}"
|
||||||
modRuntimeOnly "maven.modrinth:spark:${project.spark_version}"
|
modRuntimeOnly "maven.modrinth:spark:${project.spark_version}"
|
||||||
modRuntimeOnly include(fabricApi.module("fabric-command-api-v2", project.fabric_version))
|
modRuntimeOnly include(fabricApi.module("fabric-command-api-v2", project.fabric_version))
|
||||||
modRuntimeOnly include(fabricApi.module("fabric-lifecycle-events-v1", project.fabric_version))
|
modRuntimeOnly include(fabricApi.module("fabric-lifecycle-events-v1", project.fabric_version))
|
||||||
|
|
|
@ -5,17 +5,9 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class ExampleMod implements ModInitializer {
|
public class ExampleMod implements ModInitializer {
|
||||||
// This logger is used to write text to the console and the log file.
|
|
||||||
// It is considered best practice to use your mod id as the logger's name.
|
|
||||||
// That way, it's clear which mod wrote info, warnings, and errors.
|
|
||||||
public static final Logger LOGGER = LoggerFactory.getLogger("modid");
|
public static final Logger LOGGER = LoggerFactory.getLogger("modid");
|
||||||
|
public static boolean toggle = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {}
|
||||||
// This code runs as soon as Minecraft is in a mod-load-ready state.
|
|
||||||
// However, some things (like resources) may still be uninitialized.
|
|
||||||
// Proceed with mild caution.
|
|
||||||
|
|
||||||
LOGGER.info("Hello Fabric world!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,69 +6,71 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Star {
|
public class Star {
|
||||||
private final double xCoord;
|
private final float xCoord;
|
||||||
private final double yCoord;
|
private final float yCoord;
|
||||||
private final double zCoord;
|
private final float zCoord;
|
||||||
|
|
||||||
private final double sinPolarAngle;
|
private final float sinPolarAngle;
|
||||||
private final double cosPolarAngle;
|
private final float cosPolarAngle;
|
||||||
|
|
||||||
private final double projSin;
|
private final float projSin;
|
||||||
private final double projCos;
|
private final float projCos;
|
||||||
|
|
||||||
private final double twinkleSpeed;
|
private final float twinkleSpeed;
|
||||||
private final double initialRadius;
|
private final float minRadius;
|
||||||
|
private final float maxRadius;
|
||||||
|
|
||||||
private double currentAngle;
|
private float currentAngle;
|
||||||
private double currentRadius;
|
private float currentRadius;
|
||||||
|
|
||||||
public Star(double randX, double randY, double randZ, double initialRadius, double twinkleSpeed) {
|
public Star(float randX, float randY, float randZ, float radius, float twinkleSpeed) {
|
||||||
double invsqrtDistance = Mth.fastInvSqrt(randX * randX + randY * randY + randZ * randZ);
|
float invsqrtDistance = Mth.fastInvSqrt(randX * randX + randY * randY + randZ * randZ);
|
||||||
this.xCoord = randX * invsqrtDistance * 100.0;
|
this.xCoord = randX * invsqrtDistance * 100.0F;
|
||||||
this.yCoord = randY * invsqrtDistance * 100.0;
|
this.yCoord = randY * invsqrtDistance * 100.0F;
|
||||||
this.zCoord = randZ * invsqrtDistance * 100.0;
|
this.zCoord = randZ * invsqrtDistance * 100.0F;
|
||||||
|
|
||||||
double polarAngle = Math.atan2(randX, randZ);
|
double polarAngle = Math.atan2(randX, randZ);
|
||||||
this.sinPolarAngle = Math.sin(polarAngle);
|
this.sinPolarAngle = (float) Math.sin(polarAngle);
|
||||||
this.cosPolarAngle = Math.cos(polarAngle);
|
this.cosPolarAngle = (float) Math.cos(polarAngle);
|
||||||
|
|
||||||
// magic projection fuckery??
|
// magic projection fuckery??
|
||||||
double proj = Math.atan2(Math.sqrt(randX * randX + randZ * randZ), randY);
|
double proj = Math.atan2(Math.sqrt(randX * randX + randZ * randZ), randY);
|
||||||
this.projSin = Math.sin(proj);
|
this.projSin = (float) Math.sin(proj);
|
||||||
this.projCos = Math.cos(proj);
|
this.projCos = (float) Math.cos(proj);
|
||||||
|
|
||||||
this.twinkleSpeed = twinkleSpeed;
|
this.twinkleSpeed = twinkleSpeed;
|
||||||
this.initialRadius = initialRadius;
|
this.minRadius = radius - 0.15f;
|
||||||
this.currentRadius = initialRadius;
|
this.maxRadius = radius + 0.15f;
|
||||||
|
this.currentRadius = radius;
|
||||||
this.currentAngle = twinkleSpeed; //just so they dont all start straight
|
this.currentAngle = twinkleSpeed; //just so they dont all start straight
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick(int ticks) {
|
public void tick(int ticks) {
|
||||||
currentAngle += 0.007d * twinkleSpeed;
|
currentAngle += 0.007f * twinkleSpeed;
|
||||||
currentRadius = Mth.lerp(Math.sin(ticks * twinkleSpeed / 10f) * 0.5f + 0.5f, initialRadius - 0.15f, initialRadius + 0.15f) ;
|
currentRadius = Mth.lerp(Mth.sin(ticks * twinkleSpeed / 10f) * 0.5f + 0.5f, minRadius, maxRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
//return 4*3 coords for 4 vertices
|
//return 4*3 coords for 4 vertices
|
||||||
public double[] getVertices() {
|
public float[] getVertices() {
|
||||||
double[] vertices = new double[12];
|
float[] vertices = new float[12];
|
||||||
|
|
||||||
double cosRot = Math.cos(currentAngle);
|
float cosRot = Mth.cos(currentAngle);
|
||||||
double sinRot = Math.sin(currentAngle);
|
float sinRot = Mth.sin(currentAngle);
|
||||||
|
|
||||||
for(int v = 0; v < 4; ++v) {
|
for(int v = 0; v < 4; ++v) {
|
||||||
// shift the vector to the 4 corners:
|
// shift the vector to the 4 corners:
|
||||||
// vec 0, 1 --> -rad; vec 2, 3 --> +rad
|
// vec 0, 1 --> -rad; vec 2, 3 --> +rad
|
||||||
double xShift = (double)((v & 2) - 1) * currentRadius;
|
float xShift = ((v & 2) - 1) * currentRadius;
|
||||||
// vec 1, 2 --> +rad; vec 3, 0 --> -rad
|
// vec 1, 2 --> +rad; vec 3, 0 --> -rad
|
||||||
double yShift = (double)(((v + 1) & 2) - 1) * currentRadius;
|
float yShift = (((v + 1) & 2) - 1) * currentRadius;
|
||||||
|
|
||||||
// magic projection fuckery to turn the shift into an offset applying rotation and polar bs
|
// magic projection fuckery to turn the shift into an offset applying rotation and polar bs
|
||||||
double aa = xShift * cosRot - yShift * sinRot;
|
float aa = xShift * cosRot - yShift * sinRot;
|
||||||
double ab = yShift * cosRot + xShift * sinRot;
|
float ab = yShift * cosRot + xShift * sinRot;
|
||||||
double ae = - aa * projCos;
|
float ae = - aa * projCos;
|
||||||
double yOffset = aa * projSin;
|
float yOffset = aa * projSin;
|
||||||
double xOffset = ae * sinPolarAngle - ab * cosPolarAngle;
|
float xOffset = ae * sinPolarAngle - ab * cosPolarAngle;
|
||||||
double zOffset = ab * sinPolarAngle + ae * cosPolarAngle;
|
float zOffset = ab * sinPolarAngle + ae * cosPolarAngle;
|
||||||
|
|
||||||
vertices[v * 3 ] = xCoord + xOffset;
|
vertices[v * 3 ] = xCoord + xOffset;
|
||||||
vertices[v * 3 + 1] = yCoord + yOffset;
|
vertices[v * 3 + 1] = yCoord + yOffset;
|
||||||
|
|
|
@ -9,9 +9,9 @@ import net.minecraft.util.RandomSource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
//todo: redo all of the star rendering to be able to use the same vertex buffer object with a uniform or with the posestack
|
||||||
public class StarManager {
|
public class StarManager {
|
||||||
// public static VertexBuffer starBuffer = new VertexBuffer();
|
private static final int STAR_ATTEMPTS = 1500;
|
||||||
|
|
||||||
public static ArrayList<Star> starList = new ArrayList<>();
|
public static ArrayList<Star> starList = new ArrayList<>();
|
||||||
|
|
||||||
public static BufferBuilder.RenderedBuffer generateStars(BufferBuilder bufferBuilder, long seed) {
|
public static BufferBuilder.RenderedBuffer generateStars(BufferBuilder bufferBuilder, long seed) {
|
||||||
|
@ -79,7 +79,6 @@ public class StarManager {
|
||||||
double zOffset = ab * sinPolarAngle + ae * cosPolarAngle;
|
double zOffset = ab * sinPolarAngle + ae * cosPolarAngle;
|
||||||
|
|
||||||
bufferBuilder.vertex(xCoord + xOffset, yCoord + yOffset, zCoord + zOffset).endVertex();
|
bufferBuilder.vertex(xCoord + xOffset, yCoord + yOffset, zCoord + zOffset).endVertex();
|
||||||
System.out.println("x: " + (xCoord + xOffset) + ", y: " + (yCoord + yOffset) + ", z: " + (zCoord + zOffset));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,36 +88,38 @@ public class StarManager {
|
||||||
|
|
||||||
public static void generateStarList() {
|
public static void generateStarList() {
|
||||||
RandomSource randomSource = RandomSource.create(123L);
|
RandomSource randomSource = RandomSource.create(123L);
|
||||||
for(int i = 0; i < 65000; ++i) {
|
starList.clear();
|
||||||
|
|
||||||
|
for(int i = 0; i < STAR_ATTEMPTS; ++i) {
|
||||||
// -1..1
|
// -1..1
|
||||||
double randX = randomSource.nextFloat() * 2.0F - 1.0F;
|
float randX = randomSource.nextFloat() * 2.0F - 1.0F;
|
||||||
double randY = randomSource.nextFloat() * 2.0F - 1.0F;
|
float randY = randomSource.nextFloat() * 2.0F - 1.0F;
|
||||||
double randZ = randomSource.nextFloat() * 2.0F - 1.0F;
|
float randZ = randomSource.nextFloat() * 2.0F - 1.0F;
|
||||||
|
|
||||||
// 0.15..0.25 ???
|
// 0.15..0.25 ???
|
||||||
double starRadius = 0.15F + randomSource.nextFloat() * 0.1F;
|
float starRadius = 0.15F + randomSource.nextFloat() * 0.1F;
|
||||||
|
|
||||||
double squaredDistance = randX * randX + randY * randY + randZ * randZ;
|
double squaredDistance = randX * randX + randY * randY + randZ * randZ;
|
||||||
if (squaredDistance < 1.0 && squaredDistance > 0.01) {
|
if (squaredDistance < 1.0 && squaredDistance > 0.01) {
|
||||||
starList.add(new Star(randX, randY, randZ, starRadius, 0.3 + randomSource.nextDouble() * 0.4));
|
starList.add(new Star(randX, randY, randZ, starRadius, 0.3f + randomSource.nextFloat() * 0.4f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateStars(int ticks, VertexBuffer starBuffer) {
|
public static void updateStars(int ticks, VertexBuffer starBuffer) {
|
||||||
Tesselator tesselator = Tesselator.getInstance();
|
if (!ExampleMod.toggle) return;
|
||||||
BufferBuilder bufferBuilder = tesselator.getBuilder();
|
BufferBuilder bufferBuilder = Tesselator.getInstance().getBuilder();
|
||||||
RenderSystem.setShader(GameRenderer::getPositionShader);
|
|
||||||
|
|
||||||
bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION);
|
bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION);
|
||||||
|
//
|
||||||
for (Star star : starList) {
|
for (Star star : starList) {
|
||||||
star.tick(ticks);
|
star.tick(ticks);
|
||||||
|
|
||||||
double[] vertexList = star.getVertices();
|
float[] vertexList = star.getVertices();
|
||||||
for (int i = 0; i < 12; i += 3) {
|
|
||||||
bufferBuilder.vertex(vertexList[i], vertexList[i + 1], vertexList[i + 2]).endVertex();
|
bufferBuilder.vertex(vertexList[0], vertexList[1], vertexList[2]).endVertex();
|
||||||
}
|
bufferBuilder.vertex(vertexList[3], vertexList[4], vertexList[5]).endVertex();
|
||||||
|
bufferBuilder.vertex(vertexList[6], vertexList[7], vertexList[8]).endVertex();
|
||||||
|
bufferBuilder.vertex(vertexList[9], vertexList[10], vertexList[11]).endVertex();
|
||||||
}
|
}
|
||||||
|
|
||||||
starBuffer.bind();
|
starBuffer.bind();
|
||||||
|
|
|
@ -36,11 +36,14 @@ public class ExampleMixin {
|
||||||
|
|
||||||
// @Inject(at = @At(value="INVOKE", shift = At.Shift.AFTER, target = "Lcom/mojang/blaze3d/vertex/VertexBuffer;bind()V", ordinal = 1), method = "renderSky")
|
// @Inject(at = @At(value="INVOKE", shift = At.Shift.AFTER, target = "Lcom/mojang/blaze3d/vertex/VertexBuffer;bind()V", ordinal = 1), method = "renderSky")
|
||||||
// private void pushPoseStack(PoseStack poseStack, Matrix4f projectionMatrix, float partialTick, Camera camera, boolean bl, Runnable skyFogSetup, CallbackInfo ci) {
|
// private void pushPoseStack(PoseStack poseStack, Matrix4f projectionMatrix, float partialTick, Camera camera, boolean bl, Runnable skyFogSetup, CallbackInfo ci) {
|
||||||
// poseStack.pushPose();
|
//// float[] scaling = ExampleMod.getScaling();
|
||||||
// poseStack.scale(40,1,1);
|
//// poseStack.pushPose();
|
||||||
|
//// poseStack.scale(scaling[0], scaling[1], scaling[2]);
|
||||||
|
//
|
||||||
// }
|
// }
|
||||||
|
//
|
||||||
// @Inject(at = @At(value="INVOKE", shift = At.Shift.AFTER, target = "Lcom/mojang/blaze3d/vertex/VertexBuffer;drawWithShader(Lcom/mojang/math/Matrix4f;Lcom/mojang/math/Matrix4f;Lnet/minecraft/client/renderer/ShaderInstance;)V", ordinal = 1), method = "renderSky")
|
// @Inject(at = @At(value="INVOKE", shift = At.Shift.AFTER, target = "Lcom/mojang/blaze3d/vertex/VertexBuffer;drawWithShader(Lcom/mojang/math/Matrix4f;Lcom/mojang/math/Matrix4f;Lnet/minecraft/client/renderer/ShaderInstance;)V", ordinal = 1), method = "renderSky")
|
||||||
// private void popPoseStack(PoseStack poseStack, Matrix4f projectionMatrix, float partialTick, Camera camera, boolean bl, Runnable skyFogSetup, CallbackInfo ci) {
|
// private void popPoseStack(PoseStack poseStack, Matrix4f projectionMatrix, float partialTick, Camera camera, boolean bl, Runnable skyFogSetup, CallbackInfo ci) {
|
||||||
// poseStack.popPose();
|
//// poseStack.popPose();
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package codes.ztereohype.example.mixin;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.platform.NativeImage;
|
||||||
|
import net.minecraft.client.renderer.GameRenderer;
|
||||||
|
import net.minecraft.client.renderer.LightTexture;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
import net.minecraft.world.level.dimension.DimensionType;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
|
|
||||||
|
@Mixin(LightTexture.class)
|
||||||
|
public interface LightTextureInvoker {
|
||||||
|
@Accessor NativeImage getLightPixels();
|
||||||
|
}
|
39
src/main/java/codes/ztereohype/example/mixin/MixinDebug.java
Normal file
39
src/main/java/codes/ztereohype/example/mixin/MixinDebug.java
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
package codes.ztereohype.example.mixin;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.platform.NativeImage;
|
||||||
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiComponent;
|
||||||
|
import net.minecraft.client.gui.components.DebugScreenOverlay;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(DebugScreenOverlay.class)
|
||||||
|
public abstract class MixinDebug {
|
||||||
|
@Final @Shadow private Minecraft minecraft;
|
||||||
|
|
||||||
|
@Inject(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;)V", at = @At("HEAD"))
|
||||||
|
private void injectRender(PoseStack poseStack, CallbackInfo ci) {
|
||||||
|
int pixelSize = 6;
|
||||||
|
|
||||||
|
NativeImage lightPixels = ((LightTextureInvoker) minecraft.gameRenderer.lightTexture()).getLightPixels();
|
||||||
|
for (int x = 0; x < lightPixels.getWidth(); x++) {
|
||||||
|
for (int y = 0; y < lightPixels.getHeight(); y++) {
|
||||||
|
int colour = lightPixels.getPixelRGBA(x, y);
|
||||||
|
|
||||||
|
int b = colour & 0xFF;
|
||||||
|
int g = colour >> 8 & 0xFF;
|
||||||
|
int r = colour >> 16 & 0xFF;
|
||||||
|
|
||||||
|
int xCoord = minecraft.getWindow().getGuiScaledWidth() - (x * pixelSize);
|
||||||
|
int yCoord = minecraft.getWindow().getGuiScaledHeight() - (y * pixelSize);
|
||||||
|
|
||||||
|
GuiComponent.fill(poseStack, xCoord, yCoord, xCoord + pixelSize, yCoord + pixelSize, 0xFF000000 | b << 16 | g << 8 | r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package codes.ztereohype.example.mixin;
|
||||||
|
|
||||||
|
import codes.ztereohype.example.ExampleMod;
|
||||||
|
import codes.ztereohype.example.StarManager;
|
||||||
|
import net.minecraft.client.KeyboardHandler;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(KeyboardHandler.class)
|
||||||
|
public class MixinKeyboardHandler {
|
||||||
|
private long cooldown = 0;
|
||||||
|
@Inject(at = @At("HEAD"), method = "keyPress")
|
||||||
|
private void printKey(long windowPointer, int key, int scanCode, int action, int modifiers, CallbackInfo ci) {
|
||||||
|
if (key == 92) {
|
||||||
|
// StarManager.generateStarList();
|
||||||
|
long time = System.currentTimeMillis();
|
||||||
|
if (time - cooldown > 200) {
|
||||||
|
ExampleMod.toggle = !ExampleMod.toggle;
|
||||||
|
cooldown = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package codes.ztereohype.example.mixin;
|
||||||
|
|
||||||
|
import codes.ztereohype.example.ExampleMod;
|
||||||
|
import com.mojang.math.Vector3f;
|
||||||
|
import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
|
import net.minecraft.client.renderer.LightTexture;
|
||||||
|
import net.minecraft.util.Mth;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||||
|
|
||||||
|
@Mixin(LightTexture.class)
|
||||||
|
public class MixinLightTexutre {
|
||||||
|
// @ModifyVariable(method = "updateLightTexture",
|
||||||
|
// at = @At("STORE"),
|
||||||
|
// ordinal = 9)
|
||||||
|
// private float mixinRedBrightness(float original) {
|
||||||
|
// if (ExampleMod.toggle) {
|
||||||
|
// return 1F;
|
||||||
|
// } else {
|
||||||
|
// return original;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// @ModifyArgs(
|
||||||
|
// method = "updateLightTexture",
|
||||||
|
// at = @At(value = "INVOKE", target = "Lcom/mojang/math/Vector3f;set(FFF)V", ordinal = 0)
|
||||||
|
// )
|
||||||
|
// private void mixinRedBrightness(Args args) {
|
||||||
|
// if (ExampleMod.toggle) {
|
||||||
|
// args.set(0, 1F);
|
||||||
|
// args.set(1, args.get(1));
|
||||||
|
// args.set(2, args.get(2));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Inject(
|
||||||
|
method = "updateLightTexture",
|
||||||
|
at = @At(value = "INVOKE", target = "Lcom/mojang/math/Vector3f;clamp(FF)V", shift = At.Shift.BEFORE, ordinal = 2),
|
||||||
|
locals = LocalCapture.CAPTURE_FAILHARD
|
||||||
|
)
|
||||||
|
private void injectWarmLight(float partialTicks, CallbackInfo ci, ClientLevel clientLevel, float f, float g, float h, float i, float j, float l, float k, Vector3f vector3f, float m, Vector3f vector3f2, int n, int o, float p, float q, float r, float s, float t, boolean bl, float v, Vector3f vector3f5) {
|
||||||
|
//todo: find a way to make a touch more saturated and brighter(?)
|
||||||
|
if (ExampleMod.toggle) {
|
||||||
|
Vector3f warmTint = new Vector3f(0.36F, 0.15F, -0.19F);
|
||||||
|
|
||||||
|
float warmness = o / 15f * // increase w/ blocklight
|
||||||
|
(1f - vector3f.x() * (1 - n/15f)) * // decrease in skylight w/ dayness
|
||||||
|
Math.min((15 - o)/9f, 1f); // decrease for the 3 highest block light levels
|
||||||
|
|
||||||
|
warmTint.mul(warmness);
|
||||||
|
warmTint.add(1f, 1f, 1f);
|
||||||
|
|
||||||
|
Vector3f dramaticFactor = vector3f2.copy();
|
||||||
|
dramaticFactor.mul(0.25f);
|
||||||
|
dramaticFactor.add(0.75f, 0.75f, 0.76f);
|
||||||
|
|
||||||
|
vector3f2.mul(dramaticFactor.x(), dramaticFactor.y(), dramaticFactor.z());
|
||||||
|
vector3f2.mul(warmTint.x(), warmTint.y(), warmTint.z());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,9 +4,14 @@
|
||||||
"package": "codes.ztereohype.example.mixin",
|
"package": "codes.ztereohype.example.mixin",
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"ExampleMixin"
|
"ExampleMixin",
|
||||||
|
"MixinKeyboardHandler"
|
||||||
|
],
|
||||||
|
"client": [
|
||||||
|
"LightTextureInvoker",
|
||||||
|
"MixinDebug",
|
||||||
|
"MixinLightTexutre"
|
||||||
],
|
],
|
||||||
"client": [],
|
|
||||||
"server": [],
|
"server": [],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|
13
src/test/java/codes/ztereohype/example/PerformanceTest.java
Normal file
13
src/test/java/codes/ztereohype/example/PerformanceTest.java
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
package codes.ztereohype.example;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PerformanceTest {
|
||||||
|
@Test
|
||||||
|
public void test() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +0,0 @@
|
||||||
package codes.ztereohype.example;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
//public class performanceTest {
|
|
||||||
// @Test
|
|
||||||
// public void
|
|
||||||
//}
|
|
Loading…
Add table
Add a link
Reference in a new issue