Port to 1.18

This commit is contained in:
jmb05
2021-12-07 16:57:56 +01:00
parent 3640561cb6
commit e9f49fbf01
5 changed files with 31 additions and 31 deletions

View File

@@ -1,10 +1,12 @@
//file:noinspection GroovyAssignabilityCheck
//file:noinspection GrDeprecatedAPIUsage
plugins { plugins {
id 'fabric-loom' version '0.8-SNAPSHOT' id 'fabric-loom' version '0.10-SNAPSHOT'
id 'maven-publish' id 'maven-publish'
} }
sourceCompatibility = JavaVersion.VERSION_16 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_16 targetCompatibility = JavaVersion.VERSION_17
archivesBaseName = project.archives_base_name archivesBaseName = project.archives_base_name
version = project.mod_version version = project.mod_version
@@ -16,7 +18,7 @@ minecraft {
repositories { repositories {
maven { url "https://jitpack.io" } maven { url "https://jitpack.io" }
maven { url "https://maven.shedaniel.me/" } maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.terraformersmc.com/" } maven { url "https://maven.terraformersmc.com/releases" }
} }
dependencies { dependencies {
@@ -31,9 +33,7 @@ dependencies {
exclude(group: "net.fabricmc.fabric-api") exclude(group: "net.fabricmc.fabric-api")
} }
modImplementation ("io.github.prospector:modmenu:${project.mod_menu_version}"){ modImplementation "com.terraformersmc:modmenu:${project.mod_menu_version}"
exclude(group: "net.fabricmc.fabric-api")
}
} }
processResources { processResources {

View File

@@ -3,19 +3,19 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/use # check these on https://fabricmc.net/use
minecraft_version=1.17.1 minecraft_version=1.18
yarn_mappings=1.17.1+build.10 yarn_mappings=1.18+build.1
loader_version=0.11.6 loader_version=0.12.8
# Mod Properties # Mod Properties
mod_version = 1.1.0 mod_version = 2.0.0
maven_group = eu.midnightdust maven_group = eu.midnightdust
archives_base_name = customsplashscreen archives_base_name = customsplashscreen
# Dependencies # Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.36.1+1.17 fabric_version=0.44.0+1.18
auto_config_version = 3.3.1 auto_config_version = 3.3.1
cloth_config_version = 5.0.34 cloth_config_version = 6.0.42
mod_menu_version = 2.0.0-beta.1+build.2 mod_menu_version = 3.0.0

View File

@@ -1,7 +1,7 @@
package eu.midnightdust.customsplashscreen.config; package eu.midnightdust.customsplashscreen.config;
import io.github.prospector.modmenu.api.ConfigScreenFactory; import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import io.github.prospector.modmenu.api.ModMenuApi; import com.terraformersmc.modmenu.api.ModMenuApi;
import me.shedaniel.autoconfig.AutoConfig; import me.shedaniel.autoconfig.AutoConfig;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;

View File

@@ -68,10 +68,10 @@ public class SplashScreenMixin {
ci.cancel(); ci.cancel();
} }
@Inject(at = @At("TAIL"), method = "render", cancellable = false) @Inject(at = @At("TAIL"), method = "render")
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { public void render(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
int i = this.client.getWindow().getScaledWidth(); int width = this.client.getWindow().getScaledWidth();
int j = this.client.getWindow().getScaledHeight(); int height = this.client.getWindow().getScaledHeight();
long l = Util.getMeasuringTimeMs(); long l = Util.getMeasuringTimeMs();
if (this.reloading && this.reloadStartTime == -1L) { if (this.reloading && this.reloadStartTime == -1L) {
this.reloadStartTime = l; this.reloadStartTime = l;
@@ -89,15 +89,15 @@ public class SplashScreenMixin {
} }
m = MathHelper.ceil((1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F)) * 255.0F); m = MathHelper.ceil((1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F)) * 255.0F);
fill(matrices, 0, 0, i, j, withAlpha(m)); fill(matrices, 0, 0, width, height, withAlpha(m));
s = 1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F); s = 1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F);
} else if (this.reloading) { } else if (this.reloading) {
if (this.client.currentScreen != null && g < 1.0F) { if (this.client.currentScreen != null && g < 1.0F) {
this.client.currentScreen.render(matrices, mouseX, mouseY, delta); this.client.currentScreen.render(matrices, mouseX, mouseY, delta);
} }
m = MathHelper.ceil(MathHelper.clamp((double)g, 0.15D, 1.0D) * 255.0D); m = MathHelper.ceil(MathHelper.clamp(g, 0.15D, 1.0D) * 255.0D);
fill(matrices, 0, 0, i, j, withAlpha(m)); fill(matrices, 0, 0, width, height, withAlpha(m));
s = MathHelper.clamp(g, 0.0F, 1.0F); s = MathHelper.clamp(g, 0.0F, 1.0F);
} else { } else {
m = getBackgroundColor(); m = getBackgroundColor();
@@ -111,7 +111,7 @@ public class SplashScreenMixin {
m = (int)((double)this.client.getWindow().getScaledWidth() * 0.5D); m = (int)((double)this.client.getWindow().getScaledWidth() * 0.5D);
int u = (int)((double)this.client.getWindow().getScaledHeight() * 0.5D); int u = (int)((double)this.client.getWindow().getScaledHeight() * 0.5D);
double d = Math.min((double)this.client.getWindow().getScaledWidth() * 0.75D, (double)this.client.getWindow().getScaledHeight()) * 0.25D; double d = Math.min((double)this.client.getWindow().getScaledWidth() * 0.75D, this.client.getWindow().getScaledHeight()) * 0.25D;
int v = (int)(d * 0.5D); int v = (int)(d * 0.5D);
double e = d * 4.0D; double e = d * 4.0D;
int w = (int)(e * 0.5D); int w = (int)(e * 0.5D);
@@ -124,7 +124,7 @@ public class SplashScreenMixin {
RenderSystem.blendFunc(770, 1); RenderSystem.blendFunc(770, 1);
RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, s); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, s);
drawTexture(matrices, 0, 0, 0, 0, 0, i, j, j, i); drawTexture(matrices, 0, 0, 0, 0, 0, width, height, width, height);
RenderSystem.defaultBlendFunc(); RenderSystem.defaultBlendFunc();
RenderSystem.disableBlend(); RenderSystem.disableBlend();
} }
@@ -152,7 +152,7 @@ public class SplashScreenMixin {
float y = this.reload.getProgress(); float y = this.reload.getProgress();
this.progress = MathHelper.clamp(this.progress * 0.95F + y * 0.050000012F, 0.0F, 1.0F); this.progress = MathHelper.clamp(this.progress * 0.95F + y * 0.050000012F, 0.0F, 1.0F);
if (f < 1.0F) { if (f < 1.0F) {
this.renderProgressBar(matrices, i / 2 - w, x - 5, i / 2 + w, x + 5, 1.0F - MathHelper.clamp(f, 0.0F, 1.0F), null); this.renderProgressBar(matrices, width / 2 - w, x - 5, width / 2 + w, x + 5, 1.0F - MathHelper.clamp(f, 0.0F, 1.0F), null);
} }
if (f >= 2.0F) { if (f >= 2.0F) {
@@ -187,7 +187,7 @@ public class SplashScreenMixin {
return getBackgroundColor() | alpha << 24; return getBackgroundColor() | alpha << 24;
} }
@Inject(at = @At("TAIL"), method = "renderProgressBar", cancellable = false) @Inject(at = @At("TAIL"), method = "renderProgressBar")
private void renderProgressBar(MatrixStack matrices, int x1, int y1, int x2, int y2, float opacity, CallbackInfo ci) { private void renderProgressBar(MatrixStack matrices, int x1, int y1, int x2, int y2, float opacity, CallbackInfo ci) {
int i = MathHelper.ceil((float)(x2 - x1 - 2) * this.progress); int i = MathHelper.ceil((float)(x2 - x1 - 2) * this.progress);
@@ -205,14 +205,14 @@ public class SplashScreenMixin {
int bbWidth = (int) ((x2 - x1+1) * 1.4f); int bbWidth = (int) ((x2 - x1+1) * 1.4f);
int bbHeight = (y2 - y1) * 30; int bbHeight = (y2 - y1) * 30;
drawTexture(matrices, x1, y1 + 1, 0, 0, 0, x2 - x1, (int) ((y2-y1) / 1.4f), bbHeight, bbWidth); drawTexture(matrices, x1, y1 + 1, 0, 0, 0, x2 - x1, (int) ((y2-y1) / 1.4f), bbWidth, bbHeight);
drawTexture(matrices, x1, y1 + 1, 0, 0, 5f, i, (int) ((y2 - y1) / 1.4f), bbHeight, bbWidth); drawTexture(matrices, x1, y1 + 1, 0, 0, 5f, i, (int) ((y2 - y1) / 1.4f), bbWidth, bbHeight);
RenderSystem.enableBlend(); RenderSystem.enableBlend();
RenderSystem.blendEquation(32774); RenderSystem.blendEquation(32774);
RenderSystem.blendFunc(770, 1); RenderSystem.blendFunc(770, 1);
if (overlay != 0) { if (overlay != 0) {
drawTexture(matrices, x1, y1 + 1, 0, 0, overlay, x2 - x1, (int) ((y2 - y1) / 1.4f), bbHeight, bbWidth); drawTexture(matrices, x1, y1 + 1, 0, 0, overlay, x2 - x1, (int) ((y2 - y1) / 1.4f), bbWidth, bbHeight);
} }
RenderSystem.defaultBlendFunc(); RenderSystem.defaultBlendFunc();
RenderSystem.disableBlend(); RenderSystem.disableBlend();
@@ -228,7 +228,7 @@ public class SplashScreenMixin {
} }
RenderSystem.setShaderTexture(0, CUSTOM_PROGRESS_BAR_TEXTURE); RenderSystem.setShaderTexture(0, CUSTOM_PROGRESS_BAR_TEXTURE);
RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShader(GameRenderer::getPositionTexShader);
drawTexture(matrices, x1, y1, 0, 0, 6, i, y2 - y1, 10, customWidth); drawTexture(matrices, x1, y1, 0, 0, 6, i, y2 - y1, customWidth, 10);
} }
// Vanilla / With Color progress bar // Vanilla / With Color progress bar

View File

@@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "eu.midnightdust.customsplashscreen.mixin", "package": "eu.midnightdust.customsplashscreen.mixin",
"compatibilityLevel": "JAVA_8", "compatibilityLevel": "JAVA_17",
"client": [ "client": [
"SplashScreenMixin" "SplashScreenMixin"
], ],