mirror of
https://github.com/JonasunderscoreJones/nicer-skies.git
synced 2025-10-22 19:29:18 +02:00
new: 1.20 update
This commit is contained in:
parent
61cdd312d9
commit
7721a2f09a
12 changed files with 34 additions and 33 deletions
|
@ -30,7 +30,7 @@ dependencies {
|
||||||
|
|
||||||
mappings loom.layered {
|
mappings loom.layered {
|
||||||
it.officialMojangMappings()
|
it.officialMojangMappings()
|
||||||
it.parchment("org.parchmentmc.data:parchment-1.19.2:2022.08.10@zip") // https://ldtteam.jfrog.io/ui/native/parchmentmc-public/org/parchmentmc/data/parchment-1.18.1/BLEEDING-SNAPSHOT
|
// it.parchment("org.parchmentmc.data:parchment-1.19.2:2022.08.10@zip") // https://ldtteam.jfrog.io/ui/native/parchmentmc-public/org/parchmentmc/data/parchment-1.18.1/BLEEDING-SNAPSHOT
|
||||||
}
|
}
|
||||||
|
|
||||||
// apis
|
// apis
|
||||||
|
|
|
@ -3,17 +3,17 @@
|
||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/develop
|
# check these on https://fabricmc.net/develop
|
||||||
minecraft_version=1.19.3
|
minecraft_version=1.20-rc1
|
||||||
loader_version=0.14.11
|
loader_version=0.14.21
|
||||||
fabric_version=0.69.0+1.19.3
|
fabric_version=0.83.0+1.20
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.2.0
|
mod_version = 1.2.0
|
||||||
maven_group = codes.ztereohype
|
maven_group = codes.ztereohype
|
||||||
archives_base_name = nicer-skies
|
archives_base_name = nicer-skies
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies TODO: update these before final update
|
||||||
modmenu_version = 5.0.2
|
modmenu_version = 7.0.0-beta.2
|
||||||
lazydfu_version = 0.1.3
|
lazydfu_version = 0.1.3
|
||||||
starlight_version = 1.1.1+1.19
|
starlight_version = 1.1.1+1.19
|
||||||
lithium_version = mc1.19.3-0.10.4
|
lithium_version = mc1.19.3-0.10.4
|
||||||
|
|
0
gradlew
vendored
Executable file → Normal file
0
gradlew
vendored
Executable file → Normal file
|
@ -6,6 +6,7 @@ import codes.ztereohype.nicerskies.core.NebulaSeedManager;
|
||||||
import codes.ztereohype.nicerskies.gui.widget.Separator;
|
import codes.ztereohype.nicerskies.gui.widget.Separator;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.gui.components.AbstractSliderButton;
|
import net.minecraft.client.gui.components.AbstractSliderButton;
|
||||||
import net.minecraft.client.gui.components.Button;
|
import net.minecraft.client.gui.components.Button;
|
||||||
import net.minecraft.client.gui.components.Checkbox;
|
import net.minecraft.client.gui.components.Checkbox;
|
||||||
|
@ -151,9 +152,9 @@ public class ConfigScreen extends Screen {
|
||||||
invalidated = true;
|
invalidated = true;
|
||||||
}, null) {
|
}, null) {
|
||||||
@Override
|
@Override
|
||||||
public void render(@NotNull PoseStack poseStack, int mouseX, int mouseY, float partialTick) {
|
public void render(GuiGraphics g, int mouseX, int mouseY, float partialTick) {
|
||||||
this.active = !isDefaultNebulaSettings();
|
this.active = !isDefaultNebulaSettings();
|
||||||
super.render(poseStack, mouseX, mouseY, partialTick);
|
super.render(g, mouseX, mouseY, partialTick);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -163,9 +164,9 @@ public class ConfigScreen extends Screen {
|
||||||
invalidated = false;
|
invalidated = false;
|
||||||
}, null) {
|
}, null) {
|
||||||
@Override
|
@Override
|
||||||
public void render(@NotNull PoseStack poseStack, int mouseX, int mouseY, float partialTick) {
|
public void render(GuiGraphics g, int mouseX, int mouseY, float partialTick) {
|
||||||
this.active = invalidated;
|
this.active = invalidated;
|
||||||
super.render(poseStack, mouseX, mouseY, partialTick);
|
super.render(g, mouseX, mouseY, partialTick);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -178,15 +179,15 @@ public class ConfigScreen extends Screen {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(@NotNull PoseStack poseStack, int mouseX, int mouseY, float partialTick) {
|
public void render(GuiGraphics g, int mouseX, int mouseY, float partialTick) {
|
||||||
this.renderBackground(poseStack);
|
this.renderBackground(g);
|
||||||
super.render(poseStack, mouseX, mouseY, partialTick);
|
super.render(g, mouseX, mouseY, partialTick);
|
||||||
|
|
||||||
drawCenteredString(poseStack, this.font, this.title, this.width / 2, 10, 16777215);
|
g.drawCenteredString(this.font, this.title, this.width / 2, 10, 16777215);
|
||||||
drawCenteredString(poseStack, this.font, "Toggle Features", this.width / 4, 36, 16777215);
|
g.drawCenteredString(this.font, "Toggle Features", this.width / 4, 36, 16777215);
|
||||||
drawCenteredString(poseStack, this.font, "Nebula Settings", 3 * this.width / 4, 36, 16777215);
|
g.drawCenteredString(this.font, "Nebula Settings", 3 * this.width / 4, 36, 16777215);
|
||||||
|
|
||||||
drawWrappedString(poseStack, "§lNote:§r \n\nDisable \"Twinkle Stars\" for compatibility with other mods.\n(eg. Custom Stars)", 20, 150, this.width/2 - 40, 0xFFFF00);
|
drawWrappedString(g, "§lNote:§r \n\nDisable \"Twinkle Stars\" for compatibility with other mods.\n(eg. Custom Stars)", 20, 150, this.width/2 - 40, 0xFFFF00);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -208,14 +209,14 @@ public class ConfigScreen extends Screen {
|
||||||
return cm.nebulaConfigEquals(ConfigManager.DEFAULT_CONFIG);
|
return cm.nebulaConfigEquals(ConfigManager.DEFAULT_CONFIG);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawWrappedString(PoseStack poseStack, String string, int x, int y, int wrapWidth, int color) {
|
private void drawWrappedString(GuiGraphics g, String string, int x, int y, int wrapWidth, int color) {
|
||||||
Minecraft mc = Minecraft.getInstance();
|
Minecraft mc = Minecraft.getInstance();
|
||||||
List<FormattedText> lines = mc.font.getSplitter().splitLines(Component.literal(string), wrapWidth, Style.EMPTY);
|
List<FormattedText> lines = mc.font.getSplitter().splitLines(Component.literal(string), wrapWidth, Style.EMPTY);
|
||||||
|
|
||||||
int amount = lines.size();
|
int amount = lines.size();
|
||||||
for (int i = 0; i < amount; i++) {
|
for (int i = 0; i < amount; i++) {
|
||||||
FormattedText renderable = lines.get(i);
|
FormattedText renderable = lines.get(i);
|
||||||
font.draw(poseStack, renderable.getString(), x, (float)(y + i * 9), color);
|
g.drawString(font, renderable.getString(), x, y + i * 9, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package codes.ztereohype.nicerskies.gui.widget;
|
package codes.ztereohype.nicerskies.gui.widget;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import net.minecraft.client.gui.GuiComponent;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.gui.components.Renderable;
|
import net.minecraft.client.gui.components.Renderable;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class Separator extends GuiComponent implements Renderable {
|
public class Separator implements Renderable {
|
||||||
private final int x;
|
private final int x;
|
||||||
private final int y;
|
private final int y;
|
||||||
private final int height;
|
private final int height;
|
||||||
|
@ -17,7 +17,7 @@ public class Separator extends GuiComponent implements Renderable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(@NotNull PoseStack poseStack, int mouseX, int mouseY, float partialTick) {
|
public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) {
|
||||||
fill(poseStack, x, y, x + 1, y + height, 0xFFFFFFFF);
|
graphics.fill(x, y, x + 1, y + height, 0xFFFFFFFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,8 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
@Mixin(LevelRenderer.class)
|
@Mixin(LevelRenderer.class)
|
||||||
public interface LevelRendererAccessor {
|
public interface LevelRendererAccessor {
|
||||||
@Accessor("starBuffer")
|
@Accessor("starBuffer")
|
||||||
VertexBuffer getStarBuffer();
|
VertexBuffer nicerSkies_getStarBuffer();
|
||||||
|
|
||||||
@Accessor("ticks")
|
@Accessor("ticks")
|
||||||
int getTicks();
|
int nicerSkies_getTicks();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public abstract class LevelRendererMixin {
|
||||||
private void generateStars(CallbackInfo ci) {
|
private void generateStars(CallbackInfo ci) {
|
||||||
if (!NicerSkies.config.getTwinklingStars()) return;
|
if (!NicerSkies.config.getTwinklingStars()) return;
|
||||||
|
|
||||||
starBuffer = new VertexBuffer();
|
starBuffer = new VertexBuffer(VertexBuffer.Usage.DYNAMIC);
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public abstract class LevelRendererMixin {
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
method = "renderSky",
|
method = "renderSky",
|
||||||
at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;disableTexture()V", ordinal = 2, shift = At.Shift.AFTER),
|
at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/BufferUploader;drawWithShader(Lcom/mojang/blaze3d/vertex/BufferBuilder$RenderedBuffer;)V", ordinal = 2, shift = At.Shift.AFTER),
|
||||||
locals = LocalCapture.CAPTURE_FAILHARD
|
locals = LocalCapture.CAPTURE_FAILHARD
|
||||||
)
|
)
|
||||||
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) {
|
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) {
|
||||||
|
|
|
@ -40,8 +40,8 @@ public class SkyManager {
|
||||||
|
|
||||||
if (starsEnabled) {
|
if (starsEnabled) {
|
||||||
LevelRendererAccessor levelRenderer = (LevelRendererAccessor) Minecraft.getInstance().levelRenderer;
|
LevelRendererAccessor levelRenderer = (LevelRendererAccessor) Minecraft.getInstance().levelRenderer;
|
||||||
starbox = new Starbox(randomSource, starGradient, levelRenderer.getStarBuffer());
|
starbox = new Starbox(randomSource, starGradient, levelRenderer.nicerSkies_getStarBuffer());
|
||||||
tick(levelRenderer.getTicks());
|
tick(levelRenderer.nicerSkies_getTicks());
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
((LevelRendererInvoker)Minecraft.getInstance().levelRenderer).nicerSkies_generateSky();
|
((LevelRendererInvoker)Minecraft.getInstance().levelRenderer).nicerSkies_generateSky();
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class Skybox {
|
||||||
|
|
||||||
private final ExecutorService skyExecutor = Executors.newCachedThreadPool();
|
private final ExecutorService skyExecutor = Executors.newCachedThreadPool();
|
||||||
|
|
||||||
private final @Getter VertexBuffer skyboxBuffer = new VertexBuffer();
|
private final @Getter VertexBuffer skyboxBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC);
|
||||||
|
|
||||||
public Skybox(SkyboxPainter painter) {
|
public Skybox(SkyboxPainter painter) {
|
||||||
generateVertices();
|
generateVertices();
|
||||||
|
|
|
@ -13,7 +13,7 @@ public abstract class SkyboxPainter {
|
||||||
abstract int getTexelColour(float x, float y, float z);
|
abstract int getTexelColour(float x, float y, float z);
|
||||||
|
|
||||||
public float[] projectOnSphere(float x, float y, float z) {
|
public float[] projectOnSphere(float x, float y, float z) {
|
||||||
float invDistance = Mth.fastInvSqrt(x * x + y * y + z * z);
|
float invDistance = (float) Mth.fastInvSqrt(x * x + y * y + z * z);
|
||||||
|
|
||||||
//divide by distance to get projection on sphere (shorten the vector)
|
//divide by distance to get projection on sphere (shorten the vector)
|
||||||
x *= invDistance;
|
x *= invDistance;
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class Star {
|
||||||
this.g = color[1];
|
this.g = color[1];
|
||||||
this.b = color[2];
|
this.b = color[2];
|
||||||
|
|
||||||
float invsqrtDistance = Mth.fastInvSqrt(randX * randX + randY * randY + randZ * randZ);
|
float invsqrtDistance = (float) Mth.fastInvSqrt(randX * randX + randY * randY + randZ * randZ);
|
||||||
this.xCoord = randX * invsqrtDistance * 100.0F;
|
this.xCoord = randX * invsqrtDistance * 100.0F;
|
||||||
this.yCoord = randY * invsqrtDistance * 100.0F;
|
this.yCoord = randY * invsqrtDistance * 100.0F;
|
||||||
this.zCoord = randZ * invsqrtDistance * 100.0F;
|
this.zCoord = randZ * invsqrtDistance * 100.0F;
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.14.6",
|
"fabricloader": ">=0.14.6",
|
||||||
"minecraft": "1.19.3",
|
"minecraft": "1.20-rc.1",
|
||||||
"java": ">=17"
|
"java": ">=17"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue