mirror of
https://github.com/JonasunderscoreJones/nicer-skies.git
synced 2025-10-22 19:29:18 +02:00
commit
1276ead89b
10 changed files with 47 additions and 38 deletions
30
README.md
30
README.md
|
@ -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
|
||||
|
||||
|
||||

|
||||
- 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*.
|
||||

|
||||
- 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.
|
||||

|
||||
## 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
|
||||

|
||||
## 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.
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
## 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).
|
||||
|
||||
|
||||

|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14.6",
|
||||
"minecraft": "1.19.2",
|
||||
"minecraft": "1.19.3",
|
||||
"java": ">=17"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue