mirror of
https://github.com/TeamMidnightDust/BlinkingSkinPort.git
synced 2025-12-16 10:45:09 +01:00
BlinkingSkinPort 2.1.0 - 1.17, MidnightConfig and Predicates
Updated the entire mod to 1.17 Migrate to MidnightConfig Add name predicate Add server blacklist
This commit is contained in:
64
build.gradle
Normal file → Executable file
64
build.gradle
Normal file → Executable file
@@ -1,10 +1,10 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '0.5-SNAPSHOT'
|
id 'fabric-loom' version '0.8-SNAPSHOT'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_16
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_16
|
||||||
|
|
||||||
archivesBaseName = project.archives_base_name
|
archivesBaseName = project.archives_base_name
|
||||||
version = project.mod_version
|
version = project.mod_version
|
||||||
@@ -14,52 +14,52 @@ minecraft {
|
|||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url "https://jitpack.io" }
|
maven {
|
||||||
|
url = "https://api.modrinth.com/maven"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
//to change the versions see the gradle.properties file
|
//to change the versions see the gradle.properties file
|
||||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||||
modCompile "net.fabricmc:fabric-loader:${project.loader_version}"
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||||
|
|
||||||
modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||||
|
modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}"
|
||||||
modImplementation ("me.sargunvohra.mcmods:autoconfig1u:${project.auto_config_version}")
|
include "maven.modrinth:midnightlib:${project.midnightlib_version}"
|
||||||
modImplementation ("me.shedaniel.cloth:config-2:${project.cloth_config_version}")
|
|
||||||
modImplementation ("io.github.prospector:modmenu:${project.mod_menu_version}")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
inputs.property "version", project.version
|
inputs.property "version", project.version
|
||||||
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
filesMatching("fabric.mod.json") {
|
||||||
include "fabric.mod.json"
|
|
||||||
expand "version": project.version
|
expand "version": project.version
|
||||||
}
|
}
|
||||||
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
|
||||||
exclude "fabric.mod.json"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
tasks.withType(JavaCompile).configureEach {
|
||||||
// this fixes some edge cases with special characters not displaying correctly
|
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
||||||
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
// this fixes some edge cases with special characters not displaying correctly
|
||||||
tasks.withType(JavaCompile) {
|
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
||||||
options.encoding = "UTF-8"
|
// If Javadoc is generated, this must be specified in that task too.
|
||||||
|
it.options.encoding = "UTF-8"
|
||||||
|
|
||||||
|
// Minecraft 1.17 (21w19a) upwards uses Java 16.
|
||||||
|
it.options.release = 16
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
java {
|
||||||
// if it is present.
|
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||||
// If you remove this task, sources will not be generated.
|
// if it is present.
|
||||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
// If you remove this line, sources will not be generated.
|
||||||
classifier = "sources"
|
withSourcesJar()
|
||||||
from sourceSets.main.allSource
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
from "LICENSE"
|
from("LICENSE") {
|
||||||
|
rename { "${it}_${project.archivesBaseName}"}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// configure the maven publication
|
// configure the maven publication
|
||||||
@@ -76,9 +76,11 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// select the repositories you want to publish to
|
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
||||||
repositories {
|
repositories {
|
||||||
// uncomment to publish to the local maven
|
// Add repositories to publish to here.
|
||||||
// mavenLocal()
|
// Notice: This block does NOT have the same function as the block in the top level.
|
||||||
|
// The repositories here will be used for publishing your artifact, not for
|
||||||
|
// retrieving dependencies.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
15
gradle.properties
Normal file → Executable file
15
gradle.properties
Normal file → Executable file
@@ -3,19 +3,16 @@ 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.16.4
|
minecraft_version=1.17.1
|
||||||
yarn_mappings=1.16.4+build.7
|
yarn_mappings=1.17.1+build.61
|
||||||
loader_version=0.10.8
|
loader_version=0.11.7
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 2.0.0
|
mod_version = 2.1.0
|
||||||
maven_group = eu.midnightdust
|
maven_group = eu.midnightdust
|
||||||
archives_base_name = blinkingskinport
|
archives_base_name = blinkingskinport
|
||||||
|
|
||||||
# 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.26.1+1.16
|
fabric_version=0.40.1+1.17
|
||||||
|
midnightlib_version=0.2.5
|
||||||
auto_config_version = 3.2.0-unstable
|
|
||||||
cloth_config_version = 4.7.0-unstable
|
|
||||||
mod_menu_version = 1.14.6+build.31
|
|
||||||
|
|||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file → Executable file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file → Executable file
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file → Executable file
2
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file → Executable file
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
35
gradlew
vendored
Normal file → Executable file
35
gradlew
vendored
Normal file → Executable file
@@ -82,6 +82,7 @@ esac
|
|||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
@@ -125,10 +126,11 @@ if $darwin; then
|
|||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
if $cygwin ; then
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
@@ -154,19 +156,19 @@ if $cygwin ; then
|
|||||||
else
|
else
|
||||||
eval `echo args$i`="\"$arg\""
|
eval `echo args$i`="\"$arg\""
|
||||||
fi
|
fi
|
||||||
i=$((i+1))
|
i=`expr $i + 1`
|
||||||
done
|
done
|
||||||
case $i in
|
case $i in
|
||||||
(0) set -- ;;
|
0) set -- ;;
|
||||||
(1) set -- "$args0" ;;
|
1) set -- "$args0" ;;
|
||||||
(2) set -- "$args0" "$args1" ;;
|
2) set -- "$args0" "$args1" ;;
|
||||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -175,14 +177,9 @@ save () {
|
|||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
echo " "
|
echo " "
|
||||||
}
|
}
|
||||||
APP_ARGS=$(save "$@")
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|||||||
25
gradlew.bat
vendored
Normal file → Executable file
25
gradlew.bat
vendored
Normal file → Executable file
@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
|||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
@@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
@@ -51,7 +54,7 @@ goto fail
|
|||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
@@ -61,28 +64,14 @@ echo location of your Java installation.
|
|||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:init
|
|
||||||
@rem Get command-line arguments, handling Windows variants
|
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
|
|
||||||
:win9xME_args
|
|
||||||
@rem Slurp the command line arguments.
|
|
||||||
set CMD_LINE_ARGS=
|
|
||||||
set _SKIP=2
|
|
||||||
|
|
||||||
:win9xME_args_slurp
|
|
||||||
if "x%~1" == "x" goto execute
|
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
|||||||
16
src/main/java/eu/midnightdust/blinkingskinport/BlinkingSkinClient.java
Normal file → Executable file
16
src/main/java/eu/midnightdust/blinkingskinport/BlinkingSkinClient.java
Normal file → Executable file
@@ -1,8 +1,7 @@
|
|||||||
package eu.midnightdust.blinkingskinport;
|
package eu.midnightdust.blinkingskinport;
|
||||||
|
|
||||||
import eu.midnightdust.blinkingskinport.config.BlinkingSkinConfig;
|
import eu.midnightdust.blinkingskinport.config.BlinkingSkinConfig;
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
import eu.midnightdust.blinkingskinport.mixin.GameOptionsAccessor;
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.serializer.JanksonConfigSerializer;
|
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||||
import net.minecraft.client.render.entity.PlayerModelPart;
|
import net.minecraft.client.render.entity.PlayerModelPart;
|
||||||
@@ -12,29 +11,28 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class BlinkingSkinClient implements ClientModInitializer {
|
public class BlinkingSkinClient implements ClientModInitializer {
|
||||||
|
|
||||||
public static BlinkingSkinConfig BS_CONFIG;
|
|
||||||
private final Map<PlayerModelPart, Integer> intervals = new HashMap<>();
|
private final Map<PlayerModelPart, Integer> intervals = new HashMap<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
AutoConfig.register(BlinkingSkinConfig.class, JanksonConfigSerializer::new);
|
BlinkingSkinConfig.init("blinkingskinport",BlinkingSkinConfig.class);
|
||||||
BS_CONFIG = AutoConfig.getConfigHolder(BlinkingSkinConfig.class).getConfig();
|
|
||||||
|
|
||||||
for (PlayerModelPart part : PlayerModelPart.values()) {
|
for (PlayerModelPart part : PlayerModelPart.values()) {
|
||||||
this.intervals.put(part, 0);
|
this.intervals.put(part, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||||
if (BS_CONFIG.enabled) {
|
if (BlinkingSkinConfig.enabled && (BlinkingSkinConfig.player.equals("") || client.getSession().getUsername().equals(BlinkingSkinConfig.player))) {
|
||||||
|
if (client.getCurrentServerEntry() != null && BlinkingSkinConfig.isBlacklisted(client.getCurrentServerEntry().address)) return;
|
||||||
for (Map.Entry<PlayerModelPart,Integer> interval : this.intervals.entrySet()) {
|
for (Map.Entry<PlayerModelPart,Integer> interval : this.intervals.entrySet()) {
|
||||||
if (!BS_CONFIG.isEnabled(interval.getKey())) {
|
if (!BlinkingSkinConfig.isEnabled(interval.getKey())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int counter = this.intervals.get(interval.getKey());
|
int counter = this.intervals.get(interval.getKey());
|
||||||
if (counter++ >= BS_CONFIG.getToggleInterval(interval.getKey())) {
|
if (counter++ >= BlinkingSkinConfig.getToggleInterval(interval.getKey())) {
|
||||||
this.intervals.put(interval.getKey(), 0);
|
this.intervals.put(interval.getKey(), 0);
|
||||||
client.options.togglePlayerModelPart(interval.getKey());
|
client.options.togglePlayerModelPart(interval.getKey(), !((GameOptionsAccessor)client.options).getEnabledPlayerModelParts().contains(interval.getKey()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.intervals.put(interval.getKey(), counter);
|
this.intervals.put(interval.getKey(), counter);
|
||||||
|
|||||||
125
src/main/java/eu/midnightdust/blinkingskinport/config/BlinkingSkinConfig.java
Normal file → Executable file
125
src/main/java/eu/midnightdust/blinkingskinport/config/BlinkingSkinConfig.java
Normal file → Executable file
@@ -1,91 +1,62 @@
|
|||||||
package eu.midnightdust.blinkingskinport.config;
|
package eu.midnightdust.blinkingskinport.config;
|
||||||
|
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.ConfigData;
|
import eu.midnightdust.lib.config.MidnightConfig;
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.annotation.Config;
|
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.annotation.ConfigEntry;
|
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.shadowed.blue.endless.jankson.Comment;
|
|
||||||
import net.minecraft.client.render.entity.PlayerModelPart;
|
import net.minecraft.client.render.entity.PlayerModelPart;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Config(name = "blinkingskinport")
|
public class BlinkingSkinConfig extends MidnightConfig {
|
||||||
public class BlinkingSkinConfig implements ConfigData {
|
|
||||||
|
|
||||||
@ConfigEntry.Gui.PrefixText // Blink Intervals lower than 5 are disabled, because they can be used to trigger epileptic episodes, which isn't fun for affected people!
|
@Entry public static boolean enabled = false;
|
||||||
public boolean enabled = false;
|
|
||||||
|
|
||||||
@ConfigEntry.Gui.PrefixText
|
@Entry public static String player = ""; // Optional: Only enable the mod when the name matches the currently active account. Useful for users with multiple minecraft accounts
|
||||||
public boolean capeEnabled = true;
|
@Entry public static String server_blacklist = ""; // Blacklist servers. Seperate with ";"
|
||||||
@ConfigEntry.BoundedDiscrete(min = 5, max = 200)
|
|
||||||
@Comment("(20 ticks = 1 second)")
|
|
||||||
public int capeBlinkInterval = 20;
|
|
||||||
public boolean hatEnabled = true;
|
|
||||||
@ConfigEntry.BoundedDiscrete(min = 5, max = 200)
|
|
||||||
@Comment("(20 ticks = 1 second)")
|
|
||||||
public int hatBlinkInterval = 20;
|
|
||||||
public boolean jacketEnabled = true;
|
|
||||||
@ConfigEntry.BoundedDiscrete(min = 5, max = 200)
|
|
||||||
@Comment("(20 ticks = 1 second)")
|
|
||||||
public int jacketBlinkInterval = 20;
|
|
||||||
public boolean leftSleeveEnabled = true;
|
|
||||||
@ConfigEntry.BoundedDiscrete(min = 5, max = 200)
|
|
||||||
@Comment("(20 ticks = 1 second)")
|
|
||||||
public int leftSleeveBlinkInterval = 20;
|
|
||||||
public boolean rightSleeveEnabled = true;
|
|
||||||
@ConfigEntry.BoundedDiscrete(min = 5, max = 200)
|
|
||||||
@Comment("(20 ticks = 1 second)")
|
|
||||||
public int rightSleeveBlinkInterval = 20;
|
|
||||||
public boolean leftPantsLegEnabled = true;
|
|
||||||
@ConfigEntry.BoundedDiscrete(min = 5, max = 200)
|
|
||||||
@Comment("(20 ticks = 1 second)")
|
|
||||||
public int leftPantsLegBlinkInterval = 20;
|
|
||||||
public boolean rightPantsLegEnabled = true;
|
|
||||||
@ConfigEntry.BoundedDiscrete(min = 5, max = 200)
|
|
||||||
@Comment("(20 ticks = 1 second)")
|
|
||||||
public int rightPantsLegBlinkInterval = 20;
|
|
||||||
|
|
||||||
|
@Comment public static Comment spacer;
|
||||||
|
@Entry public static boolean capeEnabled = true;
|
||||||
|
@Entry public static boolean hatEnabled = true;
|
||||||
|
@Entry public static boolean jacketEnabled = true;
|
||||||
|
@Entry public static boolean leftSleeveEnabled = true;
|
||||||
|
@Entry public static boolean rightSleeveEnabled = true;
|
||||||
|
@Entry public static boolean leftPantsLegEnabled = true;
|
||||||
|
@Entry public static boolean rightPantsLegEnabled = true;
|
||||||
|
@Comment public static Comment spacer2;
|
||||||
|
@Comment public static Comment disclaimer; // Blink Intervals lower than 5 are disabled, because they can be used to trigger epileptic episodes, which isn't fun for affected people!
|
||||||
|
@Comment public static Comment disclaimer2;
|
||||||
|
@Entry(min = 5, max = 1000) public static int capeBlinkInterval = 20;
|
||||||
|
@Entry(min = 5, max = 1000) public static int hatBlinkInterval = 20;
|
||||||
|
@Entry(min = 5, max = 1000) public static int jacketBlinkInterval = 20;
|
||||||
|
@Entry(min = 5, max = 1000) public static int leftSleeveBlinkInterval = 20;
|
||||||
|
@Entry(min = 5, max = 1000) public static int rightSleeveBlinkInterval = 20;
|
||||||
|
@Entry(min = 5, max = 1000) public static int leftPantsLegBlinkInterval = 20;
|
||||||
|
@Entry(min = 5, max = 1000) public static int rightPantsLegBlinkInterval = 20;
|
||||||
|
|
||||||
public boolean isEnabled(PlayerModelPart part) {
|
public static boolean isEnabled(PlayerModelPart part) {
|
||||||
switch (part) {
|
return switch (part) {
|
||||||
case HAT:
|
case HAT -> hatEnabled;
|
||||||
return hatEnabled;
|
case CAPE -> capeEnabled;
|
||||||
case CAPE:
|
case JACKET -> jacketEnabled;
|
||||||
return capeEnabled;
|
case LEFT_SLEEVE -> leftSleeveEnabled;
|
||||||
case JACKET:
|
case RIGHT_SLEEVE -> rightSleeveEnabled;
|
||||||
return jacketEnabled;
|
case LEFT_PANTS_LEG -> leftPantsLegEnabled;
|
||||||
case LEFT_SLEEVE:
|
case RIGHT_PANTS_LEG -> rightPantsLegEnabled;
|
||||||
return leftSleeveEnabled;
|
};
|
||||||
case RIGHT_SLEEVE:
|
|
||||||
return rightSleeveEnabled;
|
|
||||||
case LEFT_PANTS_LEG:
|
|
||||||
return leftPantsLegEnabled;
|
|
||||||
case RIGHT_PANTS_LEG:
|
|
||||||
return rightPantsLegEnabled;
|
|
||||||
default:
|
|
||||||
throw new AssertionError("Could not get value for " + part);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getToggleInterval(PlayerModelPart part) {
|
public static int getToggleInterval(PlayerModelPart part) {
|
||||||
switch (part) {
|
return switch (part) {
|
||||||
case HAT:
|
case HAT -> hatBlinkInterval;
|
||||||
return hatBlinkInterval;
|
case CAPE -> capeBlinkInterval;
|
||||||
case CAPE:
|
case JACKET -> jacketBlinkInterval;
|
||||||
return capeBlinkInterval;
|
case LEFT_SLEEVE -> leftSleeveBlinkInterval;
|
||||||
case JACKET:
|
case RIGHT_SLEEVE -> rightSleeveBlinkInterval;
|
||||||
return jacketBlinkInterval;
|
case LEFT_PANTS_LEG -> leftPantsLegBlinkInterval;
|
||||||
case LEFT_SLEEVE:
|
case RIGHT_PANTS_LEG -> rightPantsLegBlinkInterval;
|
||||||
return leftSleeveBlinkInterval;
|
};
|
||||||
case RIGHT_SLEEVE:
|
}
|
||||||
return rightSleeveBlinkInterval;
|
public static boolean isBlacklisted(String address) {
|
||||||
case LEFT_PANTS_LEG:
|
if (server_blacklist.isBlank()) return false;
|
||||||
return leftPantsLegBlinkInterval;
|
return Arrays.stream(server_blacklist.split(";")).anyMatch(ip -> ip.contains(address));
|
||||||
case RIGHT_PANTS_LEG:
|
|
||||||
return rightPantsLegBlinkInterval;
|
|
||||||
default:
|
|
||||||
throw new AssertionError("Could not get interval for " + part);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package eu.midnightdust.blinkingskinport.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.client.option.GameOptions;
|
||||||
|
import net.minecraft.client.render.entity.PlayerModelPart;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
@Mixin(GameOptions.class)
|
||||||
|
public interface GameOptionsAccessor {
|
||||||
|
@Accessor
|
||||||
|
Set<PlayerModelPart> getEnabledPlayerModelParts();
|
||||||
|
}
|
||||||
49
src/main/resources/assets/blinkingskinport/lang/en_us.json
Normal file → Executable file
49
src/main/resources/assets/blinkingskinport/lang/en_us.json
Normal file → Executable file
@@ -1,23 +1,36 @@
|
|||||||
{
|
{
|
||||||
"text.autoconfig.blinkingskinport.title":"BlinkingSkinPort Config",
|
"blinkingskinport.midnightconfig.title":"BlinkingSkinPort Config",
|
||||||
|
|
||||||
"text.autoconfig.blinkingskinport.option.enabled":"Enable Mod",
|
"blinkingskinport.midnightconfig.enabled":"Enable Mod",
|
||||||
|
"blinkingskinport.midnightconfig.player":"Enabled Account Name",
|
||||||
|
"blinkingskinport.midnightconfig.player.tooltip":"Optional. For multi-account users.",
|
||||||
|
"blinkingskinport.midnightconfig.server_blacklist":"Server Blacklist",
|
||||||
|
"blinkingskinport.midnightconfig.server_blacklist.tooltip":"Optional. Separate entries with Semicolon [ ; ]",
|
||||||
|
|
||||||
"text.autoconfig.blinkingskinport.option.capeEnabled.@PrefixText":" ",
|
"blinkingskinport.midnightconfig.spacer":"",
|
||||||
"text.autoconfig.blinkingskinport.option.capeEnabled":"Blink Cape",
|
"blinkingskinport.midnightconfig.capeEnabled":"Blink Cape",
|
||||||
"text.autoconfig.blinkingskinport.option.hatEnabled":"Blink Hat",
|
"blinkingskinport.midnightconfig.hatEnabled":"Blink Hat",
|
||||||
"text.autoconfig.blinkingskinport.option.jacketEnabled":"Blink Jacket",
|
"blinkingskinport.midnightconfig.jacketEnabled":"Blink Jacket",
|
||||||
"text.autoconfig.blinkingskinport.option.leftSleeveEnabled":"Blink Left Sleeve",
|
"blinkingskinport.midnightconfig.leftSleeveEnabled":"Blink Left Sleeve",
|
||||||
"text.autoconfig.blinkingskinport.option.rightSleeveEnabled":"Blink Right Sleeve",
|
"blinkingskinport.midnightconfig.rightSleeveEnabled":"Blink Right Sleeve",
|
||||||
"text.autoconfig.blinkingskinport.option.leftPantsLegEnabled":"Blink Left Pants",
|
"blinkingskinport.midnightconfig.leftPantsLegEnabled":"Blink Left Pants",
|
||||||
"text.autoconfig.blinkingskinport.option.rightPantsLegEnabled":"Blink Right Pants",
|
"blinkingskinport.midnightconfig.rightPantsLegEnabled":"Blink Right Pants",
|
||||||
|
|
||||||
"text.autoconfig.blinkingskinport.option.enabled.@PrefixText":"§cBlink Intervals lower than 5 are disabled, because they can be used to trigger epileptic episodes, which isn't fun for affected people!",
|
"blinkingskinport.midnightconfig.spacer2":"",
|
||||||
"text.autoconfig.blinkingskinport.option.capeBlinkInterval":"Cape Blink Interval",
|
"blinkingskinport.midnightconfig.disclaimer":"§cBlink Intervals lower than 5 are disabled, because they could",
|
||||||
"text.autoconfig.blinkingskinport.option.hatBlinkInterval":"Hat Blink Interval",
|
"blinkingskinport.midnightconfig.disclaimer2":"§ctrigger epileptic seizures, which isn't fun for affected people!",
|
||||||
"text.autoconfig.blinkingskinport.option.jacketBlinkInterval":"Jacket Blink Interval",
|
"blinkingskinport.midnightconfig.capeBlinkInterval":"Cape Blink Interval",
|
||||||
"text.autoconfig.blinkingskinport.option.leftSleeveBlinkInterval":"Left Sleeve Blink Interval",
|
"blinkingskinport.midnightconfig.capeBlinkInterval.tooltip":"§2(20 ticks = 1 second)",
|
||||||
"text.autoconfig.blinkingskinport.option.rightSleeveBlinkInterval":"Right Sleeve Blink Interval",
|
"blinkingskinport.midnightconfig.hatBlinkInterval":"Hat Blink Interval",
|
||||||
"text.autoconfig.blinkingskinport.option.leftPantsLegBlinkInterval":"Left Pants Blink Interval",
|
"blinkingskinport.midnightconfig.hatBlinkInterval.tooltip":"§2(20 ticks = 1 second)",
|
||||||
"text.autoconfig.blinkingskinport.option.rightPantsLegBlinkInterval":"Right Pants Blink Interval"
|
"blinkingskinport.midnightconfig.jacketBlinkInterval":"Jacket Blink Interval",
|
||||||
|
"blinkingskinport.midnightconfig.jacketBlinkInterval.tooltip":"§2(20 ticks = 1 second)",
|
||||||
|
"blinkingskinport.midnightconfig.leftSleeveBlinkInterval":"Left Sleeve Blink Interval",
|
||||||
|
"blinkingskinport.midnightconfig.leftSleeveBlinkInterval.tooltip":"§2(20 ticks = 1 second)",
|
||||||
|
"blinkingskinport.midnightconfig.rightSleeveBlinkInterval":"Right Sleeve Blink Interval",
|
||||||
|
"blinkingskinport.midnightconfig.rightSleeveBlinkInterval.tooltip":"§2(20 ticks = 1 second)",
|
||||||
|
"blinkingskinport.midnightconfig.leftPantsLegBlinkInterval":"Left Pants Blink Interval",
|
||||||
|
"blinkingskinport.midnightconfig.leftPantsLegBlinkInterval.tooltip":"§2(20 ticks = 1 second)",
|
||||||
|
"blinkingskinport.midnightconfig.rightPantsLegBlinkInterval":"Right Pants Blink Interval",
|
||||||
|
"blinkingskinport.midnightconfig.rightPantsLegBlinkInterval.tooltip":"§2(20 ticks = 1 second)"
|
||||||
}
|
}
|
||||||
11
src/main/resources/blinkingskinport.mixins.json
Executable file
11
src/main/resources/blinkingskinport.mixins.json
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"required": true,
|
||||||
|
"package": "eu.midnightdust.blinkingskinport.mixin",
|
||||||
|
"compatibilityLevel": "JAVA_8",
|
||||||
|
"client": [
|
||||||
|
"GameOptionsAccessor"
|
||||||
|
],
|
||||||
|
"injectors": {
|
||||||
|
"defaultRequire": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
10
src/main/resources/fabric.mod.json
Normal file → Executable file
10
src/main/resources/fabric.mod.json
Normal file → Executable file
@@ -22,13 +22,13 @@
|
|||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"client": [
|
"client": [
|
||||||
"eu.midnightdust.blinkingskinport.BlinkingSkinClient"
|
"eu.midnightdust.blinkingskinport.BlinkingSkinClient"
|
||||||
],
|
|
||||||
"modmenu": [
|
|
||||||
"eu.midnightdust.blinkingskinport.config.ModMenuIntegration"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabric": "*"
|
"midnightlib": "*"
|
||||||
}
|
},
|
||||||
|
"mixins": [
|
||||||
|
"blinkingskinport.mixins.json"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user