Skip to content

Commit 0880778

Browse files
committed
Runs on 1.19, not thoroughly tested
1 parent 0460021 commit 0880778

File tree

12 files changed

+39
-38
lines changed

12 files changed

+39
-38
lines changed

common/src/main/java/grondag/darkness/Darkness.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import net.minecraft.client.Minecraft;
3333
import net.minecraft.client.multiplayer.ClientLevel;
3434
import net.minecraft.client.renderer.GameRenderer;
35+
import net.minecraft.client.renderer.LightTexture;
3536
import net.minecraft.resources.ResourceKey;
3637
import net.minecraft.util.Mth;
3738
import net.minecraft.world.effect.MobEffects;
@@ -220,7 +221,7 @@ public static void updateLuminance(float tickDelta, Minecraft client, GameRender
220221
float min = skyFactor * 0.05f;
221222
final float rawAmbient = ambient * skyFactor;
222223
final float minAmbient = rawAmbient * (1 - min) + min;
223-
final float skyBase = dim.brightness(skyIndex) * minAmbient;
224+
final float skyBase = LightTexture.getBrightness(dim, skyIndex) * minAmbient;
224225

225226
min = 0.35f * skyFactor;
226227
float skyRed = skyBase * (rawAmbient * (1 - min) + min);
@@ -242,7 +243,7 @@ public static void updateLuminance(float tickDelta, Minecraft client, GameRender
242243
blockFactor = 1 - blockFactor * blockFactor * blockFactor * blockFactor;
243244
}
244245

245-
final float blockBase = blockFactor * dim.brightness(blockIndex) * (prevFlicker * 0.1F + 1.5F);
246+
final float blockBase = blockFactor * LightTexture.getBrightness(dim, blockIndex) * (prevFlicker * 0.1F + 1.5F);
246247
min = 0.4f * blockFactor;
247248
final float blockGreen = blockBase * ((blockBase * (1 - min) + min) * (1 - min) + min);
248249
final float blockBlue = blockBase * (blockBase * blockBase * (1 - min) + min);
@@ -275,7 +276,7 @@ public static void updateLuminance(float tickDelta, Minecraft client, GameRender
275276
blue = 1.0F;
276277
}
277278

278-
final float gamma = (float) client.options.gamma * f;
279+
final float gamma = client.options.gamma().get().floatValue() * f;
279280
float invRed = 1.0F - red;
280281
float invGreen = 1.0F - green;
281282
float invBlue = 1.0F - blue;

common/src/main/java/grondag/darkness/DarknessConfigScreen.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import net.minecraft.client.gui.components.Checkbox;
2727
import net.minecraft.client.gui.screens.Screen;
2828
import net.minecraft.network.chat.CommonComponents;
29-
import net.minecraft.network.chat.TranslatableComponent;
29+
import net.minecraft.network.chat.Component;
3030

3131
public class DarknessConfigScreen extends Screen {
3232
protected final Screen parent;
@@ -40,7 +40,7 @@ public class DarknessConfigScreen extends Screen {
4040
protected Checkbox darkSkylessWidget;
4141

4242
public DarknessConfigScreen(Screen parent) {
43-
super(new TranslatableComponent("config.darkness.title"));
43+
super(Component.translatable("config.darkness.title"));
4444
this.parent = parent;
4545
}
4646

@@ -57,91 +57,91 @@ public void onClose() {
5757
@Override
5858
protected void init() {
5959
int i = 27;
60-
blockLightOnlyWidget = new Checkbox(width / 2 - 100, i, 200, 20, new TranslatableComponent("config.darkness.label.block_light_only"), Darkness.blockLightOnly) {
60+
blockLightOnlyWidget = new Checkbox(width / 2 - 100, i, 200, 20, Component.translatable("config.darkness.label.block_light_only"), Darkness.blockLightOnly) {
6161
@Override
6262
public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta) {
6363
super.renderButton(matrices, mouseX, mouseY, delta);
6464

6565
if (isHovered) {
66-
DarknessConfigScreen.this.renderTooltip(matrices, new TranslatableComponent("config.darkness.help.block_light_only"), mouseX, mouseY);
66+
DarknessConfigScreen.this.renderTooltip(matrices, Component.translatable("config.darkness.help.block_light_only"), mouseX, mouseY);
6767
}
6868
}
6969
};
7070

7171
i += 27;
7272

73-
ignoreMoonPhaseWidget = new Checkbox(width / 2 - 100, i, 200, 20, new TranslatableComponent("config.darkness.label.ignore_moon_phase"), Darkness.ignoreMoonPhase) {
73+
ignoreMoonPhaseWidget = new Checkbox(width / 2 - 100, i, 200, 20, Component.translatable("config.darkness.label.ignore_moon_phase"), Darkness.ignoreMoonPhase) {
7474
@Override
7575
public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta) {
7676
super.renderButton(matrices, mouseX, mouseY, delta);
7777

7878
if (isHovered) {
79-
DarknessConfigScreen.this.renderTooltip(matrices, new TranslatableComponent("config.darkness.help.ignore_moon_phase"), mouseX, mouseY);
79+
DarknessConfigScreen.this.renderTooltip(matrices, Component.translatable("config.darkness.help.ignore_moon_phase"), mouseX, mouseY);
8080
}
8181
}
8282
};
8383

8484
i += 27;
8585

86-
darkOverworldWidget = new Checkbox(width / 2 - 100, i, 200, 20, new TranslatableComponent("config.darkness.label.dark_overworld"), Darkness.darkOverworld) {
86+
darkOverworldWidget = new Checkbox(width / 2 - 100, i, 200, 20, Component.translatable("config.darkness.label.dark_overworld"), Darkness.darkOverworld) {
8787
@Override
8888
public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta) {
8989
super.renderButton(matrices, mouseX, mouseY, delta);
9090

9191
if (isHovered) {
92-
DarknessConfigScreen.this.renderTooltip(matrices, new TranslatableComponent("config.darkness.help.dark_overworld"), mouseX, mouseY);
92+
DarknessConfigScreen.this.renderTooltip(matrices, Component.translatable("config.darkness.help.dark_overworld"), mouseX, mouseY);
9393
}
9494
}
9595
};
9696

9797
i += 27;
9898

99-
darkNetherWidget = new Checkbox(width / 2 - 100, i, 200, 20, new TranslatableComponent("config.darkness.label.dark_nether"), Darkness.darkNether) {
99+
darkNetherWidget = new Checkbox(width / 2 - 100, i, 200, 20, Component.translatable("config.darkness.label.dark_nether"), Darkness.darkNether) {
100100
@Override
101101
public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta) {
102102
super.renderButton(matrices, mouseX, mouseY, delta);
103103

104104
if (isHovered) {
105-
DarknessConfigScreen.this.renderTooltip(matrices, new TranslatableComponent("config.darkness.help.dark_nether"), mouseX, mouseY);
105+
DarknessConfigScreen.this.renderTooltip(matrices, Component.translatable("config.darkness.help.dark_nether"), mouseX, mouseY);
106106
}
107107
}
108108
};
109109

110110
i += 27;
111111

112-
darkEndWidget = new Checkbox(width / 2 - 100, i, 200, 20, new TranslatableComponent("config.darkness.label.dark_end"), Darkness.darkEnd) {
112+
darkEndWidget = new Checkbox(width / 2 - 100, i, 200, 20, Component.translatable("config.darkness.label.dark_end"), Darkness.darkEnd) {
113113
@Override
114114
public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta) {
115115
super.renderButton(matrices, mouseX, mouseY, delta);
116116

117117
if (isHovered) {
118-
DarknessConfigScreen.this.renderTooltip(matrices, new TranslatableComponent("config.darkness.help.dark_end"), mouseX, mouseY);
118+
DarknessConfigScreen.this.renderTooltip(matrices, Component.translatable("config.darkness.help.dark_end"), mouseX, mouseY);
119119
}
120120
}
121121
};
122122

123123
i += 27;
124124

125-
darkDefaultWidget = new Checkbox(width / 2 - 100, i, 200, 20, new TranslatableComponent("config.darkness.label.dark_default"), Darkness.darkDefault) {
125+
darkDefaultWidget = new Checkbox(width / 2 - 100, i, 200, 20, Component.translatable("config.darkness.label.dark_default"), Darkness.darkDefault) {
126126
@Override
127127
public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta) {
128128
super.renderButton(matrices, mouseX, mouseY, delta);
129129

130130
if (isHovered) {
131-
DarknessConfigScreen.this.renderTooltip(matrices, new TranslatableComponent("config.darkness.help.dark_default"), mouseX, mouseY);
131+
DarknessConfigScreen.this.renderTooltip(matrices, Component.translatable("config.darkness.help.dark_default"), mouseX, mouseY);
132132
}
133133
}
134134
};
135135

136136
i += 27;
137137

138-
darkSkylessWidget = new Checkbox(width / 2 - 100, i, 200, 20, new TranslatableComponent("config.darkness.label.dark_skyless"), Darkness.darkSkyless) {
138+
darkSkylessWidget = new Checkbox(width / 2 - 100, i, 200, 20, Component.translatable("config.darkness.label.dark_skyless"), Darkness.darkSkyless) {
139139
@Override
140140
public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta) {
141141
super.renderButton(matrices, mouseX, mouseY, delta);
142142

143143
if (isHovered) {
144-
DarknessConfigScreen.this.renderTooltip(matrices, new TranslatableComponent("config.darkness.help.dark_skyless"), mouseX, mouseY);
144+
DarknessConfigScreen.this.renderTooltip(matrices, Component.translatable("config.darkness.help.dark_skyless"), mouseX, mouseY);
145145
}
146146
}
147147
};

common/src/main/resources/darkness.client.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"required": true,
33
"minVersion": "0.8",
44
"package": "grondag.darkness.mixin",
5-
"compatibilityLevel": "JAVA_16",
5+
"compatibilityLevel": "JAVA_17",
66
"mixins": [
77
"MixinGameRenderer",
88
"MixinLightTexture",

fabric/.checkstyle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
4-
<local-check-config name="local" location="/Users/grondag/1_17/darkness/checkstyle.xml" type="external" description="">
4+
<local-check-config name="local" location="/Users/grondag/1_19/darkness/checkstyle.xml" type="external" description="">
55
<additional-data name="protect-config-file" value="false"/>
66
</local-check-config>
77
<fileset name="all" enabled="true" check-config-name="local" local="true">

fabric/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// VRAM STANDARD GRADLE BUILD FOR FABRIC 1.18
1+
// VRAM STANDARD GRADLE BUILD FOR FABRIC 1.19
22
// DO NOT MAKE CHANGES HERE - THEY WILL BE OVERWRITTEN BY AUTOMATED UPDATE
33

44
buildscript {
@@ -8,7 +8,7 @@ buildscript {
88
}
99

1010
plugins {
11-
id 'fabric-loom' version '0.12.42'
11+
id 'fabric-loom' version '0.12.47'
1212
id 'maven-publish'
1313
id 'org.cadixdev.licenser' version '0.6.1'
1414
id 'org.ajoberstar.grgit' version '4.1.1'
@@ -19,7 +19,7 @@ plugins {
1919

2020
ext.platform_name = 'fabric'
2121
ext.loader_version = '0.14.6'
22-
ext.fabric_version = '0.53.4+1.18.2'
22+
ext.fabric_version = '0.55.0+1.19'
2323

2424
apply from: '../project_common.gradle'
2525
apply from: 'project.gradle'

fabric/project.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
dependencies {
22
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
33

4-
modCompileOnly "com.terraformersmc:modmenu:3.2.2"
5-
modRuntimeOnly "com.terraformersmc:modmenu:3.2.2"
4+
modCompileOnly "com.terraformersmc:modmenu:4.0.0-beta.4"
5+
modRuntimeOnly "com.terraformersmc:modmenu:4.0.0-beta.4"
66
}
77

88
sourceSets {

fabric/src/main/resources/fabric.mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
],
2727
"depends": {
2828
"fabricloader": ">=0.14.6",
29-
"minecraft": "1.18.2",
29+
"minecraft": ">=1.19-rc.2",
3030
"java": ">=17"
3131
}
3232
}

forge/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// VRAM STANDARD GRADLE BUILD FOR FORGE 1.18
1+
// VRAM STANDARD GRADLE BUILD FOR FORGE 1.19
22
// DO NOT MAKE CHANGES HERE - THEY WILL BE OVERWRITTEN BY AUTOMATED UPDATE
33

44
buildscript {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
#
4-
# Copyright © 2015-2021 the original authors.
4+
# Copyright © 2015-2021 the original authors.
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
@@ -32,10 +32,10 @@
3232
# Busybox and similar reduced shells will NOT work, because this script
3333
# requires all of these POSIX shell features:
3434
# * functions;
35-
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36-
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37-
# * compound commands having a testable exit status, especially «case»;
38-
# * various built-in commands including «command», «set», and «ulimit».
35+
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36+
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37+
# * compound commands having a testable exit status, especially «case»;
38+
# * various built-in commands including «command», «set», and «ulimit».
3939
#
4040
# Important for patching:
4141
#

gruntle.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
readonly MC_VERSION="1.18"
1+
readonly MC_VERSION="1.19"
22

33
echo "GRUNTLE REFRESH FOR $MC_VERSION - IF THIS IS NOT A $MC_VERSION BRANCH YOU HAVE DONE A BAD"
44

gruntle_common.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
ext.mc_tag = 'mc118'
2-
ext.minecraft_version = '1.18.2'
3-
ext.release_version = '1.18.2'
1+
ext.mc_tag = 'mc119'
2+
ext.minecraft_version = '1.19-rc2'
3+
ext.release_version = '1.19'
44

55
project.archivesBaseName = project.mod_name + "-" + project.platform_name + "-" + project.mc_tag
66

0 commit comments

Comments
 (0)