diff --git a/build.gradle b/build.gradle index eb45563..c9aaea2 100755 --- a/build.gradle +++ b/build.gradle @@ -138,6 +138,7 @@ dependencies { modImplementation ("maven.modrinth:cit-resewn:${project.cit_resewn_version}") modImplementation ("maven.modrinth:continuity:${project.continuity_version}") modImplementation ("maven.modrinth:animatica:${project.animatica_version}") + modImplementation ("maven.modrinth:entitytexturefeatures:${project.entitytexturefeatures_version}") modImplementation ("curse.maven:custom-entity-models-cem-477078:${project.cem_version}") modImplementation "com.gitlab.Lortseam:completeconfig:${project.complete_config_version}" diff --git a/gradle.properties b/gradle.properties index 72bf499..f1b6023 100755 --- a/gradle.properties +++ b/gradle.properties @@ -5,10 +5,10 @@ org.gradle.jvmargs=-Xmx1G # check these on https://fabricmc.net/use minecraft_version=1.18.1 yarn_mappings=1.18.1+build.14 - loader_version=0.12.12 + loader_version=0.13.3 # Mod Properties - mod_version = 1.1.0 + mod_version = 1.2.0 maven_group = net.puzzlemc archives_base_name = puzzle @@ -27,4 +27,5 @@ org.gradle.jvmargs=-Xmx1G cem_version = 3561474 complete_config_version = 1.0.0 spruceui_version=3.3.2+1.17 - midnightlib_version=0.3.1 + midnightlib_version=0.4.0 + entitytexturefeatures_version=2.4.5 diff --git a/puzzle-base/src/main/java/net/puzzlemc/core/mixin/MixinTitleScreen.java b/puzzle-base/src/main/java/net/puzzlemc/core/mixin/MixinTitleScreen.java index 2ef08cb..b78b52e 100755 --- a/puzzle-base/src/main/java/net/puzzlemc/core/mixin/MixinTitleScreen.java +++ b/puzzle-base/src/main/java/net/puzzlemc/core/mixin/MixinTitleScreen.java @@ -27,13 +27,14 @@ public abstract class MixinTitleScreen extends Screen { @Shadow private long backgroundFadeStart; private Text puzzleText; private int puzzleTextWidth; - private int yOffset = 20; + private int yOffset; protected MixinTitleScreen(Text title) { super(title); } @Inject(at = @At("TAIL"), method = "init") private void puzzle$init(CallbackInfo ci) { + yOffset = 20; if (FabricLoader.getInstance().isModLoaded("dashloader")) yOffset = yOffset + 10; if (UpdateChecker.isUpToDate) { puzzleText = Text.of(PuzzleCore.version); diff --git a/puzzle-emissives/build.gradle b/puzzle-emissives/build.gradle deleted file mode 100755 index 3256a6c..0000000 --- a/puzzle-emissives/build.gradle +++ /dev/null @@ -1,10 +0,0 @@ -archivesBaseName = "puzzle-emissives" -repositories { - maven { - url = "https://api.modrinth.com/maven" - } -} -dependencies { - api project(":puzzle-base") - modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}" -} diff --git a/puzzle-emissives/src/main/java/net/puzzlemc/emissives/PuzzleEmissiveTextures.java b/puzzle-emissives/src/main/java/net/puzzlemc/emissives/PuzzleEmissiveTextures.java deleted file mode 100755 index a7c1677..0000000 --- a/puzzle-emissives/src/main/java/net/puzzlemc/emissives/PuzzleEmissiveTextures.java +++ /dev/null @@ -1,60 +0,0 @@ -package net.puzzlemc.emissives; - -import net.fabricmc.api.ClientModInitializer; -import net.puzzlemc.core.config.PuzzleConfig; -import net.fabricmc.fabric.api.resource.ResourceManagerHelper; -import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener; -import net.minecraft.resource.ResourceManager; -import net.minecraft.resource.ResourceType; -import net.minecraft.util.Identifier; -import org.apache.logging.log4j.LogManager; - -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; - -public class PuzzleEmissiveTextures implements ClientModInitializer { - public static final Map emissiveTextures = new HashMap<>(); - - public void onInitializeClient() { - ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(new SimpleSynchronousResourceReloadListener() { - @Override - public Identifier getFabricId() { - return new Identifier("puzzle", "emissive_textures"); - } - - @Override - public void reload(ResourceManager manager) { - if (PuzzleConfig.emissiveTextures) { - String suffix = "_e"; - - for (Identifier id : manager.findResources("optifine", path -> path.contains("emissive.properties"))) { - try (InputStream stream = manager.getResource(id).getInputStream()) { - Properties properties = new Properties(); - properties.load(stream); - - if (properties.get("suffix.emissive") != null) { - suffix = properties.get("suffix.emissive").toString(); - } - } catch (Exception e) { - LogManager.getLogger("Puzzle").error("Error occurred while loading emissive.properties " + id.toString(), e); - } - String finalSuffix = suffix; - for (Identifier emissiveId : manager.findResources("textures", path -> path.endsWith(finalSuffix + ".png"))) { - try { - String normalTexture = emissiveId.toString(); - normalTexture = normalTexture.substring(0, normalTexture.lastIndexOf(finalSuffix)); - Identifier normalId = Identifier.tryParse(normalTexture + ".png"); - emissiveTextures.put(normalId, emissiveId); - if (PuzzleConfig.debugMessages) LogManager.getLogger("Puzzle").info(normalId + " " + emissiveId); - } catch (Exception e) { - LogManager.getLogger("Puzzle").error("Error occurred while loading emissive texture " + emissiveId.toString(), e); - } - } - } - } - } - }); - } -} diff --git a/puzzle-emissives/src/main/java/net/puzzlemc/emissives/mixin/MixinLivingEntityRenderer.java b/puzzle-emissives/src/main/java/net/puzzlemc/emissives/mixin/MixinLivingEntityRenderer.java deleted file mode 100755 index 51493d0..0000000 --- a/puzzle-emissives/src/main/java/net/puzzlemc/emissives/mixin/MixinLivingEntityRenderer.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.puzzlemc.emissives.mixin; - -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.*; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.LivingEntity; -import net.puzzlemc.core.config.PuzzleConfig; -import net.puzzlemc.emissives.PuzzleEmissiveTextures; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(value = LivingEntityRenderer.class) -public abstract class MixinLivingEntityRenderer> extends EntityRenderer implements FeatureRendererContext { - - @Shadow public abstract M getModel(); - - protected MixinLivingEntityRenderer(EntityRendererFactory.Context ctx) { - super(ctx); - } - - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/model/EntityModel;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;IIFFFF)V", shift = At.Shift.AFTER), method = "render*") - private void onRender(T entity, float yaw, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { - if (PuzzleConfig.emissiveTextures && PuzzleEmissiveTextures.emissiveTextures.containsKey(this.getTexture(entity))) { - VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getBeaconBeam(PuzzleEmissiveTextures.emissiveTextures.get(this.getTexture(entity)),true)); - - matrices.scale(1.015f,1.015f,1.015f); - this.getModel().render(matrices, vertexConsumer, 15728640, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F); - matrices.scale(1f,1f,1f); - } - } -} diff --git a/puzzle-emissives/src/main/resources/assets/puzzle/icon.png b/puzzle-emissives/src/main/resources/assets/puzzle/icon.png deleted file mode 100644 index 0050c65..0000000 Binary files a/puzzle-emissives/src/main/resources/assets/puzzle/icon.png and /dev/null differ diff --git a/puzzle-emissives/src/main/resources/fabric.mod.json b/puzzle-emissives/src/main/resources/fabric.mod.json deleted file mode 100755 index 2d3de2e..0000000 --- a/puzzle-emissives/src/main/resources/fabric.mod.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "schemaVersion": 1, - "id": "puzzle-emissives", - "version": "${version}", - - "name": "Puzzle Emissive Textures", - "description": "Displays emissive textures on blocks and entities", - "authors": [ - "PuzzleMC", - "Motschen" - ], - "contact": { - "homepage": "https://www.midnightdust.eu/", - "sources": "https://github.com/TeamMidnightDust/Puzzle", - "issues": "https://github.com/TeamMidnightDust/Puzzle/issues" - }, - - "license": "MIT", - "icon": "assets/puzzle/icon.png", - - "environment": "client", - "entrypoints": { - "client": [ - "net.puzzlemc.emissives.PuzzleEmissiveTextures" - ] - }, - "custom": { - "modmenu": { - "parent": "puzzle" - } - }, - - "mixins": [ - "puzzle-emissives.mixins.json" - ], - - "depends": { - "fabric": "*" - } -} diff --git a/puzzle-emissives/src/main/resources/puzzle-emissives.mixins.json b/puzzle-emissives/src/main/resources/puzzle-emissives.mixins.json deleted file mode 100755 index fff43eb..0000000 --- a/puzzle-emissives/src/main/resources/puzzle-emissives.mixins.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "required": true, - "package": "net.puzzlemc.emissives.mixin", - "compatibilityLevel": "JAVA_17", - "client": [ - "MixinLivingEntityRenderer" - ], - "injectors": { - "defaultRequire": 1 - } -} \ No newline at end of file diff --git a/puzzle-gui/build.gradle b/puzzle-gui/build.gradle index 26b9344..c96f6ff 100755 --- a/puzzle-gui/build.gradle +++ b/puzzle-gui/build.gradle @@ -42,6 +42,7 @@ dependencies { modImplementation ("maven.modrinth:lambdabettergrass:${project.lbg_version}") modImplementation ("maven.modrinth:iris:${project.iris_version}") modImplementation ("maven.modrinth:cit-resewn:${project.cit_resewn_version}") + modImplementation ("maven.modrinth:entitytexturefeatures:${project.entitytexturefeatures_version}") modImplementation ("curse.maven:custom-entity-models-cem-477078:${project.cem_version}") modImplementation "com.gitlab.Lortseam:completeconfig:${project.complete_config_version}" diff --git a/puzzle-gui/src/main/java/net/puzzlemc/gui/PuzzleClient.java b/puzzle-gui/src/main/java/net/puzzlemc/gui/PuzzleClient.java index 840815c..d9109ff 100755 --- a/puzzle-gui/src/main/java/net/puzzlemc/gui/PuzzleClient.java +++ b/puzzle-gui/src/main/java/net/puzzlemc/gui/PuzzleClient.java @@ -21,6 +21,10 @@ import net.puzzlemc.splashscreen.PuzzleSplashScreen; import shcm.shsupercm.fabric.citresewn.CITResewn; import shcm.shsupercm.fabric.citresewn.config.CITResewnConfig; +import traben.entity_texture_features.client.ETF_CLIENT; +import traben.entity_texture_features.client.ETF_METHODS; +import traben.entity_texture_features.config.ETFConfig; +import traben.entity_texture_features.config.ETFConfigScreen; public class PuzzleClient implements ClientModInitializer { @@ -56,12 +60,6 @@ public void onInitializeClient() { PuzzleConfig.write(id); })); } - if (FabricLoader.getInstance().isModLoaded("puzzle-emissives") && !PuzzleConfig.disabledIntegrations.contains("puzzle-emissives")) { - PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("puzzle.option.emissive_textures"), (button) -> button.setMessage(PuzzleConfig.emissiveTextures ? YES : NO), (button) -> { - PuzzleConfig.emissiveTextures = !PuzzleConfig.emissiveTextures; - PuzzleConfig.write(id); - })); - } if (FabricLoader.getInstance().isModLoaded("puzzle-models") && !PuzzleConfig.disabledIntegrations.contains("puzzle-models")) { PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("puzzle.option.unlimited_model_rotations"), (button) -> button.setMessage(PuzzleConfig.unlimitedRotations ? YES : NO), (button) -> { PuzzleConfig.unlimitedRotations = !PuzzleConfig.unlimitedRotations; @@ -98,6 +96,36 @@ public void onInitializeClient() { contConfig.save(); })); } + if (FabricLoader.getInstance().isModLoaded("entity_texture_features") && !PuzzleConfig.disabledIntegrations.contains("entity_texture_features")) { + PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Entity Texture Features"))); + ETFConfig etfConfig = ETF_CLIENT.ETFConfigData; + ETFConfigScreen etfConfigScreen = new ETFConfigScreen(); + PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Enable Optifine Random mobs"), (button) -> button.setMessage(etfConfig.enableCustomTextures ? YES : NO), (button) -> { + etfConfig.enableCustomTextures = !etfConfig.enableCustomTextures; + etfConfigScreen.saveConfig(); + etfConfigScreen.resetVisuals(); + })); + PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Enable Optifine Emissive entity textures"), (button) -> button.setMessage(etfConfig.enableEmissiveTextures ? YES : NO), (button) -> { + etfConfig.enableEmissiveTextures = !etfConfig.enableEmissiveTextures; + etfConfigScreen.saveConfig(); + etfConfigScreen.resetVisuals(); + })); + PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Emissive texture Z-Fighting / Shader patch"), (button) -> button.setMessage(etfConfig.doShadersEmissiveFix ? YES : NO), (button) -> { + etfConfig.doShadersEmissiveFix = !etfConfig.doShadersEmissiveFix; + etfConfigScreen.saveConfig(); + etfConfigScreen.resetVisuals(); + })); + PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Enable Blinking Mobs"), (button) -> button.setMessage(etfConfig.enableBlinking ? YES : NO), (button) -> { + etfConfig.enableBlinking = !etfConfig.enableBlinking; + etfConfigScreen.saveConfig(); + etfConfigScreen.resetVisuals(); + })); + PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Enable Player Skin Features"), (button) -> button.setMessage(etfConfig.skinFeaturesEnabled ? YES : NO), (button) -> { + etfConfig.skinFeaturesEnabled = !etfConfig.skinFeaturesEnabled; + etfConfigScreen.saveConfig(); + etfConfigScreen.resetVisuals(); + })); + } } public static boolean lateInitDone = false; public static void lateInit() { // Some mods are initialized after Puzzle, so we can't access them in our ClientModInitializer diff --git a/puzzle-gui/src/main/java/net/puzzlemc/gui/config/ModMenuIntegration.java b/puzzle-gui/src/main/java/net/puzzlemc/gui/config/ModMenuIntegration.java index 1441636..4ec85f5 100755 --- a/puzzle-gui/src/main/java/net/puzzlemc/gui/config/ModMenuIntegration.java +++ b/puzzle-gui/src/main/java/net/puzzlemc/gui/config/ModMenuIntegration.java @@ -20,13 +20,12 @@ public ConfigScreenFactory getModConfigScreenFactory() { @Override public Map> getProvidedConfigScreenFactories() { Map> map = new HashMap<>(); - map.put("puzzle",PuzzleOptionsScreen::new); map.put("puzzle-gui",PuzzleOptionsScreen::new); map.put("puzzle-blocks",PuzzleOptionsScreen::new); map.put("puzzle-base",PuzzleOptionsScreen::new); map.put("puzzle-models",PuzzleOptionsScreen::new); - map.put("puzzle-emissives",PuzzleOptionsScreen::new); map.put("puzzle-splashscreen",PuzzleOptionsScreen::new); + map.put("puzzle",PuzzleOptionsScreen::new); return map; } } \ No newline at end of file diff --git a/puzzle-splashscreen/src/main/java/net/puzzlemc/splashscreen/PuzzleSplashScreen.java b/puzzle-splashscreen/src/main/java/net/puzzlemc/splashscreen/PuzzleSplashScreen.java index aa5bf9c..3f5c5cb 100755 --- a/puzzle-splashscreen/src/main/java/net/puzzlemc/splashscreen/PuzzleSplashScreen.java +++ b/puzzle-splashscreen/src/main/java/net/puzzlemc/splashscreen/PuzzleSplashScreen.java @@ -2,6 +2,7 @@ import net.fabricmc.api.ClientModInitializer; import net.minecraft.client.texture.NativeImageBackedTexture; +import net.minecraft.util.Util; import net.minecraft.util.math.ColorHelper; import net.puzzlemc.core.config.PuzzleConfig; import net.puzzlemc.core.util.ColorUtil; @@ -47,9 +48,11 @@ public static void resetColors() { public void onInitializeClient() { if (!CONFIG_PATH.exists()) { // Run when config directory is nonexistent // if (CONFIG_PATH.mkdir()) { // Create our custom config directory // - try { - Files.setAttribute(CONFIG_PATH.toPath(), "dos:hidden", true); - } catch (IOException ignored) { + if (Util.getOperatingSystem().equals(Util.OperatingSystem.WINDOWS)) { + try { + Files.setAttribute(CONFIG_PATH.toPath(), "dos:hidden", true); + } catch (IOException ignored) { + } } } } diff --git a/settings.gradle b/settings.gradle index 3f8f89c..020a5ea 100755 --- a/settings.gradle +++ b/settings.gradle @@ -12,4 +12,3 @@ include 'puzzle-base' include 'puzzle-splashscreen' include 'puzzle-models' include 'puzzle-gui' -include 'puzzle-emissives' diff --git a/src/main/resources/assets/puzzle/lang/de_de.json b/src/main/resources/assets/puzzle/lang/de_de.json new file mode 100644 index 0000000..c87b4dc --- /dev/null +++ b/src/main/resources/assets/puzzle/lang/de_de.json @@ -0,0 +1,17 @@ +{ + "puzzle.text.update_available":"Ein Update ist verfügbar!", + "puzzle.screen.title":"Puzzle Einstellungen", + "puzzle.page.graphics":"Grafik Einstellungen", + "puzzle.page.resources":"Resourcen Einstellungen", + "puzzle.page.performance":"Performance Einstellungen", + "puzzle.page.misc":"Sonstige Einstellungen", + "puzzle.option.check_for_updates":"Auf Updates überprüfen", + "puzzle.option.show_version_info":"Zeige Puzzles Versions Informationen", + "puzzle.option.resourcepack_splash_screen":"Nutzte den Resourcepack-splash-Screen", + "puzzle.option.disable_splash_screen_blend":"Deaktiviere das Überblenden des Splash-Screen-Logos", + "puzzle.option.emissive_textures":"Emissive Texturen", + "puzzle.option.unlimited_model_rotations":"Unbegrenzte Modellrotationen", + "puzzle.option.bigger_custom_models":"Größere benutzerdefinierte Modelle", + "puzzle.option.render_layer_overrides":"Render Layer Overrides", + "puzzle.midnightconfig.title":"Erweiterte Puzzle Einstellungen" +} \ No newline at end of file