mirror of
https://github.com/TeamMidnightDust/CustomSplashScreen.git
synced 2025-12-13 06:35:09 +01:00
Port to 1.18
This commit is contained in:
14
build.gradle
14
build.gradle
@@ -1,10 +1,12 @@
|
||||
//file:noinspection GroovyAssignabilityCheck
|
||||
//file:noinspection GrDeprecatedAPIUsage
|
||||
plugins {
|
||||
id 'fabric-loom' version '0.8-SNAPSHOT'
|
||||
id 'fabric-loom' version '0.10-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_16
|
||||
targetCompatibility = JavaVersion.VERSION_16
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
|
||||
archivesBaseName = project.archives_base_name
|
||||
version = project.mod_version
|
||||
@@ -16,7 +18,7 @@ minecraft {
|
||||
repositories {
|
||||
maven { url "https://jitpack.io" }
|
||||
maven { url "https://maven.shedaniel.me/" }
|
||||
maven { url "https://maven.terraformersmc.com/" }
|
||||
maven { url "https://maven.terraformersmc.com/releases" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -31,9 +33,7 @@ dependencies {
|
||||
exclude(group: "net.fabricmc.fabric-api")
|
||||
}
|
||||
|
||||
modImplementation ("io.github.prospector:modmenu:${project.mod_menu_version}"){
|
||||
exclude(group: "net.fabricmc.fabric-api")
|
||||
}
|
||||
modImplementation "com.terraformersmc:modmenu:${project.mod_menu_version}"
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
||||
@@ -3,19 +3,19 @@ org.gradle.jvmargs=-Xmx1G
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/use
|
||||
minecraft_version=1.17.1
|
||||
yarn_mappings=1.17.1+build.10
|
||||
loader_version=0.11.6
|
||||
minecraft_version=1.18
|
||||
yarn_mappings=1.18+build.1
|
||||
loader_version=0.12.8
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.1.0
|
||||
mod_version = 2.0.0
|
||||
maven_group = eu.midnightdust
|
||||
archives_base_name = customsplashscreen
|
||||
|
||||
# Dependencies
|
||||
# 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
|
||||
cloth_config_version = 5.0.34
|
||||
mod_menu_version = 2.0.0-beta.1+build.2
|
||||
cloth_config_version = 6.0.42
|
||||
mod_menu_version = 3.0.0
|
||||
@@ -1,7 +1,7 @@
|
||||
package eu.midnightdust.customsplashscreen.config;
|
||||
|
||||
import io.github.prospector.modmenu.api.ConfigScreenFactory;
|
||||
import io.github.prospector.modmenu.api.ModMenuApi;
|
||||
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
||||
import com.terraformersmc.modmenu.api.ModMenuApi;
|
||||
import me.shedaniel.autoconfig.AutoConfig;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
@@ -68,10 +68,10 @@ public class SplashScreenMixin {
|
||||
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) {
|
||||
int i = this.client.getWindow().getScaledWidth();
|
||||
int j = this.client.getWindow().getScaledHeight();
|
||||
int width = this.client.getWindow().getScaledWidth();
|
||||
int height = this.client.getWindow().getScaledHeight();
|
||||
long l = Util.getMeasuringTimeMs();
|
||||
if (this.reloading && this.reloadStartTime == -1L) {
|
||||
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);
|
||||
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);
|
||||
} else if (this.reloading) {
|
||||
if (this.client.currentScreen != null && g < 1.0F) {
|
||||
this.client.currentScreen.render(matrices, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
m = MathHelper.ceil(MathHelper.clamp((double)g, 0.15D, 1.0D) * 255.0D);
|
||||
fill(matrices, 0, 0, i, j, withAlpha(m));
|
||||
m = MathHelper.ceil(MathHelper.clamp(g, 0.15D, 1.0D) * 255.0D);
|
||||
fill(matrices, 0, 0, width, height, withAlpha(m));
|
||||
s = MathHelper.clamp(g, 0.0F, 1.0F);
|
||||
} else {
|
||||
m = getBackgroundColor();
|
||||
@@ -111,7 +111,7 @@ public class SplashScreenMixin {
|
||||
|
||||
m = (int)((double)this.client.getWindow().getScaledWidth() * 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);
|
||||
double e = d * 4.0D;
|
||||
int w = (int)(e * 0.5D);
|
||||
@@ -124,7 +124,7 @@ public class SplashScreenMixin {
|
||||
RenderSystem.blendFunc(770, 1);
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
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.disableBlend();
|
||||
}
|
||||
@@ -152,7 +152,7 @@ public class SplashScreenMixin {
|
||||
float y = this.reload.getProgress();
|
||||
this.progress = MathHelper.clamp(this.progress * 0.95F + y * 0.050000012F, 0.0F, 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) {
|
||||
@@ -187,7 +187,7 @@ public class SplashScreenMixin {
|
||||
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) {
|
||||
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 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, 5f, i, (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), bbWidth, bbHeight);
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendEquation(32774);
|
||||
RenderSystem.blendFunc(770, 1);
|
||||
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.disableBlend();
|
||||
@@ -228,7 +228,7 @@ public class SplashScreenMixin {
|
||||
}
|
||||
RenderSystem.setShaderTexture(0, CUSTOM_PROGRESS_BAR_TEXTURE);
|
||||
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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "eu.midnightdust.customsplashscreen.mixin",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"client": [
|
||||
"SplashScreenMixin"
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user