Merge pull request #1 from ZtereoHYPE/1.19.3

1.19.3 update!
This commit is contained in:
ZtereoHYPE 2022-12-14 12:15:00 +01:00 committed by GitHub
commit 1276ead89b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 47 additions and 38 deletions

View file

@ -1,15 +1,25 @@
# Nicer Skies
This mod adds/changes 2 things:
- Star rendering: stars will twinkle and be of slightly different colours
This mod improves the following:
## Star rendering
Stars will twinkle and be of slightly different colours
![Star_video.mp4](https://user-images.githubusercontent.com/57519662/195574727-11e11ce6-73b6-4786-b6cf-4e38d4b5cd26.mp4)
- Nebulas! [heavily wip] This mod renders a little skybox that is 100% generated in runtime (and soon seed/server-dependent!) with cool shader-like nebulas. The following is a preview, but *they will significantly change*.
![nebulass](https://user-images.githubusercontent.com/57519662/195982091-0abb4067-a7ac-4456-bf99-365e0f2080a6.png)
- Lightmap changes: The lightmap has been a little tweaked to my personal preference to be a little more vibrant and dark, but it's 100% sure that these changes will be optional in the final product.
![lightmap](https://user-images.githubusercontent.com/57519662/195578328-053f5d84-a9db-4e44-a4a7-4ecc4f25af37.gif)
## Nebulas
This mod renders a seed/server-dependent skybox that is 100% generated in runtime with cool shader-like nebulas.
## warning
ugly code
## thanks
thanks to my kettle for boiling me tea when i least deserve it
![2022-11-07_15 12 41](https://user-images.githubusercontent.com/57519662/207486041-0547425d-da33-47eb-8e37-ca3e94ea9f2d.png)
## Lightmap changes
The lightmap has been a little tweaked to my personal preference to be a little more vibrant and dark, but it's 100% sure that these changes will be optional in the final product.
![lightmap](https://user-images.githubusercontent.com/57519662/195578328-053f5d84-a9db-4e44-a4a7-4ecc4f25af37.gif)
## Shaders
The mod does not work with most shaderpacks, but it does work (and looks really nice) with [Complementary Reimagined](https://www.curseforge.com/minecraft/customization/complementary-reimagined) (and probably some others, but I haven't tested them).
![Screenshit with comp reimagined](https://user-images.githubusercontent.com/57519662/207485708-534ad8fd-72eb-4204-a754-985edaaf2c24.png)

View file

@ -41,10 +41,6 @@ dependencies {
// devenv mods
modRuntimeOnly "maven.modrinth:lazydfu:${project.lazydfu_version}"
modRuntimeOnly "maven.modrinth:starlight:${project.starlight_version}"
// modRuntimeOnly "maven.modrinth:sodium:${project.sodium_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-resource-loader-v0", project.fabric_version))
modRuntimeOnly "maven.modrinth:lithium:${project.lithium_version}"
modRuntimeOnly "maven.modrinth:spark:${project.spark_version}"
modRuntimeOnly include(fabricApi.module("fabric-command-api-v2", project.fabric_version))

View file

@ -3,9 +3,9 @@
# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.19.2
loader_version=0.14.9
fabric_version=0.60.0+1.19.2
minecraft_version=1.19.3
loader_version=0.14.11
fabric_version=0.69.0+1.19.3
# Mod Properties
mod_version = 1.0.0
@ -13,9 +13,8 @@
archives_base_name = nicer-skies
# Dependencies
modmenu_version = 4.0.6
modmenu_version = 5.0.2
lazydfu_version = 0.1.3
starlight_version = 1.1.1+1.19
lithium_version = mc1.19.2-0.8.3
sodium_version = mc1.19.2-0.4.4
lithium_version = mc1.19.3-0.10.4
spark_version = 1.9.26-fabric

View file

@ -136,7 +136,7 @@ public class ConfigScreen extends Screen {
addRenderableWidget(new Button(this.width / 2 + (this.width / 2 - 150) / 2, 180, 74, 20, Component.literal("Apply"), (button) -> {
NicerSkies.skyManager.generateSky(NebulaSeedManager.getSeed());
invalidated = false;
}) {
}, null) {
@Override
public void render(@NotNull PoseStack poseStack, int mouseX, int mouseY, float partialTick) {
this.active = invalidated && NebulaSeedManager.canGetSeed();
@ -147,11 +147,10 @@ public class ConfigScreen extends Screen {
//reset to default
addRenderableWidget(new Button(this.width / 2 + (this.width / 2 - 150) / 2 + 76, 180, 74, 20, Component.literal("Reset"), (button) -> {
cm.resetNebulaSettings();
// find better way to reload screen
this.clearWidgets();
this.init();
invalidated = true;
}) {
}, null) {
@Override
public void render(@NotNull PoseStack poseStack, int mouseX, int mouseY, float partialTick) {
this.active = !isDefaultNebulaSettings();
@ -159,10 +158,12 @@ public class ConfigScreen extends Screen {
}
});
addRenderableWidget(Button.builder(Component.literal("Back"), (button) -> this.onClose())
.pos(this.width / 2 - 100, this.height - 30)
.size(200, 20)
.build());
super.init();
addRenderableWidget(new Button(this.width / 2 - 100, this.height - 30, 200, 20, Component.literal("Back"), (button) -> {
this.onClose();
}));
}
@Override

View file

@ -2,10 +2,10 @@ package codes.ztereohype.nicerskies.gui.widget;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.gui.GuiComponent;
import net.minecraft.client.gui.components.Widget;
import net.minecraft.client.gui.components.Renderable;
import org.jetbrains.annotations.NotNull;
public class Separator extends GuiComponent implements Widget {
public class Separator extends GuiComponent implements Renderable {
private final int x;
private final int y;
private final int height;

View file

@ -1,9 +1,10 @@
package codes.ztereohype.nicerskies.mixin;
import codes.ztereohype.nicerskies.NicerSkies;
import com.mojang.math.Vector3f;
import lombok.SneakyThrows;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.LightTexture;
import org.joml.Vector3f;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@ -14,10 +15,11 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
public abstract class MixinLightTexutre {
@Inject(
method = "updateLightTexture",
at = @At(value = "INVOKE", target = "Lcom/mojang/math/Vector3f;clamp(FF)V", shift = At.Shift.BEFORE, ordinal = 2),
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LightTexture;clampColor(Lorg/joml/Vector3f;)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) {
@SneakyThrows
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) {
if (!NicerSkies.config.getLightmapTweaked()) return;
Vector3f warmTint = new Vector3f(0.36F, 0.13F, -0.15F);
@ -28,7 +30,7 @@ public abstract class MixinLightTexutre {
warmTint.mul(warmness);
warmTint.add(1f, 1f, 1f);
Vector3f dramaticFactor = vector3f2.copy();
Vector3f dramaticFactor = (Vector3f) vector3f2.clone();
dramaticFactor.mul(0.20f);
dramaticFactor.add(0.80f, 0.80f, 0.81f);

View file

@ -2,7 +2,6 @@ package codes.ztereohype.nicerskies.mixin;
import codes.ztereohype.nicerskies.NicerSkies;
import com.mojang.blaze3d.vertex.*;
import com.mojang.math.Matrix4f;
import net.minecraft.client.Camera;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.GameRenderer;
@ -10,6 +9,7 @@ import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.client.renderer.ShaderInstance;
import net.minecraft.world.level.material.FogType;
import net.minecraft.world.phys.Vec3;
import org.joml.Matrix4f;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
@ -46,7 +46,7 @@ public abstract class MixinStarRendering {
@ModifyArg(
method = "renderSky",
at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/VertexBuffer;drawWithShader(Lcom/mojang/math/Matrix4f;Lcom/mojang/math/Matrix4f;Lnet/minecraft/client/renderer/ShaderInstance;)V", ordinal = 1),
at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/VertexBuffer;drawWithShader(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lnet/minecraft/client/renderer/ShaderInstance;)V", ordinal = 1),
index = 2
)
private ShaderInstance injectStarColour(ShaderInstance shaderInstance) {
@ -58,8 +58,8 @@ 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 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) {
private void drawSkybox(PoseStack poseStack, Matrix4f matrix4f, float f, Camera camera, boolean bl, Runnable runnable, CallbackInfo ci, FogType fogType, Vec3 vec3, float g, float h, float i, BufferBuilder bufferBuilder, ShaderInstance shaderInstance, float[] fs, float j, Matrix4f matrix4f3, float l, int s, int t, int n, float u, float p, float q, float r) {
if (!NicerSkies.config.getNebulas() || !NicerSkies.skyManager.isInitialized()) return;
NicerSkies.skyManager.getSkybox().render(poseStack, projectionMatrix);
NicerSkies.skyManager.getSkybox().render(poseStack, matrix4f);
}
}

View file

@ -4,13 +4,13 @@ import codes.ztereohype.nicerskies.NicerSkies;
import com.mojang.blaze3d.platform.NativeImage;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.*;
import com.mojang.math.Matrix4f;
import lombok.Getter;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.util.Mth;
import org.joml.Matrix4f;
public class Skybox {
public static final int RESOLUTION = 512;

View file

@ -25,6 +25,7 @@ public class Starbox {
generateStars(randomSource);
}
// not good practice: decrementing iteration variable
private void generateStars(RandomSource randomSource) {
ImprovedNoise noise = new ImprovedNoise(randomSource);

View file

@ -26,7 +26,7 @@
],
"depends": {
"fabricloader": ">=0.14.6",
"minecraft": "1.19.2",
"minecraft": "1.19.3",
"java": ">=17"
}
}