Final changes for 1.0.0

This commit is contained in:
Motschen
2022-01-03 15:26:19 +01:00
parent c0abca50f9
commit 49ddb467ae
7 changed files with 25 additions and 18 deletions

View File

@@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.12.12 loader_version=0.12.12
# Mod Properties # Mod Properties
mod_version = 1.0.0-pre4 mod_version = 1.0.0
maven_group = net.puzzlemc maven_group = net.puzzlemc
archives_base_name = puzzle archives_base_name = puzzle

View File

@@ -1,18 +1,19 @@
package net.puzzlemc.core; package net.puzzlemc.core;
import net.fabricmc.loader.api.FabricLoader;
import net.puzzlemc.core.config.PuzzleConfig; import net.puzzlemc.core.config.PuzzleConfig;
import net.puzzlemc.core.util.UpdateChecker; import net.puzzlemc.core.util.UpdateChecker;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;
public class PuzzleCore implements ClientModInitializer { public class PuzzleCore implements ClientModInitializer {
public final static String version = "Puzzle B0"; public final static String version = "Puzzle "+ FabricLoader.getInstance().getModContainer("puzzle").get().getMetadata().getVersion();
public final static String name = "Puzzle"; public final static String name = "Puzzle";
public final static String id = "puzzle"; public final static String id = "puzzle";
public final static String website = "https://github.com/PuzzleMC/Puzzle"; public final static String website = "https://github.com/PuzzleMC/Puzzle";
public static String updateURL = website; //+"download"; public static String updateURL = "https://modrinth.com/mod/puzzle";
public final static String UPDATE_URL = "https://raw.githubusercontent.com/PuzzleMC/Puzzle-Versions/main/puzzle_versions.json"; public final static String UPDATE_CHECKER_URL = "https://raw.githubusercontent.com/PuzzleMC/Puzzle-Versions/main/puzzle_versions.json";
@Override @Override
public void onInitializeClient() { public void onInitializeClient() {

View File

@@ -29,7 +29,7 @@ public class UpdateChecker {
public static void init() { public static void init() {
CompletableFuture.supplyAsync(() -> { CompletableFuture.supplyAsync(() -> {
try (Reader reader = new InputStreamReader(new URL(PuzzleCore.UPDATE_URL).openStream())) { try (Reader reader = new InputStreamReader(new URL(PuzzleCore.UPDATE_CHECKER_URL).openStream())) {
return GSON.<Map<String, String>>fromJson(reader, UPDATE_TYPE_TOKEN); return GSON.<Map<String, String>>fromJson(reader, UPDATE_TYPE_TOKEN);
} catch (MalformedURLException error) { } catch (MalformedURLException error) {
logger.log(Level.ERROR, "Unable to check for updates because of connection problems: " + error.getMessage()); logger.log(Level.ERROR, "Unable to check for updates because of connection problems: " + error.getMessage());
@@ -48,7 +48,7 @@ public class UpdateChecker {
logger.log(Level.INFO, "Please update immediately!"); logger.log(Level.INFO, "Please update immediately!");
} }
} else { } else {
logger.log(Level.WARN, "A problem with the database occured, could not check for updates."); logger.log(Level.WARN, "A problem with the database occurred, could not check for updates.");
} }
}, MinecraftClient.getInstance()); }, MinecraftClient.getInstance());
} }

View File

@@ -31,45 +31,45 @@ public class PuzzleClient implements ClientModInitializer {
@Override @Override
public void onInitializeClient() { public void onInitializeClient() {
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.of("Puzzle"))); PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.of("Puzzle")));
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.of("Check for Updates"), (button) -> button.setMessage(PuzzleConfig.checkUpdates ? YES : NO), (button) -> { PuzzleApi.addToMiscOptions(new PuzzleWidget(new TranslatableText("puzzle.option.check_for_updates"), (button) -> button.setMessage(PuzzleConfig.checkUpdates ? YES : NO), (button) -> {
PuzzleConfig.checkUpdates = !PuzzleConfig.checkUpdates; PuzzleConfig.checkUpdates = !PuzzleConfig.checkUpdates;
PuzzleConfig.write(id); PuzzleConfig.write(id);
})); }));
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.of("Show Puzzle version info"), (button) -> button.setMessage(PuzzleConfig.showPuzzleInfo ? YES : NO), (button) -> { PuzzleApi.addToMiscOptions(new PuzzleWidget(new TranslatableText("puzzle.option.show_version_info"), (button) -> button.setMessage(PuzzleConfig.showPuzzleInfo ? YES : NO), (button) -> {
PuzzleConfig.showPuzzleInfo = !PuzzleConfig.showPuzzleInfo; PuzzleConfig.showPuzzleInfo = !PuzzleConfig.showPuzzleInfo;
PuzzleConfig.write(id); PuzzleConfig.write(id);
})); }));
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Puzzle"))); PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Puzzle")));
if (FabricLoader.getInstance().isModLoaded("puzzle-splashscreen")) { if (FabricLoader.getInstance().isModLoaded("puzzle-splashscreen")) {
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Use resourcepack splash screen "), (button) -> button.setMessage(PuzzleConfig.resourcepackSplashScreen ? YES : NO), (button) -> { PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("puzzle.option.resourcepack_splash_screen"), (button) -> button.setMessage(PuzzleConfig.resourcepackSplashScreen ? YES : NO), (button) -> {
PuzzleConfig.resourcepackSplashScreen = !PuzzleConfig.resourcepackSplashScreen; PuzzleConfig.resourcepackSplashScreen = !PuzzleConfig.resourcepackSplashScreen;
PuzzleConfig.write(id); PuzzleConfig.write(id);
PuzzleSplashScreen.resetColors(); PuzzleSplashScreen.resetColors();
MinecraftClient.getInstance().getTextureManager().registerTexture(PuzzleSplashScreen.LOGO, new PuzzleSplashScreen.LogoTexture()); MinecraftClient.getInstance().getTextureManager().registerTexture(PuzzleSplashScreen.LOGO, new PuzzleSplashScreen.LogoTexture());
})); }));
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Disable splash screen logo blending "), (button) -> button.setMessage(PuzzleConfig.disableSplashScreenBlend ? YES : NO), (button) -> { PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("puzzle.option.disable_splash_screen_blend"), (button) -> button.setMessage(PuzzleConfig.disableSplashScreenBlend ? YES : NO), (button) -> {
PuzzleConfig.disableSplashScreenBlend = !PuzzleConfig.disableSplashScreenBlend; PuzzleConfig.disableSplashScreenBlend = !PuzzleConfig.disableSplashScreenBlend;
PuzzleConfig.write(id); PuzzleConfig.write(id);
})); }));
} }
if (FabricLoader.getInstance().isModLoaded("puzzle-emissives")) { if (FabricLoader.getInstance().isModLoaded("puzzle-emissives")) {
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Emissive Textures"), (button) -> button.setMessage(PuzzleConfig.emissiveTextures ? YES : NO), (button) -> { PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("puzzle.option.emissive_textures"), (button) -> button.setMessage(PuzzleConfig.emissiveTextures ? YES : NO), (button) -> {
PuzzleConfig.emissiveTextures = !PuzzleConfig.emissiveTextures; PuzzleConfig.emissiveTextures = !PuzzleConfig.emissiveTextures;
PuzzleConfig.write(id); PuzzleConfig.write(id);
})); }));
} }
if (FabricLoader.getInstance().isModLoaded("puzzle-models")) { if (FabricLoader.getInstance().isModLoaded("puzzle-models")) {
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Unlimited Model Rotations"), (button) -> button.setMessage(PuzzleConfig.unlimitedRotations ? YES : NO), (button) -> { PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("puzzle.option.unlimited_model_rotations"), (button) -> button.setMessage(PuzzleConfig.unlimitedRotations ? YES : NO), (button) -> {
PuzzleConfig.unlimitedRotations = !PuzzleConfig.unlimitedRotations; PuzzleConfig.unlimitedRotations = !PuzzleConfig.unlimitedRotations;
PuzzleConfig.write(id); PuzzleConfig.write(id);
})); }));
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Bigger Custom Models"), (button) -> button.setMessage(PuzzleConfig.biggerModels ? YES : NO), (button) -> { PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("puzzle.option.bigger_custom_models"), (button) -> button.setMessage(PuzzleConfig.biggerModels ? YES : NO), (button) -> {
PuzzleConfig.biggerModels = !PuzzleConfig.biggerModels; PuzzleConfig.biggerModels = !PuzzleConfig.biggerModels;
PuzzleConfig.write(id); PuzzleConfig.write(id);
})); }));
} }
if (FabricLoader.getInstance().isModLoaded("puzzle-blocks")) { if (FabricLoader.getInstance().isModLoaded("puzzle-blocks")) {
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Render Layer Overwrites"), (button) -> button.setMessage(PuzzleConfig.customRenderLayers ? YES : NO), (button) -> { PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("puzzle.option.render_layer_overrides"), (button) -> button.setMessage(PuzzleConfig.customRenderLayers ? YES : NO), (button) -> {
PuzzleConfig.customRenderLayers = !PuzzleConfig.customRenderLayers; PuzzleConfig.customRenderLayers = !PuzzleConfig.customRenderLayers;
PuzzleConfig.write(id); PuzzleConfig.write(id);
})); }));

View File

@@ -45,7 +45,7 @@ public class PuzzleSplashScreen implements ClientModInitializer {
} }
public void onInitializeClient() { public void onInitializeClient() {
if (!CONFIG_PATH.exists()) { // Run when config directory is nonexistant // if (!CONFIG_PATH.exists()) { // Run when config directory is nonexistent //
if (CONFIG_PATH.mkdir()) { // Create our custom config directory // if (CONFIG_PATH.mkdir()) { // Create our custom config directory //
try { try {
Files.setAttribute(CONFIG_PATH.toPath(), "dos:hidden", true); Files.setAttribute(CONFIG_PATH.toPath(), "dos:hidden", true);

View File

@@ -55,7 +55,7 @@ public abstract class MixinSplashScreen extends Overlay {
private void modifyBackgroundColor2(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { // Set the Background Color to our configured value // private void modifyBackgroundColor2(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { // Set the Background Color to our configured value //
long l = Util.getMeasuringTimeMs(); long l = Util.getMeasuringTimeMs();
float g = this.reloadStartTime > -1L ? (float)(l - this.reloadStartTime) / 500.0F : -1.0F; float g = this.reloadStartTime > -1L ? (float)(l - this.reloadStartTime) / 500.0F : -1.0F;
int m = MathHelper.ceil(MathHelper.clamp((double)g, 0.15D, 1.0D) * 255.0D); int m = MathHelper.ceil(MathHelper.clamp(g, 0.15D, 1.0D) * 255.0D);
if (PuzzleConfig.resourcepackSplashScreen && PuzzleConfig.backgroundColor != 15675965) if (PuzzleConfig.resourcepackSplashScreen && PuzzleConfig.backgroundColor != 15675965)
fill(matrices, 0, 0, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight(), withAlpha(PuzzleConfig.backgroundColor, m)); fill(matrices, 0, 0, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight(), withAlpha(PuzzleConfig.backgroundColor, m));
} }

View File

@@ -5,8 +5,14 @@
"puzzle.page.resources":"Resource Settings", "puzzle.page.resources":"Resource Settings",
"puzzle.page.performance":"Performance Settings", "puzzle.page.performance":"Performance Settings",
"puzzle.page.misc":"Miscellaneous Settings", "puzzle.page.misc":"Miscellaneous Settings",
"puzzle.option.ctm":"Connected Textures", "puzzle.option.check_for_updates":"Check for Updates",
"puzzle.option.inside_ctm":"Connect Inside Textures", "puzzle.option.show_version_info":"Show Puzzle version info",
"puzzle.option.resourcepack_splash_screen":"Use resourcepack splash screen",
"puzzle.option.disable_splash_screen_blend":"Disable splash screen logo blending",
"puzzle.option.emissive_textures":"Emissive Textures",
"puzzle.option.unlimited_model_rotations":"Unlimited Model Rotations",
"puzzle.option.bigger_custom_models":"Bigger Custom Models",
"puzzle.option.render_layer_overrides":"Render Layer Overrides",
"puzzle.midnightconfig.title":"Title", "puzzle.midnightconfig.title":"Title",
"puzzle.midnightconfig.showPuzzleInfo":"Show Puzzle Info", "puzzle.midnightconfig.showPuzzleInfo":"Show Puzzle Info",
"puzzle.midnightconfig.showPuzzleInfo.tooltip":"Show Puzzle Info" "puzzle.midnightconfig.showPuzzleInfo.tooltip":"Show Puzzle Info"