diff --git a/build.gradle b/build.gradle index 7ce1e34..9e51e9f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,6 @@ plugins { id 'babric-loom' version '1.4.+' id 'java' - id 'org.jetbrains.kotlin.jvm' } group = project.mod_group @@ -16,7 +15,6 @@ loom { repositories { mavenCentral() - maven { url = "https://jitpack.io" } maven { name = 'Babric' @@ -26,6 +24,14 @@ repositories { name = 'Fabric' url = 'https://maven.fabricmc.net/' } + maven { + name = 'signalumMavenReleases' + url = 'https://maven.thesignalumproject.net/releases' + } + maven { + name = 'signalumMavenInfrastructure' + url = 'https://maven.thesignalumproject.net/infrastructure' + } ivy { url = "https://github.com/Better-than-Adventure" patternLayout { @@ -79,14 +85,13 @@ repositories { dependencies { minecraft "bta-download-repo:bta:${project.bta_version}" mappings loom.layered() {} - modImplementation "com.github.Garkatron:GodotSignalSystemLib:${project.godot_signal_system_lib}" modRuntimeOnly "objects:client:43db9b498cb67058d2e12d394e6507722e71bb45" // https://piston-data.mojang.com/v1/objects/43db9b498cb67058d2e12d394e6507722e71bb45/client.jar modImplementation "fabric-loader:fabric-loader:${project.loader_version}" // Helper library // If you do not need Halplibe you can comment this line out or delete this line - modImplementation "com.github.Turnip-Labs:bta-halplibe:${project.halplibe_version}" + modImplementation "turniplabs:halplibe:${project.halplibe_version}" modImplementation "ModMenu:ModMenu:${project.mod_menu_version}" @@ -99,14 +104,11 @@ dependencies { implementation("org.apache.logging.log4j:log4j-core:${log4jVersion}") implementation("org.apache.logging.log4j:log4j-api:${log4jVersion}") implementation("org.apache.logging.log4j:log4j-1.2-api:${log4jVersion}") - include(implementation("org.apache.commons:commons-lang3:3.12.0")) - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" } java { - - withSourcesJar() + withSourcesJar() } tasks.withType(JavaCompile).configureEach { @@ -126,5 +128,3 @@ processResources { expand "version": version } } -sourceCompatibility = JavaVersion.VERSION_16 -targetCompatibility = JavaVersion.VERSION_16 diff --git a/settings.gradle b/settings.gradle index 0011963..8e9a02d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -14,9 +14,6 @@ pluginManagement { url = 'https://maven.glass-launcher.net/babric' } } - plugins { - id 'org.jetbrains.kotlin.jvm' version '1.9.23' - } } plugins { id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0' diff --git a/src/main/java/deus/stanleylib/StanleyLib.java b/src/main/java/deus/stanleytemperature/StanleyTemperature.java similarity index 76% rename from src/main/java/deus/stanleylib/StanleyLib.java rename to src/main/java/deus/stanleytemperature/StanleyTemperature.java index a86cc75..ba37709 100644 --- a/src/main/java/deus/stanleylib/StanleyLib.java +++ b/src/main/java/deus/stanleytemperature/StanleyTemperature.java @@ -1,8 +1,8 @@ -package deus.stanleylib; +package deus.stanleytemperature; -import deus.stanleylib.config.ConfigHandler; +import deus.stanleytemperature.config.ConfigHandler; -import deus.stanleylib.overlay.HudManager; +import deus.stanleytemperature.overlay.HudManager; import net.fabricmc.api.ModInitializer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -10,9 +10,9 @@ import turniplabs.halplibe.util.RecipeEntrypoint; -public class StanleyLib implements ModInitializer, GameStartEntrypoint, RecipeEntrypoint { +public class StanleyTemperature implements ModInitializer, GameStartEntrypoint, RecipeEntrypoint { - public static final String MOD_ID = "stanleylib"; + public static final String MOD_ID = "stanleytemperature"; public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); public static ConfigHandler MOD_CONFIG = new ConfigHandler(); diff --git a/src/main/java/deus/stanleylib/config/ConfigHandler.java b/src/main/java/deus/stanleytemperature/config/ConfigHandler.java similarity index 94% rename from src/main/java/deus/stanleylib/config/ConfigHandler.java rename to src/main/java/deus/stanleytemperature/config/ConfigHandler.java index c5b3694..740e8ac 100644 --- a/src/main/java/deus/stanleylib/config/ConfigHandler.java +++ b/src/main/java/deus/stanleytemperature/config/ConfigHandler.java @@ -1,9 +1,9 @@ -package deus.stanleylib.config; +package deus.stanleytemperature.config; import turniplabs.halplibe.util.TomlConfigHandler; import turniplabs.halplibe.util.toml.Toml; -import static deus.stanleylib.StanleyLib.MOD_ID; +import static deus.stanleytemperature.StanleyTemperature.MOD_ID; public class ConfigHandler { @@ -13,7 +13,7 @@ public class ConfigHandler { Toml toml = new Toml("StanleyLibConfig"); toml.addCategory("Gui") - .addEntry("temperatureBar","vertical or horizontal","vertical") + .addEntry("temperatureBar","vertical or horizontal","horizontal") .addEntry("temperatureBarCompact","small version",true); toml.addCategory("temperatureManagement") diff --git a/src/main/java/deus/stanleylib/config/TemperatureConfig.java b/src/main/java/deus/stanleytemperature/config/TemperatureConfig.java similarity index 99% rename from src/main/java/deus/stanleylib/config/TemperatureConfig.java rename to src/main/java/deus/stanleytemperature/config/TemperatureConfig.java index a80021b..dec7798 100644 --- a/src/main/java/deus/stanleylib/config/TemperatureConfig.java +++ b/src/main/java/deus/stanleytemperature/config/TemperatureConfig.java @@ -1,4 +1,4 @@ -package deus.stanleylib.config; +package deus.stanleytemperature.config; import net.minecraft.core.block.material.Material; import net.minecraft.core.world.biome.*; diff --git a/src/main/java/deus/stanleylib/enums/CustomDamageTypes.java b/src/main/java/deus/stanleytemperature/enums/CustomDamageTypes.java similarity index 94% rename from src/main/java/deus/stanleylib/enums/CustomDamageTypes.java rename to src/main/java/deus/stanleytemperature/enums/CustomDamageTypes.java index 6fa8d01..32a575b 100644 --- a/src/main/java/deus/stanleylib/enums/CustomDamageTypes.java +++ b/src/main/java/deus/stanleytemperature/enums/CustomDamageTypes.java @@ -1,4 +1,4 @@ -package deus.stanleylib.enums; +package deus.stanleytemperature.enums; import net.minecraft.core.util.helper.DamageType; diff --git a/src/main/java/deus/stanleylib/enums/PlayerTemperatureState.java b/src/main/java/deus/stanleytemperature/enums/PlayerTemperatureState.java similarity index 68% rename from src/main/java/deus/stanleylib/enums/PlayerTemperatureState.java rename to src/main/java/deus/stanleytemperature/enums/PlayerTemperatureState.java index 427359e..59aff3a 100644 --- a/src/main/java/deus/stanleylib/enums/PlayerTemperatureState.java +++ b/src/main/java/deus/stanleytemperature/enums/PlayerTemperatureState.java @@ -1,4 +1,4 @@ -package deus.stanleylib.enums; +package deus.stanleytemperature.enums; public enum PlayerTemperatureState { FREEZING, diff --git a/src/main/java/deus/stanleylib/interfaces/IPlayerEntity.java b/src/main/java/deus/stanleytemperature/interfaces/IPlayerEntity.java similarity index 86% rename from src/main/java/deus/stanleylib/interfaces/IPlayerEntity.java rename to src/main/java/deus/stanleytemperature/interfaces/IPlayerEntity.java index 517b71e..734627a 100644 --- a/src/main/java/deus/stanleylib/interfaces/IPlayerEntity.java +++ b/src/main/java/deus/stanleytemperature/interfaces/IPlayerEntity.java @@ -1,4 +1,4 @@ -package deus.stanleylib.interfaces; +package deus.stanleytemperature.interfaces; import net.minecraft.core.block.Block; import net.minecraft.core.entity.player.EntityPlayer; diff --git a/src/main/java/deus/stanleylib/interfaces/IStanleyPlayerEntity.java b/src/main/java/deus/stanleytemperature/interfaces/IStanleyPlayerEntity.java similarity index 95% rename from src/main/java/deus/stanleylib/interfaces/IStanleyPlayerEntity.java rename to src/main/java/deus/stanleytemperature/interfaces/IStanleyPlayerEntity.java index 3fe90d0..2e75e9f 100644 --- a/src/main/java/deus/stanleylib/interfaces/IStanleyPlayerEntity.java +++ b/src/main/java/deus/stanleytemperature/interfaces/IStanleyPlayerEntity.java @@ -1,8 +1,7 @@ -package deus.stanleylib.interfaces; +package deus.stanleytemperature.interfaces; -import deus.stanleylib.enums.PlayerTemperatureState; +import deus.stanleytemperature.enums.PlayerTemperatureState; import net.minecraft.core.block.Block; -import net.minecraft.core.item.Item; public interface IStanleyPlayerEntity extends IPlayerEntity { /** diff --git a/src/main/java/deus/stanleylib/management/SignalAccessor.java b/src/main/java/deus/stanleytemperature/management/SignalAccessor.java similarity index 92% rename from src/main/java/deus/stanleylib/management/SignalAccessor.java rename to src/main/java/deus/stanleytemperature/management/SignalAccessor.java index b358a02..ad96610 100644 --- a/src/main/java/deus/stanleylib/management/SignalAccessor.java +++ b/src/main/java/deus/stanleytemperature/management/SignalAccessor.java @@ -1,7 +1,7 @@ -package deus.stanleylib.management; +package deus.stanleytemperature.management; -import deus.godotsignalsystem.core.Signal; -import deus.stanleylib.enums.PlayerTemperatureState; +import deus.stanleytemperature.enums.PlayerTemperatureState; +import gssl.Signal; /** * Manages various signals related to temperature and player states. diff --git a/src/main/java/deus/stanleylib/management/TemperatureManager.java b/src/main/java/deus/stanleytemperature/management/TemperatureManager.java similarity index 96% rename from src/main/java/deus/stanleylib/management/TemperatureManager.java rename to src/main/java/deus/stanleytemperature/management/TemperatureManager.java index a73791f..9669ce1 100644 --- a/src/main/java/deus/stanleylib/management/TemperatureManager.java +++ b/src/main/java/deus/stanleytemperature/management/TemperatureManager.java @@ -1,18 +1,16 @@ -package deus.stanleylib.management; +package deus.stanleytemperature.management; -import deus.stanleylib.enums.PlayerTemperatureState; -import deus.stanleylib.interfaces.IPlayerEntity; -import deus.stanleylib.interfaces.IStanleyPlayerEntity; +import deus.stanleytemperature.enums.PlayerTemperatureState; +import deus.stanleytemperature.interfaces.IPlayerEntity; +import deus.stanleytemperature.interfaces.IStanleyPlayerEntity; import net.minecraft.core.block.Block; -import net.minecraft.core.block.BlockTorch; import net.minecraft.core.entity.player.EntityPlayer; import net.minecraft.core.item.Item; import net.minecraft.core.world.biome.Biome; import net.minecraft.core.world.season.Season; import net.minecraft.core.world.weather.Weather; -import org.lwjgl.Sys; -import static deus.stanleylib.StanleyLib.*; +import static deus.stanleytemperature.StanleyTemperature.*; public class TemperatureManager { diff --git a/src/main/java/deus/stanleylib/mixin/MixinEntityPlayer.java b/src/main/java/deus/stanleytemperature/mixin/MixinEntityPlayer.java similarity index 94% rename from src/main/java/deus/stanleylib/mixin/MixinEntityPlayer.java rename to src/main/java/deus/stanleytemperature/mixin/MixinEntityPlayer.java index e7ec25b..15c4443 100644 --- a/src/main/java/deus/stanleylib/mixin/MixinEntityPlayer.java +++ b/src/main/java/deus/stanleytemperature/mixin/MixinEntityPlayer.java @@ -1,10 +1,10 @@ -package deus.stanleylib.mixin; +package deus.stanleytemperature.mixin; -import deus.stanleylib.enums.CustomDamageTypes; -import deus.stanleylib.enums.PlayerTemperatureState; -import deus.stanleylib.management.SignalAccessor; -import deus.stanleylib.management.TemperatureManager; -import deus.stanleylib.interfaces.IStanleyPlayerEntity; +import deus.stanleytemperature.enums.CustomDamageTypes; +import deus.stanleytemperature.enums.PlayerTemperatureState; +import deus.stanleytemperature.management.SignalAccessor; +import deus.stanleytemperature.management.TemperatureManager; +import deus.stanleytemperature.interfaces.IStanleyPlayerEntity; import net.minecraft.core.block.Block; import net.minecraft.core.entity.Entity; import net.minecraft.core.entity.monster.EntitySnowman; @@ -16,7 +16,6 @@ import net.minecraft.core.item.material.ArmorMaterial; import net.minecraft.core.util.helper.DamageType; import net.minecraft.core.world.World; -import org.lwjgl.Sys; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; @@ -25,10 +24,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.math.BigDecimal; -import java.math.RoundingMode; - -import static deus.stanleylib.StanleyLib.MOD_CONFIG; +import static deus.stanleytemperature.StanleyTemperature.MOD_CONFIG; @Mixin(EntityPlayer.class) public abstract class MixinEntityPlayer implements IStanleyPlayerEntity { diff --git a/src/main/java/deus/stanleylib/network/INetHandler.java.wip b/src/main/java/deus/stanleytemperature/network/INetHandler.java.wip similarity index 79% rename from src/main/java/deus/stanleylib/network/INetHandler.java.wip rename to src/main/java/deus/stanleytemperature/network/INetHandler.java.wip index 100e6cc..840be05 100644 --- a/src/main/java/deus/stanleylib/network/INetHandler.java.wip +++ b/src/main/java/deus/stanleytemperature/network/INetHandler.java.wip @@ -1,4 +1,4 @@ -package deus.stanleylib.network; +package deus.stanleytemperature.network; public interface INetHandler { void handleTemperaturePacket(PacketSendTemperature packet); diff --git a/src/main/java/deus/stanleylib/network/NetManager.java.wip b/src/main/java/deus/stanleytemperature/network/NetManager.java.wip similarity index 85% rename from src/main/java/deus/stanleylib/network/NetManager.java.wip rename to src/main/java/deus/stanleytemperature/network/NetManager.java.wip index f33fb18..5654d0c 100644 --- a/src/main/java/deus/stanleylib/network/NetManager.java.wip +++ b/src/main/java/deus/stanleytemperature/network/NetManager.java.wip @@ -1,4 +1,4 @@ -package deus.stanleylib.network; +package deus.stanleytemperature.network; import turniplabs.halplibe.helper.NetworkHelper; diff --git a/src/main/java/deus/stanleylib/network/PacketAddTemperature.java.wip b/src/main/java/deus/stanleytemperature/network/PacketAddTemperature.java.wip similarity index 95% rename from src/main/java/deus/stanleylib/network/PacketAddTemperature.java.wip rename to src/main/java/deus/stanleytemperature/network/PacketAddTemperature.java.wip index b6d37a8..95ac5bd 100644 --- a/src/main/java/deus/stanleylib/network/PacketAddTemperature.java.wip +++ b/src/main/java/deus/stanleytemperature/network/PacketAddTemperature.java.wip @@ -1,4 +1,4 @@ -package deus.stanleylib.network; +package deus.stanleytemperature.network; import net.minecraft.core.net.handler.NetHandler; import net.minecraft.core.net.packet.Packet; diff --git a/src/main/java/deus/stanleylib/network/PacketSendTemperature.java.wip b/src/main/java/deus/stanleytemperature/network/PacketSendTemperature.java.wip similarity index 92% rename from src/main/java/deus/stanleylib/network/PacketSendTemperature.java.wip rename to src/main/java/deus/stanleytemperature/network/PacketSendTemperature.java.wip index ab19bf3..3cefba4 100644 --- a/src/main/java/deus/stanleylib/network/PacketSendTemperature.java.wip +++ b/src/main/java/deus/stanleytemperature/network/PacketSendTemperature.java.wip @@ -1,6 +1,6 @@ -package deus.stanleylib.network; +package deus.stanleytemperature.network; -import deus.stanleylib.enums.PlayerTemperatureState; +import deus.stanleytemperature.enums.PlayerTemperatureState; import net.minecraft.core.net.handler.NetHandler; import net.minecraft.core.net.packet.Packet; diff --git a/src/main/java/deus/stanleylib/overlay/HudManager.java b/src/main/java/deus/stanleytemperature/overlay/HudManager.java similarity index 72% rename from src/main/java/deus/stanleylib/overlay/HudManager.java rename to src/main/java/deus/stanleytemperature/overlay/HudManager.java index 25731d5..15a700f 100644 --- a/src/main/java/deus/stanleylib/overlay/HudManager.java +++ b/src/main/java/deus/stanleytemperature/overlay/HudManager.java @@ -1,9 +1,8 @@ -package deus.stanleylib.overlay; +package deus.stanleytemperature.overlay; -import deus.stanleylib.StanleyLib; +import deus.stanleytemperature.StanleyTemperature; import net.minecraft.client.gui.hud.*; // Asegúrate de que las importaciones sean correctas -import static deus.stanleylib.StanleyLib.MOD_CONFIG; public class HudManager { private static final HudComponent thermometer = HudComponents.register(new ThermometerComponent( @@ -15,7 +14,7 @@ public class HudManager { public static void init() { - StanleyLib.LOGGER.debug("Registering HUD components"); + StanleyTemperature.LOGGER.debug("Registering HUD components"); } diff --git a/src/main/java/deus/stanleylib/overlay/ThermometerComponent.java b/src/main/java/deus/stanleytemperature/overlay/ThermometerComponent.java similarity index 96% rename from src/main/java/deus/stanleylib/overlay/ThermometerComponent.java rename to src/main/java/deus/stanleytemperature/overlay/ThermometerComponent.java index e6a6a9f..6d7f596 100644 --- a/src/main/java/deus/stanleylib/overlay/ThermometerComponent.java +++ b/src/main/java/deus/stanleytemperature/overlay/ThermometerComponent.java @@ -1,7 +1,7 @@ -package deus.stanleylib.overlay; +package deus.stanleytemperature.overlay; -import deus.stanleylib.enums.PlayerTemperatureState; -import deus.stanleylib.interfaces.IStanleyPlayerEntity; +import deus.stanleytemperature.enums.PlayerTemperatureState; +import deus.stanleytemperature.interfaces.IStanleyPlayerEntity; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiIngame; @@ -13,7 +13,7 @@ import java.awt.*; -import static deus.stanleylib.StanleyLib.MOD_CONFIG; +import static deus.stanleytemperature.StanleyTemperature.MOD_CONFIG; public class ThermometerComponent extends MovableHudComponent { diff --git a/src/main/java/gssl/Signal.java b/src/main/java/gssl/Signal.java new file mode 100644 index 0000000..15c8584 --- /dev/null +++ b/src/main/java/gssl/Signal.java @@ -0,0 +1,49 @@ +package gssl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class Signal { + + private final List> listeners = new ArrayList<>(); + private final List> removeQueue = new ArrayList<>(); + private boolean emitting = false; + public boolean silenced = false; + + public interface Listener { + void signalEmitted(Signal signal, T t); + } + + public List> getListeners() { + return Collections.unmodifiableList(listeners); + } + + public void connect(Listener listener) { + if(!listeners.contains(listener)){ + listeners.add(listener); + } + } + + public void disconnect(Listener listener) { + if(!emitting){ + listeners.remove(listener); + } else { + removeQueue.add(listener); + } + } + + public void emit(T t) { + if(!silenced){ + emitting = true; + for (Listener listener : new ArrayList<>(listeners)) { + listener.signalEmitted(this, t); + } + for (Listener listener : removeQueue) { + listeners.remove(listener); + } + removeQueue.clear(); + emitting = false; + } + } +} diff --git a/src/main/resources/assets/stanleylib/textures/gui/c_thermometer.png b/src/main/resources/assets/stanleytemperature/textures/gui/c_thermometer.png similarity index 100% rename from src/main/resources/assets/stanleylib/textures/gui/c_thermometer.png rename to src/main/resources/assets/stanleytemperature/textures/gui/c_thermometer.png diff --git a/src/main/resources/assets/stanleylib/textures/gui/thermometer.png b/src/main/resources/assets/stanleytemperature/textures/gui/thermometer.png similarity index 100% rename from src/main/resources/assets/stanleylib/textures/gui/thermometer.png rename to src/main/resources/assets/stanleytemperature/textures/gui/thermometer.png diff --git a/src/main/resources/assets/stanleylib/textures/gui/v_thermometer.png b/src/main/resources/assets/stanleytemperature/textures/gui/v_thermometer.png similarity index 100% rename from src/main/resources/assets/stanleylib/textures/gui/v_thermometer.png rename to src/main/resources/assets/stanleytemperature/textures/gui/v_thermometer.png diff --git a/src/main/resources/assets/stanleylib/textures/gui/vc_thermometer.png b/src/main/resources/assets/stanleytemperature/textures/gui/vc_thermometer.png similarity index 100% rename from src/main/resources/assets/stanleylib/textures/gui/vc_thermometer.png rename to src/main/resources/assets/stanleytemperature/textures/gui/vc_thermometer.png diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 9e0df03..f35f9dd 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -38,7 +38,7 @@ } }, "mixins": [ - "stanleylib.mixins.json" + "stanleytemperature.mixins.json" ], "depends": { diff --git a/src/main/resources/lang/stanleylib/en_US.lang b/src/main/resources/lang/stanleytemperature/en_US.lang similarity index 100% rename from src/main/resources/lang/stanleylib/en_US.lang rename to src/main/resources/lang/stanleytemperature/en_US.lang diff --git a/src/main/resources/stanleylib.mixins.json b/src/main/resources/stanleytemperature.mixins.json similarity index 80% rename from src/main/resources/stanleylib.mixins.json rename to src/main/resources/stanleytemperature.mixins.json index 8bb8696..dc61338 100644 --- a/src/main/resources/stanleylib.mixins.json +++ b/src/main/resources/stanleytemperature.mixins.json @@ -1,7 +1,7 @@ { "required": true, "minVersion": "0.8", - "package": "deus.stanleylib.mixin", + "package": "deus.stanleytemperature.mixin", "compatibilityLevel": "JAVA_8", "mixins": [ "MixinEntityPlayer"