diff --git a/CHANGELOG.md b/CHANGELOG.md index c8f22b4f..00606ac8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,6 +75,14 @@ - Updated French translations. - Fixed memory leak in dynamic light source tracking. ([#30](https://github.com/LambdAurora/LambDynamicLights/issues/30)) +# v1.3.3 + + - Added Italian translations ([#40](https://github.com/LambdAurora/LambDynamicLights/pull/40)). + - Optimized dynamic lighting update methods. + - Fixed crash when leaving world with some minimaps mods. ([#37](https://github.com/LambdAurora/LambDynamicLights/issues/37), [#41](https://github.com/LambdAurora/LambDynamicLights/issues/41)) + - Fixed crash with Immersive Portals ([#39](https://github.com/LambdAurora/LambDynamicLights/issues/39)). + - Updated [SpruceUI], and Fabric API dependencies. + [SpruceUI]: https://github.com/LambdAurora/SpruceUI "SpruceUI page" -[Sodium]: https://www.curseforge.com/minecraft/mc-mods/sodium "Sodium CurseForge page" +[Sodium]: https://modrinth.com/mod/sodium "Sodium Modrinth page" [Canvas Renderer]: https://www.curseforge.com/minecraft/mc-mods/canvas-renderer "Canvas Renderer CurseForge page" diff --git a/build.gradle b/build.gradle index f0f9d15d..97b43bbb 100644 --- a/build.gradle +++ b/build.gradle @@ -1,16 +1,25 @@ import net.fabricmc.loom.task.RemapJarTask plugins { - id 'fabric-loom' version '0.4-SNAPSHOT' + id 'fabric-loom' version '0.5-SNAPSHOT' id 'java-library' id 'maven-publish' + id 'com.github.johnrengelman.shadow' version '5.1.0' id 'net.minecrell.licenser' version '0.4.1' } group = project.maven_group -version = "${project.mod_version}+${project.minecraft_version}" +version = "${project.mod_version}+${getMCVersionString()}" archivesBaseName = project.archives_base_name + "-fabric" +def getMCVersionString() { + if (project.minecraft_version.matches("\\d\\dw\\d\\d[a-z]")) { + return project.minecraft_version + } + int lastDot = project.minecraft_version.lastIndexOf('.') + return project.minecraft_version.substring(0, lastDot) +} + minecraft { } @@ -55,18 +64,14 @@ dependencies { modImplementation "com.github.lambdaurora:spruceui:${project.spruceui_version}" include "com.github.lambdaurora:spruceui:${project.spruceui_version}" - modImplementation "io.github.prospector:modmenu:${project.modmenu_version}" + modImplementation("io.github.prospector:modmenu:${project.modmenu_version}") { + transitive = false + } //modImplementation "grondag:canvas-mc116:1.0.+" modImplementation "com.github.jellysquid3:sodium-fabric:mc1.16.3-0.1.0" shadow "com.electronwill.night-config:core:3.6.3" shadow "com.electronwill.night-config:toml:3.6.3" - - shadow("org.aperlambda:lambdajcommon:1.8.1") { - // Minecraft already has all that google crap. - exclude group: 'com.google.code.gson' - exclude group: 'com.google.guava' - } } tasks.withType(JavaCompile) { @@ -102,16 +107,12 @@ license { include '**/*.java' } -task shadowJar(type: Jar) { - archiveClassifier.set("dev") - - from sourceSets.main.output +shadowJar { + dependsOn(project(":").jar) + configurations = [project.configurations.shadow] + archiveClassifier.set('dev') - from { - configurations.shadow.collect { - it.isDirectory() ? it : zipTree(it) - } - } + relocate 'com.electronwill.nightconfig', 'me.lambdaurora.lambdynlights.shadow.nightconfig' } task shadowRemapJar(type: RemapJarTask) { @@ -121,6 +122,7 @@ task shadowRemapJar(type: RemapJarTask) { archiveName = "${archivesBaseName}-${version}.jar" addNestedDependencies = true } +build.dependsOn(shadowRemapJar) // configure the maven publication publishing { diff --git a/gradle.properties b/gradle.properties index ae65d97f..08cbf9b0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,17 +3,17 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/use -minecraft_version=1.16.4 -yarn_mappings=1.16.4+build.3 -loader_version=0.10.6+build.214 +minecraft_version=1.16.5 +yarn_mappings=1.16.5+build.1 +loader_version=0.11.1 # Mod Properties -mod_version = 1.3.2 +mod_version = 1.3.3 maven_group = me.lambdaurora archives_base_name = lambdynamiclights # 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.25.1+build.416-1.16 -spruceui_version=1.6.4 +fabric_version=0.29.3+1.16 +spruceui_version=2.0.1-1.16 modmenu_version=1.14.6+build.31 diff --git a/src/main/java/me/lambdaurora/lambdynlights/DynamicLightSource.java b/src/main/java/me/lambdaurora/lambdynlights/DynamicLightSource.java index e9dbade4..3042b36a 100644 --- a/src/main/java/me/lambdaurora/lambdynlights/DynamicLightSource.java +++ b/src/main/java/me/lambdaurora/lambdynlights/DynamicLightSource.java @@ -11,52 +11,51 @@ import net.minecraft.client.render.WorldRenderer; import net.minecraft.world.World; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; /** * Represents a dynamic light source. * * @author LambdAurora - * @version 1.3.2 + * @version 1.3.3 * @since 1.0.0 */ -public interface DynamicLightSource -{ +public interface DynamicLightSource { /** * Returns the dynamic light source X coordinate. * - * @return The X coordinate. + * @return the X coordinate */ double getDynamicLightX(); /** * Returns the dynamic light source Y coordinate. * - * @return The Y coordinate. + * @return the Y coordinate */ double getDynamicLightY(); /** * Returns the dynamic light source Z coordinate. * - * @return The Z coordinate. + * @return the Z coordinate */ double getDynamicLightZ(); /** * Returns the dynamic light source world. * - * @return The world instance. + * @return the world instance */ World getDynamicLightWorld(); /** * Returns whether the dynamic light is enabled or not. * - * @return True if the dynamic light is enabled, else false. + * @return {@code true} if the dynamic light is enabled, else {@code false} */ - default boolean isDynamicLightEnabled() - { + default boolean isDynamicLightEnabled() { return LambDynLights.get().config.getDynamicLightsMode().isEnabled() && LambDynLights.get().containsLightSource(this); } @@ -65,10 +64,10 @@ default boolean isDynamicLightEnabled() *

* Note: please do not call this function in your mod or you will break things. * - * @param enabled True if the dynamic light is enabled, else false. + * @param enabled {@code true} if the dynamic light is enabled, else {@code false} */ - default void setDynamicLightEnabled(boolean enabled) - { + @ApiStatus.Internal + default void setDynamicLightEnabled(boolean enabled) { this.resetDynamicLight(); if (enabled) LambDynLights.get().addLightSource(this); @@ -82,7 +81,7 @@ default void setDynamicLightEnabled(boolean enabled) * Returns the luminance of the light source. * The maximum is 15, below 1 values are ignored. * - * @return The luminance of the light source. + * @return the luminance of the light source */ int getLuminance(); @@ -94,7 +93,7 @@ default void setDynamicLightEnabled(boolean enabled) /** * Returns whether this dynamic light source should update. * - * @return True if this dynamic light source should update, else false. + * @return {@code true} if this dynamic light source should update, else {@code false} */ boolean shouldUpdateDynamicLight(); diff --git a/src/main/java/me/lambdaurora/lambdynlights/DynamicLightsConfig.java b/src/main/java/me/lambdaurora/lambdynlights/DynamicLightsConfig.java index 4bc88e53..8145ebfa 100644 --- a/src/main/java/me/lambdaurora/lambdynlights/DynamicLightsConfig.java +++ b/src/main/java/me/lambdaurora/lambdynlights/DynamicLightsConfig.java @@ -11,12 +11,11 @@ import com.electronwill.nightconfig.core.file.FileConfig; import me.lambdaurora.spruceui.option.SpruceCyclingOption; -import net.minecraft.client.options.Option; +import me.lambdaurora.spruceui.option.SpruceOption; import net.minecraft.text.LiteralText; import net.minecraft.text.TranslatableText; import org.jetbrains.annotations.NotNull; -import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -24,11 +23,10 @@ * Represents the mod configuration. * * @author LambdAurora - * @version 1.3.2 + * @version 1.3.3 * @since 1.0.0 */ -public class DynamicLightsConfig -{ +public class DynamicLightsConfig { private static final DynamicLightsMode DEFAULT_DYNAMIC_LIGHTS_MODE = DynamicLightsMode.OFF; private static final boolean DEFAULT_ENTITIES_LIGHT_SOURCE = true; private static final boolean DEFAULT_BLOCK_ENTITIES_LIGHT_SOURCE = true; @@ -39,12 +37,11 @@ public class DynamicLightsConfig public static final Path CONFIG_FILE_PATH = Paths.get("config/lambdynlights.toml"); protected final FileConfig config; private final LambDynLights mod; - private boolean firstTime; private DynamicLightsMode dynamicLightsMode; private ExplosiveLightingMode creeperLightingMode; private ExplosiveLightingMode tntLightingMode; - public final Option dynamicLightsModeOption = new SpruceCyclingOption("lambdynlights.option.mode", + public final SpruceOption dynamicLightsModeOption = new SpruceCyclingOption("lambdynlights.option.mode", amount -> this.setDynamicLightsMode(this.dynamicLightsMode.next()), option -> option.getDisplayText(this.dynamicLightsMode.getTranslatedText()), new TranslatableText("lambdynlights.tooltip.mode.1") @@ -53,20 +50,16 @@ public class DynamicLightsConfig .append(new LiteralText("\n")) .append(new TranslatableText("lambdynlights.tooltip.mode.3", DynamicLightsMode.FANCY.getTranslatedText()))); - public DynamicLightsConfig(@NotNull LambDynLights mod) - { + public DynamicLightsConfig(@NotNull LambDynLights mod) { this.mod = mod; - this.firstTime = Files.notExists(CONFIG_FILE_PATH); - this.config = FileConfig.builder(CONFIG_FILE_PATH).concurrent().defaultResource("/lambdynlights.toml").autosave().build(); } /** * Loads the configuration. */ - public void load() - { + public void load() { this.config.load(); String dynamicLightsModeValue = this.config.getOrElse("mode", DEFAULT_DYNAMIC_LIGHTS_MODE.getName()); @@ -77,26 +70,20 @@ public void load() this.tntLightingMode = ExplosiveLightingMode.byId(this.config.getOrElse("light_sources.tnt", DEFAULT_TNT_LIGHTING_MODE.getName())) .orElse(DEFAULT_TNT_LIGHTING_MODE); - if (dynamicLightsModeValue.equalsIgnoreCase("none")) { - this.firstTime = true; - } - this.mod.log("Configuration loaded."); } /** * Saves the configuration. */ - public void save() - { + public void save() { this.config.save(); } /** * Resets the configuration. */ - public void reset() - { + public void reset() { this.setDynamicLightsMode(DEFAULT_DYNAMIC_LIGHTS_MODE); this.setEntitiesLightSource(DEFAULT_ENTITIES_LIGHT_SOURCE); this.setBlockEntitiesLightSource(DEFAULT_BLOCK_ENTITIES_LIGHT_SOURCE); @@ -105,60 +92,44 @@ public void reset() this.setTntLightingMode(DEFAULT_TNT_LIGHTING_MODE); } - /** - * Returns whether it's the first time the mod is loaded. - * - * @return True if it's the first time, else false. - */ - public boolean isFirstTime() - { - return this.firstTime; - } - /** * Returns the dynamic lights mode. * - * @return The dynamic lights mode. + * @return the dynamic lights mode */ - public DynamicLightsMode getDynamicLightsMode() - { + public DynamicLightsMode getDynamicLightsMode() { return this.dynamicLightsMode; } /** * Sets the dynamic lights mode. * - * @param mode The dynamic lights mode. + * @param mode the dynamic lights mode */ - public void setDynamicLightsMode(@NotNull DynamicLightsMode mode) - { + public void setDynamicLightsMode(@NotNull DynamicLightsMode mode) { if (!mode.isEnabled()) { this.mod.clearLightSources(); } this.dynamicLightsMode = mode; this.config.set("mode", mode.getName()); - - this.firstTime = false; } /** * Returns whether block entities as light source is enabled. * - * @return True if block entities as light source is enabled, else false. + * @return {@code true} if block entities as light source is enabled, else {@code false} */ - public boolean hasEntitiesLightSource() - { + public boolean hasEntitiesLightSource() { return this.config.getOrElse("light_sources.entities", DEFAULT_ENTITIES_LIGHT_SOURCE); } /** * Sets whether block entities as light source is enabled. * - * @param enabled True if block entities as light source is enabled, else false. + * @param enabled {@code true} if block entities as light source is enabled, else {@code false} */ - public void setEntitiesLightSource(boolean enabled) - { + public void setEntitiesLightSource(boolean enabled) { if (!enabled) this.mod.removeEntitiesLightSource(); this.config.set("light_sources.entities", enabled); @@ -167,20 +138,18 @@ public void setEntitiesLightSource(boolean enabled) /** * Returns whether block entities as light source is enabled. * - * @return True if block entities as light source is enabled, else false. + * @return {@code true} if block entities as light source is enabled, else {@code false}. */ - public boolean hasBlockEntitiesLightSource() - { + public boolean hasBlockEntitiesLightSource() { return this.config.getOrElse("light_sources.block_entities", DEFAULT_BLOCK_ENTITIES_LIGHT_SOURCE); } /** * Sets whether block entities as light source is enabled. * - * @param enabled True if block entities as light source is enabled, else false. + * @param enabled {@code true} if block entities as light source is enabled, else {@code false}. */ - public void setBlockEntitiesLightSource(boolean enabled) - { + public void setBlockEntitiesLightSource(boolean enabled) { if (!enabled) this.mod.removeBlockEntitiesLightSource(); this.config.set("light_sources.block_entities", enabled); @@ -189,40 +158,36 @@ public void setBlockEntitiesLightSource(boolean enabled) /** * Returns whether water sensitive check is enabled or not. * - * @return True if water sensitive check is enabled, else false. + * @return {@code true} if water sensitive check is enabled, else {@code false} */ - public boolean hasWaterSensitiveCheck() - { + public boolean hasWaterSensitiveCheck() { return this.config.getOrElse("light_sources.water_sensitive_check", DEFAULT_WATER_SENSITIVE_CHECK); } /** * Sets whether water sensitive check is enabled or not. * - * @param waterSensitive True if water sensitive check is enabled, else false. + * @param waterSensitive {@code true} if water sensitive check is enabled, else {@code false} */ - public void setWaterSensitiveCheck(boolean waterSensitive) - { + public void setWaterSensitiveCheck(boolean waterSensitive) { this.config.set("light_sources.water_sensitive_check", waterSensitive); } /** * Returns the Creeper dynamic lighting mode. * - * @return The Creeper dynamic lighting mode. + * @return the Creeper dynamic lighting mode */ - public ExplosiveLightingMode getCreeperLightingMode() - { + public ExplosiveLightingMode getCreeperLightingMode() { return this.creeperLightingMode; } /** * Sets the Creeper dynamic lighting mode. * - * @param lightingMode The Creeper dynamic lighting mode. + * @param lightingMode the Creeper dynamic lighting mode */ - public void setCreeperLightingMode(@NotNull ExplosiveLightingMode lightingMode) - { + public void setCreeperLightingMode(@NotNull ExplosiveLightingMode lightingMode) { this.creeperLightingMode = lightingMode; if (!lightingMode.isEnabled()) @@ -233,20 +198,18 @@ public void setCreeperLightingMode(@NotNull ExplosiveLightingMode lightingMode) /** * Returns the TNT dynamic lighting mode. * - * @return The TNT dynamic lighting mode. + * @return the TNT dynamic lighting mode */ - public ExplosiveLightingMode getTntLightingMode() - { + public ExplosiveLightingMode getTntLightingMode() { return this.tntLightingMode; } /** * Sets the TNT dynamic lighting mode. * - * @param lightingMode The TNT dynamic lighting mode. + * @param lightingMode the TNT dynamic lighting mode */ - public void setTntLightingMode(@NotNull ExplosiveLightingMode lightingMode) - { + public void setTntLightingMode(@NotNull ExplosiveLightingMode lightingMode) { this.tntLightingMode = lightingMode; if (!lightingMode.isEnabled()) diff --git a/src/main/java/me/lambdaurora/lambdynlights/DynamicLightsMode.java b/src/main/java/me/lambdaurora/lambdynlights/DynamicLightsMode.java index c7526e06..cb19d885 100644 --- a/src/main/java/me/lambdaurora/lambdynlights/DynamicLightsMode.java +++ b/src/main/java/me/lambdaurora/lambdynlights/DynamicLightsMode.java @@ -25,18 +25,16 @@ * @version 1.2.1 * @since 1.0.0 */ -public enum DynamicLightsMode implements Nameable -{ +public enum DynamicLightsMode implements Nameable { OFF(0, Formatting.RED, SpruceTexts.OPTIONS_OFF), FASTEST(500, Formatting.GOLD, SpruceTexts.OPTIONS_GENERIC_FASTEST), FAST(250, Formatting.YELLOW, SpruceTexts.OPTIONS_GENERIC_FAST), FANCY(0, Formatting.GREEN, SpruceTexts.OPTIONS_GENERIC_FANCY); - private final int delay; + private final int delay; private final Text translatedText; - DynamicLightsMode(int delay, @NotNull Formatting formatting, @NotNull Text translatedText) - { + DynamicLightsMode(int delay, @NotNull Formatting formatting, @NotNull Text translatedText) { this.delay = delay; this.translatedText = translatedText.copy().formatted(formatting); } @@ -44,40 +42,36 @@ public enum DynamicLightsMode implements Nameable /** * Returns whether this mode enables dynamic lights. * - * @return True if the mode enables dynamic lights, else false. + * @return {@code true} if the mode enables dynamic lights, else {@code false} */ - public boolean isEnabled() - { + public boolean isEnabled() { return this != OFF; } /** * Returns whether this mode has an update delay. * - * @return True if the mode has an update delay, else false. + * @return {@code true} if the mode has an update delay, else {@code false} */ - public boolean hasDelay() - { + public boolean hasDelay() { return this.delay != 0; } /** * Returns the update delay of this mode. * - * @return The mode's update delay. + * @return the mode's update delay */ - public int getDelay() - { + public int getDelay() { return this.delay; } /** * Returns the next dynamic lights mode available. * - * @return The next available dynamic lights mode. + * @return the next available dynamic lights mode */ - public DynamicLightsMode next() - { + public DynamicLightsMode next() { DynamicLightsMode[] v = values(); if (v.length == this.ordinal() + 1) return v[0]; @@ -87,27 +81,24 @@ public DynamicLightsMode next() /** * Returns the translated text of the dynamic lights mode. * - * @return The translated text of the dynamic lights mode. + * @return the translated text of the dynamic lights mode */ - public @NotNull Text getTranslatedText() - { + public @NotNull Text getTranslatedText() { return this.translatedText; } @Override - public @NotNull String getName() - { + public @NotNull String getName() { return this.name().toLowerCase(); } /** * Gets the dynamic lights mode from its identifier. * - * @param id The identifier of the dynamic lights mode. - * @return The dynamic lights mode if found, else empty. + * @param id the identifier of the dynamic lights mode + * @return the dynamic lights mode if found, else empty */ - public static @NotNull Optional byId(@NotNull String id) - { + public static @NotNull Optional byId(@NotNull String id) { return Arrays.stream(values()).filter(mode -> mode.getName().equalsIgnoreCase(id)).findFirst(); } } diff --git a/src/main/java/me/lambdaurora/lambdynlights/ExplosiveLightingMode.java b/src/main/java/me/lambdaurora/lambdynlights/ExplosiveLightingMode.java index d69ef025..cad21b15 100644 --- a/src/main/java/me/lambdaurora/lambdynlights/ExplosiveLightingMode.java +++ b/src/main/java/me/lambdaurora/lambdynlights/ExplosiveLightingMode.java @@ -25,36 +25,32 @@ * @version 1.2.1 * @since 1.2.1 */ -public enum ExplosiveLightingMode implements Nameable -{ +public enum ExplosiveLightingMode implements Nameable { OFF(Formatting.RED, SpruceTexts.OPTIONS_OFF), SIMPLE(Formatting.YELLOW, SpruceTexts.OPTIONS_GENERIC_SIMPLE), FANCY(Formatting.GREEN, SpruceTexts.OPTIONS_GENERIC_FANCY); private final Text translatedText; - ExplosiveLightingMode(@NotNull Formatting formatting, @NotNull Text translatedText) - { + ExplosiveLightingMode(@NotNull Formatting formatting, @NotNull Text translatedText) { this.translatedText = translatedText.copy().formatted(formatting); } /** * Returns whether this mode enables explosives dynamic lighting. * - * @return True if the mode enables explosives dynamic lighting, else false. + * @return {@code true} if the mode enables explosives dynamic lighting, else {@code false} */ - public boolean isEnabled() - { + public boolean isEnabled() { return this != OFF; } /** * Returns the next explosives dynamic lighting mode available. * - * @return The next available explosives dynamic lighting mode. + * @return the next available explosives dynamic lighting mode */ - public ExplosiveLightingMode next() - { + public ExplosiveLightingMode next() { ExplosiveLightingMode[] v = values(); if (v.length == this.ordinal() + 1) return v[0]; @@ -64,27 +60,24 @@ public ExplosiveLightingMode next() /** * Returns the translated text of the explosives dynamic lighting mode. * - * @return The translated text of the explosives dynamic lighting mode. + * @return the translated text of the explosives dynamic lighting mode */ - public @NotNull Text getTranslatedText() - { + public @NotNull Text getTranslatedText() { return this.translatedText; } @Override - public @NotNull String getName() - { + public @NotNull String getName() { return this.name().toLowerCase(); } /** * Gets the explosives dynamic lighting mode from its identifier. * - * @param id The identifier of the explosives dynamic lighting mode. - * @return The explosives dynamic lighting mode if found, else empty. + * @param id the identifier of the explosives dynamic lighting mode + * @return the explosives dynamic lighting mode if found, else empty */ - public static @NotNull Optional byId(@NotNull String id) - { + public static @NotNull Optional byId(@NotNull String id) { return Arrays.stream(values()).filter(mode -> mode.getName().equalsIgnoreCase(id)).findFirst(); } } diff --git a/src/main/java/me/lambdaurora/lambdynlights/LambDynLights.java b/src/main/java/me/lambdaurora/lambdynlights/LambDynLights.java index 77b76ebe..8701a035 100644 --- a/src/main/java/me/lambdaurora/lambdynlights/LambDynLights.java +++ b/src/main/java/me/lambdaurora/lambdynlights/LambDynLights.java @@ -15,7 +15,7 @@ import me.lambdaurora.lambdynlights.api.DynamicLightsInitializer; import me.lambdaurora.lambdynlights.api.item.ItemLightSources; import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; +import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents; import net.fabricmc.fabric.api.resource.ResourceManagerHelper; import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener; import net.fabricmc.loader.api.FabricLoader; @@ -24,7 +24,6 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.LightmapTextureManager; import net.minecraft.client.render.WorldRenderer; -import net.minecraft.client.toast.SystemToast; import net.minecraft.entity.Entity; import net.minecraft.entity.TntEntity; import net.minecraft.entity.mob.CreeperEntity; @@ -32,11 +31,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.resource.ResourceManager; import net.minecraft.resource.ResourceType; -import net.minecraft.text.LiteralText; -import net.minecraft.text.TranslatableText; -import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.ChunkSectionPos; import net.minecraft.util.math.MathHelper; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -44,20 +41,17 @@ import org.jetbrains.annotations.Nullable; import java.util.Iterator; -import java.util.List; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.function.Predicate; -import java.util.stream.Collectors; /** * Represents the LambDynamicLights mod. * * @author LambdAurora - * @version 1.3.2 + * @version 1.3.3 * @since 1.0.0 */ -public class LambDynLights implements ClientModInitializer -{ +public class LambDynLights implements ClientModInitializer { public static final String MODID = "lambdynlights"; private static final double MAX_RADIUS = 7.75; private static LambDynLights INSTANCE; @@ -66,57 +60,44 @@ public class LambDynLights implements ClientModInitializer private final ConcurrentLinkedQueue dynamicLightSources = new ConcurrentLinkedQueue<>(); private long lastUpdate = System.currentTimeMillis(); private int lastUpdateCount = 0; - private boolean notifiedFirstTime = false; @Override - public void onInitializeClient() - { + public void onInitializeClient() { INSTANCE = this; this.log("Initializing LambDynamicLights..."); this.config.load(); - ClientTickEvents.START_WORLD_TICK.register(world -> { - if (!this.notifiedFirstTime && this.config.isFirstTime()) { - this.notifiedFirstTime = true; - - MinecraftClient client = MinecraftClient.getInstance(); - client.getToastManager().add(SystemToast.create(client, - SystemToast.Type.TUTORIAL_HINT, - new LiteralText("LambDynamicLights").formatted(Formatting.GOLD), - new TranslatableText("lambdynlights.toast.first_time"))); - } - }); - FabricLoader.getInstance().getEntrypointContainers("dynamiclights", DynamicLightsInitializer.class) .stream().map(EntrypointContainer::getEntrypoint) .forEach(DynamicLightsInitializer::onInitializeDynamicLights); - ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(new SimpleSynchronousResourceReloadListener() - { + ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(new SimpleSynchronousResourceReloadListener() { @Override - public Identifier getFabricId() - { + public Identifier getFabricId() { return new Identifier(MODID, "dynamiclights_resources"); } @Override - public void apply(ResourceManager manager) - { + public void apply(ResourceManager manager) { ItemLightSources.load(manager); } }); + WorldRenderEvents.START.register(context -> { + MinecraftClient.getInstance().getProfiler().swap("dynamic_lighting"); + this.updateAll(context.worldRenderer()); + }); + DynamicLightHandlers.registerDefaultHandlers(); } /** * Updates all light sources. * - * @param renderer The renderer. + * @param renderer the renderer */ - public void updateAll(@NotNull WorldRenderer renderer) - { + public void updateAll(@NotNull WorldRenderer renderer) { if (!this.config.getDynamicLightsMode().isEnabled()) return; @@ -134,34 +115,31 @@ public void updateAll(@NotNull WorldRenderer renderer) /** * Returns the last number of dynamic light source updates. * - * @return The last number of dynamic light source updates. + * @return the last number of dynamic light source updates */ - public int getLastUpdateCount() - { + public int getLastUpdateCount() { return this.lastUpdateCount; } /** * Returns the lightmap with combined light levels. * - * @param pos The position. - * @param lightmap The vanilla lightmap. - * @return The modified lightmap. + * @param pos the position + * @param lightmap the vanilla lightmap coordinates + * @return the modified lightmap coordinates */ - public int getLightmapWithDynamicLight(@NotNull BlockPos pos, int lightmap) - { + public int getLightmapWithDynamicLight(@NotNull BlockPos pos, int lightmap) { return this.getLightmapWithDynamicLight(this.getDynamicLightLevel(pos), lightmap); } /** * Returns the lightmap with combined light levels. * - * @param entity The entity. - * @param lightmap The vanilla lightmap. - * @return The + * @param entity the entity + * @param lightmap the vanilla lightmap coordinates + * @return the modified lightmap coordinates */ - public int getLightmapWithDynamicLight(@NotNull Entity entity, int lightmap) - { + public int getLightmapWithDynamicLight(@NotNull Entity entity, int lightmap) { int posLightLevel = (int) this.getDynamicLightLevel(entity.getBlockPos()); int entityLuminance = ((DynamicLightSource) entity).getLuminance(); @@ -171,12 +149,11 @@ public int getLightmapWithDynamicLight(@NotNull Entity entity, int lightmap) /** * Returns the lightmap with combined light levels. * - * @param dynamicLightLevel The dynamic light level. - * @param lightmap The vanilla lightmap. - * @return The modified lightmap. + * @param dynamicLightLevel the dynamic light level + * @param lightmap the vanilla lightmap coordinates + * @return the modified lightmap coordinates */ - public int getLightmapWithDynamicLight(double dynamicLightLevel, int lightmap) - { + public int getLightmapWithDynamicLight(double dynamicLightLevel, int lightmap) { if (dynamicLightLevel > 0) { // lightmap is (skyLevel << 20 | blockLevel << 4) @@ -196,11 +173,10 @@ public int getLightmapWithDynamicLight(double dynamicLightLevel, int lightmap) /** * Returns the dynamic light level at the specified position. * - * @param pos The position. - * @return The dynamic light level at the spec + * @param pos the position + * @return the dynamic light level at the specified position */ - public double getDynamicLightLevel(@NotNull BlockPos pos) - { + public double getDynamicLightLevel(@NotNull BlockPos pos) { double result = 0; for (DynamicLightSource lightSource : this.dynamicLightSources) { result = maxDynamicLightLevel(pos, lightSource, result); @@ -212,13 +188,12 @@ public double getDynamicLightLevel(@NotNull BlockPos pos) /** * Returns the dynamic light level generated by the light source at the specified position. * - * @param pos The position. - * @param lightSource The light source. - * @param currentLightLevel The current surrounding dynamic light level. - * @return The dynamic light level. + * @param pos the position + * @param lightSource the light source + * @param currentLightLevel the current surrounding dynamic light level + * @return the dynamic light level at the specified position */ - public static double maxDynamicLightLevel(@NotNull BlockPos pos, @NotNull DynamicLightSource lightSource, double currentLightLevel) - { + public static double maxDynamicLightLevel(@NotNull BlockPos pos, @NotNull DynamicLightSource lightSource, double currentLightLevel) { int luminance = lightSource.getLuminance(); if (luminance > 0) { // Can't use Entity#squaredDistanceTo because of eye Y coordinate. @@ -240,24 +215,12 @@ public static double maxDynamicLightLevel(@NotNull BlockPos pos, @NotNull Dynami return currentLightLevel; } - /** - * Returns the dynamic luminance at the specified position. - * - * @param pos The position. - * @return The dynamic luminance. - */ - public int getDynamicLuminanceAt(@NotNull BlockPos pos) - { - return 0; - } - /** * Adds the light source to the tracked light sources. * - * @param lightSource The light source to add. + * @param lightSource the light source to add */ - public void addLightSource(@NotNull DynamicLightSource lightSource) - { + public void addLightSource(@NotNull DynamicLightSource lightSource) { if (!lightSource.getDynamicLightWorld().isClient()) return; if (!this.config.getDynamicLightsMode().isEnabled()) @@ -270,11 +233,10 @@ public void addLightSource(@NotNull DynamicLightSource lightSource) /** * Returns whether the light source is tracked or not. * - * @param lightSource The light source to check. - * @return True if the light source is tracked, else false. + * @param lightSource the light source to check + * @return {@code true} if the light source is tracked, else {@code false} */ - public boolean containsLightSource(@NotNull DynamicLightSource lightSource) - { + public boolean containsLightSource(@NotNull DynamicLightSource lightSource) { if (!lightSource.getDynamicLightWorld().isClient()) return false; return this.dynamicLightSources.contains(lightSource); @@ -283,20 +245,18 @@ public boolean containsLightSource(@NotNull DynamicLightSource lightSource) /** * Returns the number of dynamic light sources that currently emit lights. * - * @return The number of dynamic light sources emitting light. + * @return the number of dynamic light sources emitting light */ - public int getLightSourcesCount() - { + public int getLightSourcesCount() { return this.dynamicLightSources.size(); } /** * Removes the light source from the tracked light sources. * - * @param lightSource The light source to remove. + * @param lightSource the light source to remove */ - public void removeLightSource(@NotNull DynamicLightSource lightSource) - { + public void removeLightSource(@NotNull DynamicLightSource lightSource) { Iterator dynamicLightSources = this.dynamicLightSources.iterator(); DynamicLightSource it; while (dynamicLightSources.hasNext()) { @@ -313,8 +273,7 @@ public void removeLightSource(@NotNull DynamicLightSource lightSource) /** * Clears light sources. */ - public void clearLightSources() - { + public void clearLightSources() { Iterator dynamicLightSources = this.dynamicLightSources.iterator(); DynamicLightSource it; while (dynamicLightSources.hasNext()) { @@ -331,10 +290,9 @@ public void clearLightSources() /** * Removes light sources if the filter matches. * - * @param filter Filter. + * @param filter the removal filter */ - public void removeLightSources(@NotNull Predicate filter) - { + public void removeLightSources(@NotNull Predicate filter) { Iterator dynamicLightSources = this.dynamicLightSources.iterator(); DynamicLightSource it; while (dynamicLightSources.hasNext()) { @@ -354,75 +312,82 @@ public void removeLightSources(@NotNull Predicate filter) /** * Removes entities light source from tracked light sources. */ - public void removeEntitiesLightSource() - { + public void removeEntitiesLightSource() { this.removeLightSources(lightSource -> (lightSource instanceof Entity && !(lightSource instanceof PlayerEntity))); } /** * Removes Creeper light sources from tracked light sources. */ - public void removeCreeperLightSources() - { + public void removeCreeperLightSources() { this.removeLightSources(entity -> entity instanceof CreeperEntity); } /** * Removes TNT light sources from tracked light sources. */ - public void removeTntLightSources() - { + public void removeTntLightSources() { this.removeLightSources(entity -> entity instanceof TntEntity); } /** * Removes block entities light source from tracked light sources. */ - public void removeBlockEntitiesLightSource() - { + public void removeBlockEntitiesLightSource() { this.removeLightSources(lightSource -> lightSource instanceof BlockEntity); } /** * Prints a message to the terminal. * - * @param info The message to print. + * @param info the message to print */ - public void log(String info) - { + public void log(String info) { this.logger.info("[LambDynLights] " + info); } /** * Prints a warning message to the terminal. * - * @param info The message to print. + * @param info the message to print */ - public void warn(String info) - { + public void warn(String info) { this.logger.warn("[LambDynLights] " + info); } /** * Schedules a chunk rebuild at the specified chunk position. * - * @param renderer The renderer. - * @param chunkPos The chunk position. + * @param renderer the renderer + * @param chunkPos the chunk position */ - public static void scheduleChunkRebuild(@NotNull WorldRenderer renderer, @NotNull BlockPos chunkPos) - { - ((WorldRendererAccessor) renderer).lambdynlights_scheduleChunkRebuild(chunkPos.getX(), chunkPos.getY(), chunkPos.getZ(), false); + public static void scheduleChunkRebuild(@NotNull WorldRenderer renderer, @NotNull BlockPos chunkPos) { + scheduleChunkRebuild(renderer, chunkPos.getX(), chunkPos.getY(), chunkPos.getZ()); + } + + /** + * Schedules a chunk rebuild at the specified chunk position. + * + * @param renderer the renderer + * @param chunkPos the packed chunk position + */ + public static void scheduleChunkRebuild(@NotNull WorldRenderer renderer, long chunkPos) { + scheduleChunkRebuild(renderer, ChunkSectionPos.unpackX(chunkPos), ChunkSectionPos.unpackY(chunkPos), ChunkSectionPos.unpackZ(chunkPos)); + } + + public static void scheduleChunkRebuild(@NotNull WorldRenderer renderer, int x, int y, int z) { + if (MinecraftClient.getInstance().world != null) + ((WorldRendererAccessor) renderer).lambdynlights_scheduleChunkRebuild(x, y, z, false); } /** * Updates the tracked chunk sets. * - * @param chunkPos The chunk position. - * @param old The set of old chunk coordinates to remove this chunk from it. - * @param newPos The set of new chunk coordinates to add this chunk to it. + * @param chunkPos the packed chunk position + * @param old the set of old chunk coordinates to remove this chunk from it + * @param newPos the set of new chunk coordinates to add this chunk to it */ - public static void updateTrackedChunks(@NotNull BlockPos chunkPos, @Nullable LongOpenHashSet old, @Nullable LongOpenHashSet newPos) - { + public static void updateTrackedChunks(@NotNull BlockPos chunkPos, @Nullable LongOpenHashSet old, @Nullable LongOpenHashSet newPos) { if (old != null || newPos != null) { long pos = chunkPos.asLong(); if (old != null) @@ -435,10 +400,9 @@ public static void updateTrackedChunks(@NotNull BlockPos chunkPos, @Nullable Lon /** * Updates the dynamic lights tracking. * - * @param lightSource The light source. + * @param lightSource the light source */ - public static void updateTracking(@NotNull DynamicLightSource lightSource) - { + public static void updateTracking(@NotNull DynamicLightSource lightSource) { if (!lightSource.isDynamicLightEnabled() && lightSource.getLuminance() > 0) { lightSource.setDynamicLightEnabled(true); } else if (lightSource.isDynamicLightEnabled() && lightSource.getLuminance() < 1) { @@ -449,22 +413,20 @@ public static void updateTracking(@NotNull DynamicLightSource lightSource) /** * Returns the luminance from an item stack. * - * @param stack The item stack. - * @param submergedInWater True if the stack is submerged in water, else false. - * @return The luminance of the item. + * @param stack the item stack + * @param submergedInWater {@code true} if the stack is submerged in water, else {@code false} + * @return the luminance of the item */ - public static int getLuminanceFromItemStack(@NotNull ItemStack stack, boolean submergedInWater) - { + public static int getLuminanceFromItemStack(@NotNull ItemStack stack, boolean submergedInWater) { return ItemLightSources.getLuminance(stack, submergedInWater); } /** * Returns the LambDynamicLights mod instance. * - * @return The mod instance. + * @return the mod instance */ - public static LambDynLights get() - { + public static LambDynLights get() { return INSTANCE; } } diff --git a/src/main/java/me/lambdaurora/lambdynlights/LambDynLightsCompat.java b/src/main/java/me/lambdaurora/lambdynlights/LambDynLightsCompat.java index 28e4f841..0e2a8f53 100644 --- a/src/main/java/me/lambdaurora/lambdynlights/LambDynLightsCompat.java +++ b/src/main/java/me/lambdaurora/lambdynlights/LambDynLightsCompat.java @@ -15,50 +15,36 @@ * Represents a utility class for compatibility. * * @author LambdAurora - * @version 1.3.1 + * @version 1.3.3 * @since 1.0.0 */ -public final class LambDynLightsCompat -{ +public final class LambDynLightsCompat { /** * Returns whether Canvas is installed. * - * @return True if Canvas is installed, else false. + * @return {@code true} if Canvas is installed, else {@code false} */ - public static boolean isCanvasInstalled() - { + public static boolean isCanvasInstalled() { return FabricLoader.getInstance().isModLoaded("canvas"); } /** * Returns whether Lil Tater Reloaded is installed. * - * @return True if LTR is installed, else false. + * @return {@code true} if LTR is installed, else {@code false} */ - public static boolean isLilTaterReloadedInstalled() - { + public static boolean isLilTaterReloadedInstalled() { // Don't even think about it Yog. return FabricLoader.getInstance().isModLoaded("ltr"); } - /** - * Returns whether Sodium is installed. - * - * @return True if Sodium is installed, else false. - */ - public static boolean isSodiumInstalled() - { - return FabricLoader.getInstance().isModLoaded("sodium"); - } - /** * Returns whether Sodium 0.1.0 is installed. * - * @return True if Sodium 0.1.0 is installed, else false. + * @return {@code true} if Sodium 0.1.0 is installed, else {@code false} */ - public static boolean isSodium010Installed() - { - return FabricLoader.getInstance().getModContainer("sodium").map(mod -> mod.getMetadata().getVersion().getFriendlyString().equalsIgnoreCase("0.1.0")) + public static boolean isSodium010Installed() { + return FabricLoader.getInstance().getModContainer("sodium").map(mod -> mod.getMetadata().getVersion().getFriendlyString().startsWith("0.1.0")) .orElse(false); } } diff --git a/src/main/java/me/lambdaurora/lambdynlights/LambDynLightsMixinPlugin.java b/src/main/java/me/lambdaurora/lambdynlights/LambDynLightsMixinPlugin.java index 7acb8f1e..5b729388 100644 --- a/src/main/java/me/lambdaurora/lambdynlights/LambDynLightsMixinPlugin.java +++ b/src/main/java/me/lambdaurora/lambdynlights/LambDynLightsMixinPlugin.java @@ -21,7 +21,7 @@ * LambDynamicLights mixin plugin for conditional mixins. * * @author LambdAurora - * @version 1.3.1 + * @version 1.3.3 * @since 1.0.0 */ public class LambDynLightsMixinPlugin implements IMixinConfigPlugin @@ -34,9 +34,6 @@ public LambDynLightsMixinPlugin() this.conditionalMixins.put("me.lambdaurora.lambdynlights.mixin.ltr.LilTaterBlocksMixin", ltrInstalled); this.conditionalMixins.put("me.lambdaurora.lambdynlights.mixin.ltr.LilTaterBlockEntityMixin", ltrInstalled); - boolean canvasInstalled = LambDynLightsCompat.isCanvasInstalled(); - boolean sodiumInstalled = LambDynLightsCompat.isSodiumInstalled(); - this.conditionalMixins.put("me.lambdaurora.lambdynlights.mixin.WorldRendererMixin", !sodiumInstalled && !canvasInstalled); this.conditionalMixins.put("me.lambdaurora.lambdynlights.mixin.EntityLighterMixin", LambDynLightsCompat.isSodium010Installed()); } diff --git a/src/main/java/me/lambdaurora/lambdynlights/gui/DynamicLightsOptionsOption.java b/src/main/java/me/lambdaurora/lambdynlights/gui/DynamicLightsOptionsOption.java new file mode 100644 index 00000000..df319ddd --- /dev/null +++ b/src/main/java/me/lambdaurora/lambdynlights/gui/DynamicLightsOptionsOption.java @@ -0,0 +1,37 @@ +/* + * Copyright © 2020 LambdAurora + * + * This file is part of LambDynamicLights. + * + * Licensed under the MIT license. For more information, + * see the LICENSE file. + */ + +package me.lambdaurora.lambdynlights.gui; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.widget.AbstractButtonWidget; +import net.minecraft.client.gui.widget.ButtonWidget; +import net.minecraft.client.options.GameOptions; +import net.minecraft.client.options.Option; +import net.minecraft.text.Text; +import net.minecraft.text.TranslatableText; + +public final class DynamicLightsOptionsOption extends Option { + private static final String KEY = "lambdynlights.menu.title"; + private final Text text; + + private final Screen parent; + + public DynamicLightsOptionsOption(Screen parent) { + super(KEY); + this.text = new TranslatableText(KEY); + this.parent = parent; + } + + @Override + public AbstractButtonWidget createButton(GameOptions options, int x, int y, int width) { + return new ButtonWidget(x, y, width, 20, this.text, btn -> MinecraftClient.getInstance().openScreen(new SettingsScreen(this.parent))); + } +} diff --git a/src/main/java/me/lambdaurora/lambdynlights/gui/SettingsScreen.java b/src/main/java/me/lambdaurora/lambdynlights/gui/SettingsScreen.java index faac0420..3309dbc9 100644 --- a/src/main/java/me/lambdaurora/lambdynlights/gui/SettingsScreen.java +++ b/src/main/java/me/lambdaurora/lambdynlights/gui/SettingsScreen.java @@ -13,16 +13,13 @@ import me.lambdaurora.lambdynlights.ExplosiveLightingMode; import me.lambdaurora.lambdynlights.LambDynLights; import me.lambdaurora.lambdynlights.LambDynLightsCompat; -import me.lambdaurora.spruceui.Tooltip; -import me.lambdaurora.spruceui.option.SpruceBooleanOption; -import me.lambdaurora.spruceui.option.SpruceCyclingOption; -import me.lambdaurora.spruceui.option.SpruceResetOption; -import me.lambdaurora.spruceui.option.SpruceSeparatorOption; +import me.lambdaurora.spruceui.Position; +import me.lambdaurora.spruceui.option.*; +import me.lambdaurora.spruceui.screen.SpruceScreen; +import me.lambdaurora.spruceui.widget.SpruceButtonWidget; +import me.lambdaurora.spruceui.widget.container.SpruceOptionListWidget; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.widget.ButtonListWidget; -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.options.Option; import net.minecraft.client.resource.language.I18n; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.TranslatableText; @@ -32,23 +29,21 @@ * Represents the settings screen of LambDynamicLights. * * @author LambdAurora - * @version 1.3.0 + * @version 1.3.3 * @since 1.0.0 */ -public class SettingsScreen extends Screen -{ +public class SettingsScreen extends SpruceScreen { private final DynamicLightsConfig config; - private final Screen parent; - private final Option entitiesOption; - private final Option blockEntitiesOption; - private final Option waterSensitiveOption; - private final Option creeperLightingOption; - private final Option tntLightingOption; - private final Option resetOption; - private ButtonListWidget list; + private final Screen parent; + private final SpruceOption entitiesOption; + private final SpruceOption blockEntitiesOption; + private final SpruceOption waterSensitiveOption; + private final SpruceOption creeperLightingOption; + private final SpruceOption tntLightingOption; + private final SpruceOption resetOption; + private SpruceOptionListWidget list; - public SettingsScreen(@Nullable Screen parent) - { + public SettingsScreen(@Nullable Screen parent) { super(new TranslatableText("lambdynlights.menu.title")); this.parent = parent; this.config = LambDynLights.get().config; @@ -79,7 +74,7 @@ public SettingsScreen(@Nullable Screen parent) ExplosiveLightingMode.OFF.getTranslatedText(), ExplosiveLightingMode.SIMPLE.getTranslatedText(), ExplosiveLightingMode.FANCY.getTranslatedText())); - this.resetOption = new SpruceResetOption(btn -> { + this.resetOption = SpruceSimpleActionOption.reset(btn -> { this.config.reset(); MinecraftClient client = MinecraftClient.getInstance(); this.init(client, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight()); @@ -87,49 +82,38 @@ public SettingsScreen(@Nullable Screen parent) } @Override - public void removed() - { + public void removed() { super.removed(); this.config.save(); } - private int getTextHeight() - { + private int getTextHeight() { return (5 + this.textRenderer.fontHeight) * 3 + 5; } @Override - protected void init() - { + protected void init() { super.init(); - int buttonHeight = 20; - this.list = new ButtonListWidget(this.client, this.width, this.height, 43, this.height - 29 - this.getTextHeight(), 25); + this.list = new SpruceOptionListWidget(Position.of(this, 0, 43), this.width, this.height - 43 - 29 - this.getTextHeight()); this.list.addSingleOptionEntry(this.config.dynamicLightsModeOption); this.list.addSingleOptionEntry(new SpruceSeparatorOption("lambdynlights.menu.light_sources", true, null)); this.list.addOptionEntry(this.entitiesOption, this.blockEntitiesOption); this.list.addOptionEntry(this.waterSensitiveOption, null); this.list.addOptionEntry(this.creeperLightingOption, this.tntLightingOption); - this.children.add(list); + this.addChild(list); - this.addButton(this.resetOption.createButton(this.client.options, this.width / 2 - 155, this.height - 29, 150)); - this.addButton(new ButtonWidget(this.width / 2 - 155 + 160, this.height - 29, 150, buttonHeight, new TranslatableText("gui.done"), - (buttonWidget) -> this.client.openScreen(this.parent))); + this.addChild(this.resetOption.createWidget(Position.of(this, this.width / 2 - 155, this.height - 29), 150)); + this.addChild(new SpruceButtonWidget(Position.of(this, this.width / 2 - 155 + 160, this.height - 29), 150, 20, new TranslatableText("gui.done"), + (btn) -> this.client.openScreen(this.parent))); } @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) - { - this.renderBackground(matrices); - this.list.render(matrices, mouseX, mouseY, delta); - super.render(matrices, mouseX, mouseY, delta); - drawCenteredText(matrices, this.textRenderer, this.title, this.width / 2, 8, 16777215); - + public void renderTitle(MatrixStack matrices, int mouseX, int mouseY, float delta) { + drawCenteredText(matrices, this.textRenderer, this.title, this.width / 2, 18, 16777215); if (LambDynLightsCompat.isCanvasInstalled()) { drawCenteredString(matrices, this.textRenderer, I18n.translate("lambdynlights.menu.canvas.1"), this.width / 2, this.height - 29 - (5 + this.textRenderer.fontHeight) * 3, 0xFFFF0000); drawCenteredString(matrices, this.textRenderer, I18n.translate("lambdynlights.menu.canvas.2"), this.width / 2, this.height - 29 - (5 + this.textRenderer.fontHeight) * 2, 0xFFFF0000); } - - Tooltip.renderAll(matrices); } } diff --git a/src/main/java/me/lambdaurora/lambdynlights/mixin/CommonWorldRendererMixin.java b/src/main/java/me/lambdaurora/lambdynlights/mixin/CommonWorldRendererMixin.java index 89cbf89f..bfccc3d6 100644 --- a/src/main/java/me/lambdaurora/lambdynlights/mixin/CommonWorldRendererMixin.java +++ b/src/main/java/me/lambdaurora/lambdynlights/mixin/CommonWorldRendererMixin.java @@ -34,26 +34,10 @@ @Mixin(value = WorldRenderer.class, priority = 900) public abstract class CommonWorldRendererMixin implements WorldRendererAccessor { - @Shadow - @Final - private MinecraftClient client; - @Invoker("scheduleChunkRender") @Override public abstract void lambdynlights_scheduleChunkRebuild(int x, int y, int z, boolean important); - @Inject( - method = "render", - at = @At("HEAD") - ) - private void onRender(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, CallbackInfo ci) - { - if (LambDynLightsCompat.isSodiumInstalled() || LambDynLightsCompat.isCanvasInstalled()) { - this.client.getProfiler().swap("dynamic_lighting"); - LambDynLights.get().updateAll((WorldRenderer) (Object) this); - } - } - @Inject( method = "getLightmapCoordinates(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;)I", at = @At("TAIL"), diff --git a/src/main/java/me/lambdaurora/lambdynlights/mixin/VideoOptionsScreenMixin.java b/src/main/java/me/lambdaurora/lambdynlights/mixin/VideoOptionsScreenMixin.java index 0e672ae3..a03ada02 100644 --- a/src/main/java/me/lambdaurora/lambdynlights/mixin/VideoOptionsScreenMixin.java +++ b/src/main/java/me/lambdaurora/lambdynlights/mixin/VideoOptionsScreenMixin.java @@ -9,9 +9,8 @@ package me.lambdaurora.lambdynlights.mixin; -import me.lambdaurora.lambdynlights.gui.SettingsScreen; +import me.lambdaurora.lambdynlights.gui.DynamicLightsOptionsOption; import me.lambdaurora.spruceui.Tooltip; -import me.lambdaurora.spruceui.option.SpruceSimpleActionOption; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.VideoOptionsScreen; import net.minecraft.client.gui.screen.options.GameOptionsScreen; @@ -22,38 +21,35 @@ import net.minecraft.text.Text; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(VideoOptionsScreen.class) -public class VideoOptionsScreenMixin extends GameOptionsScreen -{ +public class VideoOptionsScreenMixin extends GameOptionsScreen { @Shadow private ButtonListWidget list; - private Option lambdynlights_option; + @Unique + private Option lambdynlights$option; - public VideoOptionsScreenMixin(Screen parent, GameOptions gameOptions, Text title) - { + public VideoOptionsScreenMixin(Screen parent, GameOptions gameOptions, Text title) { super(parent, gameOptions, title); } @Inject(method = "", at = @At("TAIL")) - private void onConstruct(Screen parent, GameOptions gameOptions, CallbackInfo ci) - { - this.lambdynlights_option = new SpruceSimpleActionOption("lambdynlights.menu.title", btn -> this.client.openScreen(new SettingsScreen(this))); + private void onConstruct(Screen parent, GameOptions gameOptions, CallbackInfo ci) { + this.lambdynlights$option = new DynamicLightsOptionsOption(this); } @Inject(method = "init", at = @At("TAIL")) - private void onInit(CallbackInfo ci) - { - this.list.addSingleOptionEntry(this.lambdynlights_option); + private void onInit(CallbackInfo ci) { + this.list.addSingleOptionEntry(this.lambdynlights$option); } @Inject(method = "render", at = @At("TAIL")) - private void onRender(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) - { - Tooltip.renderAll(matrices); + private void onRender(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { + Tooltip.renderAll(this, matrices); } } diff --git a/src/main/java/me/lambdaurora/lambdynlights/mixin/WorldRendererMixin.java b/src/main/java/me/lambdaurora/lambdynlights/mixin/WorldRendererMixin.java deleted file mode 100644 index 2935135d..00000000 --- a/src/main/java/me/lambdaurora/lambdynlights/mixin/WorldRendererMixin.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright © 2020 LambdAurora - * - * This file is part of LambDynamicLights. - * - * Licensed under the MIT license. For more information, - * see the LICENSE file. - */ - -package me.lambdaurora.lambdynlights.mixin; - -import me.lambdaurora.lambdynlights.LambDynLights; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.Camera; -import net.minecraft.client.render.Frustum; -import net.minecraft.client.render.WorldRenderer; -import org.spongepowered.asm.mixin.Final; -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(WorldRenderer.class) -public class WorldRendererMixin -{ - @Shadow - @Final - private MinecraftClient client; - - @Inject(method = "setupTerrain", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/chunk/ChunkBuilder;setCameraPosition(Lnet/minecraft/util/math/Vec3d;)V", shift = At.Shift.AFTER)) - private void onSetupTerrain(Camera camera, Frustum frustum, boolean hasForcedFrustum, int frame, boolean spectator, CallbackInfo ci) - { - this.client.getProfiler().swap("dynamic_lighting"); - LambDynLights.get().updateAll((WorldRenderer) (Object) this); - } -} diff --git a/src/main/java/me/lambdaurora/lambdynlights/mixin/lightsource/BlockEntityMixin.java b/src/main/java/me/lambdaurora/lambdynlights/mixin/lightsource/BlockEntityMixin.java index 636c39cc..f50c7599 100644 --- a/src/main/java/me/lambdaurora/lambdynlights/mixin/lightsource/BlockEntityMixin.java +++ b/src/main/java/me/lambdaurora/lambdynlights/mixin/lightsource/BlockEntityMixin.java @@ -15,8 +15,10 @@ import me.lambdaurora.lambdynlights.LambDynLights; import me.lambdaurora.lambdynlights.api.DynamicLightHandlers; import net.minecraft.block.entity.BlockEntity; +import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.WorldRenderer; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.ChunkSectionPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; @@ -133,7 +135,7 @@ public boolean lambdynlights_updateDynamicLight(@NotNull WorldRenderer renderer) this.lambdynlights_lastLuminance = luminance; if (this.trackedLitChunkPos.isEmpty()) { - BlockPos chunkPos = new BlockPos(MathHelper.floorDiv(this.pos.getX(), 16), + BlockPos.Mutable chunkPos = new BlockPos.Mutable(MathHelper.floorDiv(this.pos.getX(), 16), MathHelper.floorDiv(this.pos.getY(), 16), MathHelper.floorDiv(this.pos.getZ(), 16)); @@ -145,14 +147,14 @@ public boolean lambdynlights_updateDynamicLight(@NotNull WorldRenderer renderer) for (int i = 0; i < 7; i++) { if (i % 4 == 0) { - chunkPos = chunkPos.offset(directionX); // X + chunkPos.move(directionX); // X } else if (i % 4 == 1) { - chunkPos = chunkPos.offset(directionZ); // XZ + chunkPos.move(directionZ); // XZ } else if (i % 4 == 2) { - chunkPos = chunkPos.offset(directionX.getOpposite()); // Z + chunkPos.move(directionX.getOpposite()); // Z } else { - chunkPos = chunkPos.offset(directionZ.getOpposite()); // origin - chunkPos = chunkPos.offset(directionY); // Y + chunkPos.move(directionZ.getOpposite()); // origin + chunkPos.move(directionY); // Y } LambDynLights.updateTrackedChunks(chunkPos, null, this.trackedLitChunkPos); } @@ -168,8 +170,9 @@ public boolean lambdynlights_updateDynamicLight(@NotNull WorldRenderer renderer) @Override public void lambdynlights_scheduleTrackedChunksRebuild(@NotNull WorldRenderer renderer) { + if (this.world == MinecraftClient.getInstance().world) for (long pos : this.trackedLitChunkPos) { - LambDynLights.scheduleChunkRebuild(renderer, BlockPos.fromLong(pos)); + LambDynLights.scheduleChunkRebuild(renderer, pos); } } } diff --git a/src/main/java/me/lambdaurora/lambdynlights/mixin/lightsource/EntityMixin.java b/src/main/java/me/lambdaurora/lambdynlights/mixin/lightsource/EntityMixin.java index 36daff80..15447c9e 100644 --- a/src/main/java/me/lambdaurora/lambdynlights/mixin/lightsource/EntityMixin.java +++ b/src/main/java/me/lambdaurora/lambdynlights/mixin/lightsource/EntityMixin.java @@ -14,6 +14,7 @@ import me.lambdaurora.lambdynlights.DynamicLightsMode; import me.lambdaurora.lambdynlights.LambDynLights; import me.lambdaurora.lambdynlights.api.DynamicLightHandlers; +import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.WorldRenderer; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; @@ -29,8 +30,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(Entity.class) -public abstract class EntityMixin implements DynamicLightSource -{ +public abstract class EntityMixin implements DynamicLightSource { @Shadow public World world; @@ -72,8 +72,7 @@ public abstract class EntityMixin implements DynamicLightSource private LongOpenHashSet trackedLitChunkPos = new LongOpenHashSet(); @Inject(method = "tick", at = @At("TAIL")) - public void onTick(CallbackInfo ci) - { + public void onTick(CallbackInfo ci) { // We do not want to update the entity on the server. if (this.world.isClient()) { if (this.removed) { @@ -88,45 +87,38 @@ public void onTick(CallbackInfo ci) } @Inject(method = "remove", at = @At("TAIL")) - public void onRemove(CallbackInfo ci) - { + public void onRemove(CallbackInfo ci) { if (this.world.isClient()) this.setDynamicLightEnabled(false); } @Override - public double getDynamicLightX() - { + public double getDynamicLightX() { return this.getX(); } @Override - public double getDynamicLightY() - { + public double getDynamicLightY() { return this.getEyeY(); } @Override - public double getDynamicLightZ() - { + public double getDynamicLightZ() { return this.getZ(); } @Override - public World getDynamicLightWorld() - { + public World getDynamicLightWorld() { return this.world; } @Override - public void resetDynamicLight() - { + public void resetDynamicLight() { this.lambdynlights_lastLuminance = 0; } @Override - public boolean shouldUpdateDynamicLight() - { + public boolean shouldUpdateDynamicLight() { DynamicLightsMode mode = LambDynLights.get().config.getDynamicLightsMode(); if (!mode.isEnabled()) return false; @@ -142,8 +134,7 @@ public boolean shouldUpdateDynamicLight() } @Override - public void dynamicLightTick() - { + public void dynamicLightTick() { this.lambdynlights_luminance = this.isOnFire() ? 15 : 0; int luminance = DynamicLightHandlers.getLuminanceFrom((Entity) (Object) this); @@ -152,17 +143,14 @@ public void dynamicLightTick() } @Override - public int getLuminance() - { + public int getLuminance() { return this.lambdynlights_luminance; } @Override - public boolean lambdynlights_updateDynamicLight(@NotNull WorldRenderer renderer) - { + public boolean lambdynlights_updateDynamicLight(@NotNull WorldRenderer renderer) { if (!this.shouldUpdateDynamicLight()) return false; - double deltaX = this.getX() - this.lambdynlights_prevX; double deltaY = this.getY() - this.lambdynlights_prevY; double deltaZ = this.getZ() - this.lambdynlights_prevZ; @@ -178,7 +166,7 @@ public boolean lambdynlights_updateDynamicLight(@NotNull WorldRenderer renderer) LongOpenHashSet newPos = new LongOpenHashSet(); if (luminance > 0) { - BlockPos chunkPos = new BlockPos(this.chunkX, MathHelper.floorDiv((int) this.getEyeY(), 16), this.chunkZ); + BlockPos.Mutable chunkPos = new BlockPos.Mutable(this.chunkX, MathHelper.floorDiv((int) this.getEyeY(), 16), this.chunkZ); LambDynLights.scheduleChunkRebuild(renderer, chunkPos); LambDynLights.updateTrackedChunks(chunkPos, this.trackedLitChunkPos, newPos); @@ -189,14 +177,14 @@ public boolean lambdynlights_updateDynamicLight(@NotNull WorldRenderer renderer) for (int i = 0; i < 7; i++) { if (i % 4 == 0) { - chunkPos = chunkPos.offset(directionX); // X + chunkPos.move(directionX); // X } else if (i % 4 == 1) { - chunkPos = chunkPos.offset(directionZ); // XZ + chunkPos.move(directionZ); // XZ } else if (i % 4 == 2) { - chunkPos = chunkPos.offset(directionX.getOpposite()); // Z + chunkPos.move(directionX.getOpposite()); // Z } else { - chunkPos = chunkPos.offset(directionZ.getOpposite()); // origin - chunkPos = chunkPos.offset(directionY); // Y + chunkPos.move(directionZ.getOpposite()); // origin + chunkPos.move(directionY); // Y } LambDynLights.scheduleChunkRebuild(renderer, chunkPos); LambDynLights.updateTrackedChunks(chunkPos, this.trackedLitChunkPos, newPos); @@ -213,10 +201,10 @@ public boolean lambdynlights_updateDynamicLight(@NotNull WorldRenderer renderer) } @Override - public void lambdynlights_scheduleTrackedChunksRebuild(@NotNull WorldRenderer renderer) - { - for (long pos : this.trackedLitChunkPos) { - LambDynLights.scheduleChunkRebuild(renderer, BlockPos.fromLong(pos)); - } + public void lambdynlights_scheduleTrackedChunksRebuild(@NotNull WorldRenderer renderer) { + if (MinecraftClient.getInstance().world == this.world) + for (long pos : this.trackedLitChunkPos) { + LambDynLights.scheduleChunkRebuild(renderer, pos); + } } } diff --git a/src/main/resources/assets/lambdynlights/lang/de_de.json b/src/main/resources/assets/lambdynlights/lang/de_de.json index e53e590e..666b2b4d 100644 --- a/src/main/resources/assets/lambdynlights/lang/de_de.json +++ b/src/main/resources/assets/lambdynlights/lang/de_de.json @@ -7,7 +7,6 @@ "lambdynlights.option.entities": "Objekte", "lambdynlights.option.mode": "Dynamische Lichter", "lambdynlights.option.water_sensitive": "Wasserempfindlichkeit", - "lambdynlights.toast.first_time": "Standardmäßig ausgeschaltet, prüfen Sie in den Mod- oder Videoeinstellungen nach!", "lambdynlights.tooltip.block_entities": "Schaltet dynamische Beleuchtung für Blockobjekte ein.", "lambdynlights.tooltip.creeper_lighting": "Ändert das Verhalten der dynamische Beleuchtung bei Creepern\n- %s schaltet dieses aus.\n- %s: konstante Beleuchtung durch explodierende Creepers.\n- %s: Zunehmende Beleuchtung durch explodierende Creepers.", "lambdynlights.tooltip.entities": "Aktiviert die dynamische Beleuchtung von Objekten. (Spielerbeleuchtung ist immer aktiviert)", diff --git a/src/main/resources/assets/lambdynlights/lang/en_us.json b/src/main/resources/assets/lambdynlights/lang/en_us.json index c332e93b..50342f15 100644 --- a/src/main/resources/assets/lambdynlights/lang/en_us.json +++ b/src/main/resources/assets/lambdynlights/lang/en_us.json @@ -7,7 +7,6 @@ "lambdynlights.option.entities": "Entities", "lambdynlights.option.mode": "Dynamic Lights", "lambdynlights.option.water_sensitive": "Water Sensitivity Check", - "lambdynlights.toast.first_time": "Disabled by default, check out mod or Video Settings!", "lambdynlights.tooltip.block_entities": "Enables block entities dynamic lighting.", "lambdynlights.tooltip.creeper_lighting": "Sets the Creeper dynamic lighting mode.\n- %s disables Creeper dynamic lighting.\n- %s sets a constant luminance.\n- %s sets a dynamic luminance.", "lambdynlights.tooltip.entities": "Enables entities dynamic lighting. Note: players are always active.", diff --git a/src/main/resources/assets/lambdynlights/lang/es_mx.json b/src/main/resources/assets/lambdynlights/lang/es_mx.json index 7ed3efdb..9737c424 100644 --- a/src/main/resources/assets/lambdynlights/lang/es_mx.json +++ b/src/main/resources/assets/lambdynlights/lang/es_mx.json @@ -7,7 +7,6 @@ "lambdynlights.option.entities": "Entidades", "lambdynlights.option.mode": "Iluminación dinámica", "lambdynlights.option.water_sensitive": "Verificación de sensibilidad al agua", - "lambdynlights.toast.first_time": "Deshabilitado por defecto, prueba al configuración del mod o gráficos!", "lambdynlights.tooltip.block_entities": "Habilita la iluminación dinámica de entidades de bloque.", "lambdynlights.tooltip.creeper_lighting": "Establece el modo de iluminación dinámica del Creeper.\n%s - Deshabilita la iluminación dinámica del Creeper.\n%s - Establece una luminancia constante.\n%s - Establece una luminancia dinámica.", "lambdynlights.tooltip.entities": "Habilita la iluminación dinámica de entidades. Nota: los jugadores siempre están activos.", diff --git a/src/main/resources/assets/lambdynlights/lang/et_ee.json b/src/main/resources/assets/lambdynlights/lang/et_ee.json index 13bece4b..18c6f7dc 100644 --- a/src/main/resources/assets/lambdynlights/lang/et_ee.json +++ b/src/main/resources/assets/lambdynlights/lang/et_ee.json @@ -7,7 +7,6 @@ "lambdynlights.option.entities": "Olemid", "lambdynlights.option.mode": "Dünaamiline valgustus", "lambdynlights.option.water_sensitive": "Vee tundlikkuse kontroll", - "lambdynlights.toast.first_time": "Vaikimisi keelatud, vaata üle modi- või graafikaseaded!", "lambdynlights.tooltip.block_entities": "Lubab dünaamilise valgustuse plokiolemitele.", "lambdynlights.tooltip.creeper_lighting": "Määrab creeperi dünaamilise valgustuse režiimi.\n- %s keelab creeperi dünaamilise valgustuse.\n- %s määrab püsiva ereduse.\n- %s määrab dünaamilise ereduse.", "lambdynlights.tooltip.entities": "Lubab olemite dünaamilise valgustuse. Märkus: mängijad on alati aktiivsed.", diff --git a/src/main/resources/assets/lambdynlights/lang/fr_ca.json b/src/main/resources/assets/lambdynlights/lang/fr_ca.json index 572bbf2c..356d6bd7 100644 --- a/src/main/resources/assets/lambdynlights/lang/fr_ca.json +++ b/src/main/resources/assets/lambdynlights/lang/fr_ca.json @@ -7,7 +7,6 @@ "lambdynlights.option.entities": "Entités", "lambdynlights.option.mode": "Lumières dynamiques", "lambdynlights.option.water_sensitive": "Sensibilité à l'eau", - "lambdynlights.toast.first_time": "Désactivé par défaut, veuillez vérifier les paramètres vidéo ou les paramètres du mod!", "lambdynlights.tooltip.block_entities": "Active les lumières dynamiques provenantes des entités blocs.", "lambdynlights.tooltip.creeper_lighting": "Détermine le mode de lumière dynamique de la Creeper.\n- %s: désactive la lumière dynamique pour la Creeper.\n- %s: ajoute un niveau de lumière constant.\n- %s: ajoute un niveau de lumière dynamique.", "lambdynlights.tooltip.entities": "Active les lumières dynamiques provenantes des entités. Note: les joueurs sont toujours actifs.", diff --git a/src/main/resources/assets/lambdynlights/lang/fr_fr.json b/src/main/resources/assets/lambdynlights/lang/fr_fr.json index 8d44936b..267fd163 100644 --- a/src/main/resources/assets/lambdynlights/lang/fr_fr.json +++ b/src/main/resources/assets/lambdynlights/lang/fr_fr.json @@ -7,7 +7,6 @@ "lambdynlights.option.entities": "Entités", "lambdynlights.option.mode": "Lumières dynamiques", "lambdynlights.option.water_sensitive": "Contrôle de la sensibilité à l'eau", - "lambdynlights.toast.first_time": "Désactivé par défaut, consultez les paramètres vidéo ou du mod !", "lambdynlights.tooltip.block_entities": "Active les lumières dynamiques provenant des entités de blocs.", "lambdynlights.tooltip.creeper_lighting": "Détermine le mode d'éclairage dynamique des Creepers.\n- %s: désactive la lumière dynamique pour les Creepers.\n- %s: ajoute un niveau de lumière constant.\n- %s: ajoute un niveau de lumière dynamique.", "lambdynlights.tooltip.entities": "Active les lumières dynamiques provenant des entités. Note: Toujours actifs pour les joueurs.", diff --git a/src/main/resources/assets/lambdynlights/lang/hi_in.json b/src/main/resources/assets/lambdynlights/lang/hi_in.json index bc5216cf..b60d6619 100644 --- a/src/main/resources/assets/lambdynlights/lang/hi_in.json +++ b/src/main/resources/assets/lambdynlights/lang/hi_in.json @@ -7,7 +7,6 @@ "lambdynlights.option.entities": "अस्तित्व", "lambdynlights.option.mode": "गतिशील प्रकाश", "lambdynlights.option.water_sensitive": "जल संवेदनशीलता", - "lambdynlights.toast.first_time": "गतिशील प्रकाश सक्षम नहीं हैं। इसे मॉड विन्यास में सक्षम कीजिऐ!", "lambdynlights.tooltip.block_entities": "प्रखंड अस्तित्व के गतिशील प्रकाश", "lambdynlights.tooltip.creeper_lighting": "क्रीपर का गतिशील प्रकाश का प्रकार बदल देता है| \n- %s - क्रीपर का गतिशील प्रकाश को अक्षम करता है|\n- %s - निरंतर चमक सेट करता है|\n- %s - गतिशील प्रकाश सेट करता है|", "lambdynlights.tooltip.entities": "अस्तित्व का गतिशील प्रकाश सक्षम बनाता है| खिलाड़ी हमेशा सक्रिय रहते हैं|", diff --git a/src/main/resources/assets/lambdynlights/lang/it_it.json b/src/main/resources/assets/lambdynlights/lang/it_it.json index e6cedb6c..348a3c94 100644 --- a/src/main/resources/assets/lambdynlights/lang/it_it.json +++ b/src/main/resources/assets/lambdynlights/lang/it_it.json @@ -7,7 +7,6 @@ "lambdynlights.option.entities": "Entità", "lambdynlights.option.mode": "Luci dinamiche", "lambdynlights.option.water_sensitive": "Controllo della sensibilità dell'acqua", - "lambdynlights.toast.first_time": "Disattivata di predefinito, controlla le impostazioni grafiche o della mod!", "lambdynlights.tooltip.block_entities": "Attiva l'illuminazione dinamica delle entità blocco.", "lambdynlights.tooltip.creeper_lighting": "Imposta la modalità d'illuminazione dinamica dei Creeper.\n- %s disattiva l'illuminazione dinamica dei Creeper.\n- %s imposta una luminosità costante.\n- %s imposta una luminosità dinamica.", "lambdynlights.tooltip.entities": "Attiva l'illuminazione dinamica delle entità. Nota: l'illuminazione dinamica dei giocatori è sempre attiva.", diff --git a/src/main/resources/assets/lambdynlights/lang/nl_nl.json b/src/main/resources/assets/lambdynlights/lang/nl_nl.json index fb57448e..632dfe14 100644 --- a/src/main/resources/assets/lambdynlights/lang/nl_nl.json +++ b/src/main/resources/assets/lambdynlights/lang/nl_nl.json @@ -7,7 +7,6 @@ "lambdynlights.option.entities": "Entiteiten", "lambdynlights.option.mode": "Dynamische Lichtbronnen", "lambdynlights.option.water_sensitive": "Water Sensitiviteit Check", - "lambdynlights.toast.first_time": "Standaard uitgeschakeld, check mod of Video Instellingen!", "lambdynlights.tooltip.block_entities": "Schakelt dynamische block entiteiten in.", "lambdynlights.tooltip.creeper_lighting": "Stelt de creeper lichtmodus in.\n- %s zet dynamische creeper lichtbronnen uit.\n- %s zet een constante lichtsterkte.\n- %s zet een dynamische lichtsterkte.", "lambdynlights.tooltip.entities": "Laat entiteiten dynamische lichtbronnen maken. Lot op: Spelers zijn altijd actief.", diff --git a/src/main/resources/assets/lambdynlights/lang/pl_pl.json b/src/main/resources/assets/lambdynlights/lang/pl_pl.json index dbd166a7..39cc2676 100644 --- a/src/main/resources/assets/lambdynlights/lang/pl_pl.json +++ b/src/main/resources/assets/lambdynlights/lang/pl_pl.json @@ -7,7 +7,6 @@ "lambdynlights.option.entities": "Byty", "lambdynlights.option.mode": "Dynamiczne oświetlenie", "lambdynlights.option.water_sensitive": "Sprawdz. wrażliw. na wodę", - "lambdynlights.toast.first_time": "Domyślnie wyłączony, sprawdź ustawienia graficzne naszej modyfikacji!", "lambdynlights.tooltip.block_entities": "Aktywuje dynamiczne oświetlenie generowane przez byty bloków.", "lambdynlights.tooltip.creeper_lighting": "Ustawia dynamiczne oświetlenie Creepera.\n- %s deaktywuje dynamiczne oświetlenie Creepera.\n- %s ustawia stałą jasność.\n- %s ustawia dynamiczną jasność.", "lambdynlights.tooltip.entities": "Aktywuje dynamiczne oświetlenie dla bytów. Uwaga: dla graczy jest to zawsze aktywne.", diff --git a/src/main/resources/assets/lambdynlights/lang/pt_br.json b/src/main/resources/assets/lambdynlights/lang/pt_br.json index d004c8a1..8032b4d0 100644 --- a/src/main/resources/assets/lambdynlights/lang/pt_br.json +++ b/src/main/resources/assets/lambdynlights/lang/pt_br.json @@ -7,7 +7,6 @@ "lambdynlights.option.entities": "Entidades", "lambdynlights.option.mode": "Luzes dinâmicas", "lambdynlights.option.water_sensitive": "Verificação de sensibilidade à água", - "lambdynlights.toast.first_time": "Desativado por padrão, procure pelas Configurações de Vídeo ou do Mod!", "lambdynlights.tooltip.block_entities": "Habilita a iluminação dinâmica em entidades de blocos.", "lambdynlights.tooltip.creeper_lighting": "Define o modo de iluminação dinâmica do Creeper.\n- %s desativa a iluminação dinâmica do Creeper.\n- %s aplica uma luminância constante.\n- %s aplica uma luminância dinâmica.", "lambdynlights.tooltip.entities": "Habilita a iluminação dinâmica de entidades. Nota: sempre está ativada para jogadores.", diff --git a/src/main/resources/assets/lambdynlights/lang/ru_ru.json b/src/main/resources/assets/lambdynlights/lang/ru_ru.json index 4464dc8b..fb444485 100644 --- a/src/main/resources/assets/lambdynlights/lang/ru_ru.json +++ b/src/main/resources/assets/lambdynlights/lang/ru_ru.json @@ -7,7 +7,6 @@ "lambdynlights.option.entities": "Сущности", "lambdynlights.option.mode": "Динамическое освещение", "lambdynlights.option.water_sensitive": "Проверка на нахождение в воде", - "lambdynlights.toast.first_time": "Отключено по умолчанию, проверьте мод или Настройки Графики!", "lambdynlights.tooltip.block_entities": "Включает динамическое освещение сущностей.", "lambdynlights.tooltip.creeper_lighting": "Устанавливает режим динамического освещения у Криперов.\n- %s отключает динамическое освещение Криперов.\n- %s устанавливает постоянную яркость.\n- %s устанавливает динамическую яркость.", "lambdynlights.tooltip.entities": "Включает динамическое освещение сущностей. Примечание: освещение игроков активно всегда.", diff --git a/src/main/resources/assets/lambdynlights/lang/tr_tr.json b/src/main/resources/assets/lambdynlights/lang/tr_tr.json index 139d91bc..3576814a 100644 --- a/src/main/resources/assets/lambdynlights/lang/tr_tr.json +++ b/src/main/resources/assets/lambdynlights/lang/tr_tr.json @@ -7,7 +7,6 @@ "lambdynlights.option.entities": "Varlıklar", "lambdynlights.option.mode": "Dinamik Işıklar", "lambdynlights.option.water_sensitive": "Suya Duyarlılık Kontrolü", - "lambdynlights.toast.first_time": "Varsayılan olarak kapalı, moda veya Görüntü Ayarları'na göz atın!", "lambdynlights.tooltip.block_entities": "Blok varlıkların dinamik ışıklandırmasını etkinleştirir.", "lambdynlights.tooltip.creeper_lighting": "Creeper'a dinamik ışıklandırma ekler.\n- %s Creeper ışıklandırmasını devre dışı bırakır.\n- %s sabit bir ışıltı ekler.\n- %s dinamik bir ışıltı ekler.", "lambdynlights.tooltip.entities": "Varlıkların dinamik ışıklandırmasını etkinleştirir. Not: Oyuncularda her zaman aktiftir.", diff --git a/src/main/resources/assets/lambdynlights/lang/zh_cn.json b/src/main/resources/assets/lambdynlights/lang/zh_cn.json index 4e632ba5..b85360bc 100644 --- a/src/main/resources/assets/lambdynlights/lang/zh_cn.json +++ b/src/main/resources/assets/lambdynlights/lang/zh_cn.json @@ -7,7 +7,6 @@ "lambdynlights.option.entities": "实体", "lambdynlights.option.mode": "动态光照", "lambdynlights.option.water_sensitive": "水敏光源检查", - "lambdynlights.toast.first_time": "默认禁用,先看看模组或视频设置吧!", "lambdynlights.tooltip.block_entities": "启用方块实体的动态光照。", "lambdynlights.tooltip.creeper_lighting": "设置苦力怕的动态光照模式。\n- %s 禁用苦力怕动态光照。\n- %s 会设置一个恒定的亮度。\n- %s 会设置动态的亮度。", "lambdynlights.tooltip.entities": "启用实体的动态光照。注:与玩家的设置相独立。", diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 239e680f..762b607d 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -28,10 +28,10 @@ "lambdynlights.lightsource.mixins.json" ], "depends": { - "fabricloader": ">=0.9.0", - "fabric": ">=0.14.0", - "minecraft": ">=1.16.2", - "spruceui": ">=1.6.4" + "fabricloader": ">=0.11.1", + "fabric": ">=0.29.3", + "minecraft": "~1.16.2", + "spruceui": ">=2.0.1" }, "recommends": { "modmenu": ">=1.14.0" diff --git a/src/main/resources/lambdynlights.mixins.json b/src/main/resources/lambdynlights.mixins.json index ea2beeb2..173a4e06 100644 --- a/src/main/resources/lambdynlights.mixins.json +++ b/src/main/resources/lambdynlights.mixins.json @@ -12,7 +12,6 @@ "MinecraftClientMixin", "VideoOptionsScreenMixin", "WorldMixin", - "WorldRendererMixin", "ltr.LilTaterBlockEntityMixin", "ltr.LilTaterBlocksMixin" ], diff --git a/src/main/resources/lambdynlights.toml b/src/main/resources/lambdynlights.toml index 61afa129..91d835d4 100644 --- a/src/main/resources/lambdynlights.toml +++ b/src/main/resources/lambdynlights.toml @@ -1,6 +1,6 @@ # LambDynamicLights configuration. # The dynamic lights mode -mode = "none" +mode = "fancy" # Light sources settings. [light_sources]