Skip to content

Commit

Permalink
Slight changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Garkatron committed Jan 10, 2025
1 parent 8397e58 commit 3a2bd3e
Show file tree
Hide file tree
Showing 26 changed files with 102 additions and 64 deletions.
20 changes: 10 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
id 'babric-loom' version '1.4.+'
id 'java'
id 'org.jetbrains.kotlin.jvm'
}

group = project.mod_group
Expand All @@ -16,7 +15,6 @@ loom {

repositories {
mavenCentral()

maven { url = "https://jitpack.io" }
maven {
name = 'Babric'
Expand All @@ -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 {
Expand Down Expand Up @@ -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}"

Expand All @@ -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 {
Expand All @@ -126,5 +128,3 @@ processResources {
expand "version": version
}
}
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
3 changes: 0 additions & 3 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
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;
import turniplabs.halplibe.util.GameStartEntrypoint;
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();

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand All @@ -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")
Expand Down
Original file line number Diff line number Diff line change
@@ -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.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package deus.stanleylib.enums;
package deus.stanleytemperature.enums;

import net.minecraft.core.util.helper.DamageType;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package deus.stanleylib.enums;
package deus.stanleytemperature.enums;

public enum PlayerTemperatureState {
FREEZING,
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package deus.stanleylib.network;
package deus.stanleytemperature.network;

public interface INetHandler {
void handleTemperaturePacket(PacketSendTemperature packet);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package deus.stanleylib.network;
package deus.stanleytemperature.network;

import turniplabs.halplibe.helper.NetworkHelper;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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(
Expand All @@ -15,7 +14,7 @@ public class HudManager {

public static void init() {

StanleyLib.LOGGER.debug("Registering HUD components");
StanleyTemperature.LOGGER.debug("Registering HUD components");
}


Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 {

Expand Down
49 changes: 49 additions & 0 deletions src/main/java/gssl/Signal.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package gssl;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Signal<T> {

private final List<Listener<T>> listeners = new ArrayList<>();
private final List<Listener<T>> removeQueue = new ArrayList<>();
private boolean emitting = false;
public boolean silenced = false;

public interface Listener<T> {
void signalEmitted(Signal<T> signal, T t);
}

public List<Listener<T>> getListeners() {
return Collections.unmodifiableList(listeners);
}

public void connect(Listener<T> listener) {
if(!listeners.contains(listener)){
listeners.add(listener);
}
}

public void disconnect(Listener<T> listener) {
if(!emitting){
listeners.remove(listener);
} else {
removeQueue.add(listener);
}
}

public void emit(T t) {
if(!silenced){
emitting = true;
for (Listener<T> listener : new ArrayList<>(listeners)) {
listener.signalEmitted(this, t);
}
for (Listener<T> listener : removeQueue) {
listeners.remove(listener);
}
removeQueue.clear();
emitting = false;
}
}
}
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
}
},
"mixins": [
"stanleylib.mixins.json"
"stanleytemperature.mixins.json"
],

"depends": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"required": true,
"minVersion": "0.8",
"package": "deus.stanleylib.mixin",
"package": "deus.stanleytemperature.mixin",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MixinEntityPlayer"
Expand Down

0 comments on commit 3a2bd3e

Please sign in to comment.