From 65f0a77cfc6e2dc85732d857c38b3cdd89aa7784 Mon Sep 17 00:00:00 2001 From: Oth3r <68134921+oth3r@users.noreply.github.com> Date: Thu, 17 Jul 2025 10:14:30 -0500 Subject: [PATCH 01/14] updated readme; new badges --- README.md | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 47fbea2..22fec77 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ - +![banner](https://media.oth3r.one/-bQHprrBRYY/sit!%20banner%20480x270.png) -[![github](https://img.shields.io/github/issues/oth3r/Sit?logo=github?label=Issues)](https://github.com/Oth3r/Sit/releases) [![Crowdin](https://badges.crowdin.net/oth3r-sit/localized.svg)](https://crowdin.com/project/oth3r-sit) [![discord](https://dcbadge.vercel.app/api/server/https://discord.gg/AVSTHCAUvn?style=flat)](https://www.oth3r.one/discord) - -[![modrinth](https://img.shields.io/modrinth/dt/sit!?label=Modrinth&logo=modrinth)](https://modrinth.com/mod/sit!) [![curseforge](https://cf.way2muchnoise.eu/892424.svg)](https://www.curseforge.com/minecraft/mc-mods/Sit1) +[![issues](https://github.com/intergrav/devins-badges/blob/c7fd18efdadd1c3f12ae56b49afd834640d2d797/assets/cozy/documentation/issues_64h.png?raw=true)](https://github.com/Oth3r/Sit/issues) +[![localization](https://github.com/intergrav/devins-badges/blob/c7fd18efdadd1c3f12ae56b49afd834640d2d797/assets/cozy/translate/crowdin_64h.png?raw=true)](https://crowdin.com/project/oth3r-sit) +[![discord](https://github.com/intergrav/devins-badges/blob/v3/assets/cozy/social/discord-singular_64h.png?raw=true)](https://www.oth3r.one/discord) +[![otterlib_dep](https://media.oth3r.one/-a7bWaVAVW5/requires_otterlib.png)](https://modrinth.com/plugin/otterlib) ### **Sit!** is a vanilla+ mod that adds sitting in minecraft. * Sit on **stairs**, **slabs**, **carpets** by default, and sit on everything else by tweaking the config! @@ -41,28 +42,29 @@ Don't want to accidentally sit down? Set custom restrictions for each hand in th \ Use **player unique** hand restrictions when connecting to a `Sit!` server on a `Sit!` Client! -per player hand restriction showcase +![per player hand restriction showcase](https://github.com/Oth3r/oth3r.github.io/blob/main/mod_data/Sit!/media/desc/hand_restrictions.gif?raw=true) ### 🟩 Custom Blocks Want to sit on _**EVERY**_ block? With the config you can add more sitting options! \ With the new config system, block tags and custom blockstates can be used to mass select blocks at ease. -players sitting on a vast range of blocks +![players sitting on a vast range of blocks](https://github.com/Oth3r/oth3r.github.io/blob/main/mod_data/Sit!/media/desc/custom_blocks.gif?raw=true) ### ⌨️ Keybinds Don't want to sit with the **just** the hand? Use a keybind or type a command to sit instead! -setting keybinds for the sit mod, and sitting by using them +![setting keybinds for the sit mod, and sitting by using them](https://github.com/Oth3r/oth3r.github.io/blob/main/mod_data/Sit!/media/desc/keybinds.gif?raw=true) ### 📃 Customizable Config Don't like the default settings? Go wild in the config for yourself or your players! -the Sit! config wiki page -## Future Goals +![the Sit! config wiki page](https://github.com/Oth3r/oth3r.github.io/blob/main/mod_data/Sit!/media/desc/config.gif?raw=true) + +## 🎯 Future Goals * NeoForge Port * Full config via [OtterLib](https://modrinth.com/mod/otterlib) + +## 🔗 Where to download +[![modrinth](https://github.com/intergrav/devins-badges/blob/c7fd18efdadd1c3f12ae56b49afd834640d2d797/assets/cozy/available/modrinth_64h.png?raw=true)](https://modrinth.com/mod/sit!) +[![curseforge](https://github.com/intergrav/devins-badges/blob/c7fd18efdadd1c3f12ae56b49afd834640d2d797/assets/cozy/available/curseforge_64h.png?raw=true)](https://www.curseforge.com/minecraft/mc-mods/Sit1) \ No newline at end of file From c7875aa9ea151f35836a0fdd575c4c636efcb29d Mon Sep 17 00:00:00 2001 From: Oth3r <68134921+oth3r@users.noreply.github.com> Date: Thu, 17 Jul 2025 10:21:16 -0500 Subject: [PATCH 02/14] 1.21.8 bump --- build.gradle | 2 +- gradle.properties | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index ba352c7..f77bf8c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version "1.10-SNAPSHOT" + id 'fabric-loom' version "1.11-SNAPSHOT" id 'maven-publish' id "me.modmuss50.mod-publish-plugin" version "0.8.4" id 'co.uzzu.dotenv.gradle' version '4.0.0' diff --git a/gradle.properties b/gradle.properties index fda1a3e..5e40d89 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,22 +4,22 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -min_minecraft_version=1.21.7 -max_minecraft_version=1.21.7 -minecraft_versions=1.21.7 +min_minecraft_version=1.21.8 +max_minecraft_version=1.21.8 +minecraft_versions=1.21.8 -minecraft_version=1.21.7 -yarn_mappings=1.21.7+build.1 +minecraft_version=1.21.8 +yarn_mappings=1.21.8+build.1 loader_version=0.16.14 # Mod Properties -mod_version=1.2.4.5+1.21.7 +mod_version=1.2.4.5+1.21.8 maven_group=one.oth3r file_name=sit! # Dependencies -fabric_version=0.128.1+1.21.7 -otterlib_version=0.2.1.0+1.21.7-fabric +fabric_version=0.129.0+1.21.8 +otterlib_version=0.2.2.0+1.21.8-fabric otterlib_max_version=0.3.0.0+1.21.7-fabric modmenu_version=15.0.0-beta.1 From e43273b172b3e77776afdf493104eea0f4645a01 Mon Sep 17 00:00:00 2001 From: Oth3r <68134921+oth3r@users.noreply.github.com> Date: Thu, 17 Jul 2025 10:28:16 -0500 Subject: [PATCH 03/14] 1.2.4.6 hotfix --- changelog.md | 3 +++ gradle.properties | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 1601ba7..7fac970 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,6 @@ +# v1.2.4.6 +* fixed max otterlib version (1.21.8) + # v1.2.4.5 * bumped OtterLib version to `0.2.1.0` * fixed default languages files not being able to be loaded diff --git a/gradle.properties b/gradle.properties index 5e40d89..ff05bfd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,14 +13,14 @@ yarn_mappings=1.21.8+build.1 loader_version=0.16.14 # Mod Properties -mod_version=1.2.4.5+1.21.8 +mod_version=1.2.4.6+1.21.8 maven_group=one.oth3r file_name=sit! # Dependencies fabric_version=0.129.0+1.21.8 otterlib_version=0.2.2.0+1.21.8-fabric -otterlib_max_version=0.3.0.0+1.21.7-fabric +otterlib_max_version=0.3.0.0+1.21.8-fabric modmenu_version=15.0.0-beta.1 devauth_version=1.2.1 From 1bb8409931d525214f7dadbe579917a774c6e947 Mon Sep 17 00:00:00 2001 From: Oth3r <68134921+oth3r@users.noreply.github.com> Date: Sat, 19 Jul 2025 20:53:00 -0500 Subject: [PATCH 04/14] grammer fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 22fec77..fb8170b 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ With the new config system, block tags and custom blockstates can be used to mas ![players sitting on a vast range of blocks](https://github.com/Oth3r/oth3r.github.io/blob/main/mod_data/Sit!/media/desc/custom_blocks.gif?raw=true) ### ⌨️ Keybinds -Don't want to sit with the **just** the hand? Use a keybind or type a command to sit instead! +Don't want to sit with **just** the hand? Use a keybind or type a command to sit instead! ![setting keybinds for the sit mod, and sitting by using them](https://github.com/Oth3r/oth3r.github.io/blob/main/mod_data/Sit!/media/desc/keybinds.gif?raw=true) From 89536e307071007808e0fa8a0e653d3c1b10fd34 Mon Sep 17 00:00:00 2001 From: Oth3r <68134921+oth3r@users.noreply.github.com> Date: Sat, 19 Jul 2025 20:53:37 -0500 Subject: [PATCH 05/14] fix legacy file updater causing a stack overflow crash --- src/main/java/one/oth3r/sit/file/ServerConfig.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/one/oth3r/sit/file/ServerConfig.java b/src/main/java/one/oth3r/sit/file/ServerConfig.java index 8a36ad3..660c14c 100644 --- a/src/main/java/one/oth3r/sit/file/ServerConfig.java +++ b/src/main/java/one/oth3r/sit/file/ServerConfig.java @@ -345,6 +345,11 @@ public class ServerConfig implements CustomFile { } catch (Exception e) { Data.LOGGER.error("Failed to delete the old Sit! config."); } + + // save the updated configs + FileData.saveFiles(); + + // continue loading as normal... } /** @@ -494,8 +499,6 @@ public class ServerConfig implements CustomFile { FileData.setServerConfig(serverConfig); FileData.setSittingConfig(sittingConfig); - serverConfig.save(); - sittingConfig.save(); } catch (Exception e) { Data.LOGGER.error("Error loading legacy config: %s", e.getMessage()); } From ce9a88d56de90390370530764bdd325d966da936 Mon Sep 17 00:00:00 2001 From: Oth3r <68134921+oth3r@users.noreply.github.com> Date: Sat, 19 Jul 2025 20:54:26 -0500 Subject: [PATCH 06/14] v1.2.4.7 --- changelog.md | 3 +++ gradle.properties | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 7fac970..6c48664 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,6 @@ +# v1.2.4.7 +* fixed legacy file updater causing a stack overflow crash + # v1.2.4.6 * fixed max otterlib version (1.21.8) diff --git a/gradle.properties b/gradle.properties index ff05bfd..9fcfc73 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ yarn_mappings=1.21.8+build.1 loader_version=0.16.14 # Mod Properties -mod_version=1.2.4.6+1.21.8 +mod_version=1.2.4.7+1.21.8 maven_group=one.oth3r file_name=sit! From 202d8ac1710d52ab9f357a009e4137dd64e6fda4 Mon Sep 17 00:00:00 2001 From: Oth3r <68134921+oth3r@users.noreply.github.com> Date: Thu, 14 Aug 2025 12:55:14 -0500 Subject: [PATCH 07/14] added new config option: allowed-above-seat --- src/main/java/one/oth3r/sit/file/FileData.java | 8 ++++++++ .../java/one/oth3r/sit/file/ServerConfig.java | 16 ++++++++++++---- src/main/java/one/oth3r/sit/utl/Utl.java | 2 ++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/main/java/one/oth3r/sit/file/FileData.java b/src/main/java/one/oth3r/sit/file/FileData.java index 0eb0baa..f3cb229 100644 --- a/src/main/java/one/oth3r/sit/file/FileData.java +++ b/src/main/java/one/oth3r/sit/file/FileData.java @@ -10,6 +10,7 @@ import one.oth3r.sit.utl.Utl; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; +import java.util.List; public class FileData { /** @@ -111,6 +112,13 @@ public class FileData { new ArrayList<>()) )); + public static final ArrayList ALLOWED_ABOVE_SEAT = new ArrayList<>(List.of( + new CustomBlock( + new ArrayList<>(), + new ArrayList<>(List.of("#minecraft:trapdoors")), + new ArrayList<>()) + )); + public static final HandSetting MAIN_HAND = new HandSetting(HandSetting.SittingRequirement.EMPTY, new HandSetting.Filter( false,new HandSetting.Filter.Presets(), new CustomItem( diff --git a/src/main/java/one/oth3r/sit/file/ServerConfig.java b/src/main/java/one/oth3r/sit/file/ServerConfig.java index 660c14c..ce416b7 100644 --- a/src/main/java/one/oth3r/sit/file/ServerConfig.java +++ b/src/main/java/one/oth3r/sit/file/ServerConfig.java @@ -52,6 +52,8 @@ public class ServerConfig implements CustomFile { private ArrayList blacklistedBlocks = FileData.Defaults.BLACKLISTED_BLOCKS; @SerializedName("interaction-blocks") private ArrayList interactionBlocks = FileData.Defaults.INTERACTION_BLOCKS; + @SerializedName("allowed-above-seat") + private ArrayList allowedAboveSeat = FileData.Defaults.ALLOWED_ABOVE_SEAT; public ServerConfig() {} @@ -62,7 +64,7 @@ public class ServerConfig implements CustomFile { public ServerConfig(Double version, String lang, boolean keepActive, boolean sitWhileSeated, PresetBlocks presetBlocks, boolean customEnabled, ArrayList sittingBlocks, ArrayList blacklistedBlocks, - ArrayList interactionBlocks) { + ArrayList interactionBlocks, ArrayList allowedAboveSeat) { this.version = version; this.lang = lang; this.keepActive = keepActive; @@ -72,6 +74,7 @@ public class ServerConfig implements CustomFile { this.sittingBlocks = sittingBlocks; this.blacklistedBlocks = blacklistedBlocks; this.interactionBlocks = interactionBlocks; + this.allowedAboveSeat = allowedAboveSeat; } public Double getVersion() { @@ -114,6 +117,10 @@ public class ServerConfig implements CustomFile { return interactionBlocks; } + public ArrayList getAllowedAboveSeat() { + return allowedAboveSeat; + } + public static class PresetBlocks { @SerializedName("stairs") @@ -261,6 +268,7 @@ public class ServerConfig implements CustomFile { this.sittingBlocks = newFile.sittingBlocks.stream().map(SittingBlock::new).collect(Collectors.toCollection(ArrayList::new)); this.blacklistedBlocks = newFile.blacklistedBlocks.stream().map(CustomBlock::new).collect(Collectors.toCollection(ArrayList::new)); this.interactionBlocks = newFile.interactionBlocks.stream().map(CustomBlock::new).collect(Collectors.toCollection(ArrayList::new)); + this.allowedAboveSeat = newFile.allowedAboveSeat.stream().map(CustomBlock::new).collect(Collectors.toCollection(ArrayList::new)); } @Override @@ -298,12 +306,12 @@ public class ServerConfig implements CustomFile { public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) return false; ServerConfig that = (ServerConfig) o; - return Objects.equals(version, that.version) && Objects.equals(lang, that.lang) && Objects.equals(keepActive, that.keepActive) && Objects.equals(sitWhileSeated, that.sitWhileSeated) && Objects.equals(presetBlocks, that.presetBlocks) && Objects.equals(yDifferenceLimit, that.yDifferenceLimit) && Objects.equals(customEnabled, that.customEnabled) && Objects.equals(sittingBlocks, that.sittingBlocks) && Objects.equals(blacklistedBlocks, that.blacklistedBlocks) && Objects.equals(interactionBlocks, that.interactionBlocks); + return Objects.equals(version, that.version) && Objects.equals(lang, that.lang) && Objects.equals(keepActive, that.keepActive) && Objects.equals(sitWhileSeated, that.sitWhileSeated) && Objects.equals(presetBlocks, that.presetBlocks) && Objects.equals(yDifferenceLimit, that.yDifferenceLimit) && Objects.equals(customEnabled, that.customEnabled) && Objects.equals(sittingBlocks, that.sittingBlocks) && Objects.equals(blacklistedBlocks, that.blacklistedBlocks) && Objects.equals(interactionBlocks, that.interactionBlocks) && Objects.equals(allowedAboveSeat, that.allowedAboveSeat); } @Override public int hashCode() { - return Objects.hash(version, lang, langOptions, keepActive, sitWhileSeated, presetBlocks, yDifferenceLimit, customEnabled, sittingBlocks, blacklistedBlocks, interactionBlocks); + return Objects.hash(version, lang, langOptions, keepActive, sitWhileSeated, presetBlocks, yDifferenceLimit, customEnabled, sittingBlocks, blacklistedBlocks, interactionBlocks, allowedAboveSeat); } protected static class Legacy { @@ -419,7 +427,7 @@ public class ServerConfig implements CustomFile { Boolean.parseBoolean((String) properties.computeIfAbsent("custom", a -> String.valueOf(defaultConfig.isCustomEnabled()))), getCustomBlocks(new Gson().fromJson((String) properties.computeIfAbsent("custom-blocks", a -> "[]"), listType)), - new ArrayList<>(), FileData.Defaults.INTERACTION_BLOCKS + new ArrayList<>(), FileData.Defaults.INTERACTION_BLOCKS, FileData.Defaults.ALLOWED_ABOVE_SEAT ); SittingConfig defaultSittingConfig = new SittingConfig(); diff --git a/src/main/java/one/oth3r/sit/utl/Utl.java b/src/main/java/one/oth3r/sit/utl/Utl.java index 8e766ce..ecfdffb 100644 --- a/src/main/java/one/oth3r/sit/utl/Utl.java +++ b/src/main/java/one/oth3r/sit/utl/Utl.java @@ -49,6 +49,8 @@ public class Utl { public static boolean isNotObstructed(World world, BlockPos blockPos) { // get the block state at the blockPos BlockState state = world.getBlockState(blockPos); + // if block is allowed to be above seat, return true + if (blockIsInList(FileData.getServerConfig().getAllowedAboveSeat(), state)) return true; // make sure it doesn't have a collision return state.getCollisionShape(world,blockPos).isEmpty(); } From 4f5acb76dbeb05019e75d42942bf2b28bb93c9c3 Mon Sep 17 00:00:00 2001 From: Oth3r <68134921+oth3r@users.noreply.github.com> Date: Sat, 16 Aug 2025 20:13:32 -0500 Subject: [PATCH 08/14] optimizations and comments --- src/main/java/one/oth3r/sit/file/FileData.java | 14 +++++++------- src/main/java/one/oth3r/sit/file/ServerConfig.java | 3 +++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/one/oth3r/sit/file/FileData.java b/src/main/java/one/oth3r/sit/file/FileData.java index f3cb229..71b978c 100644 --- a/src/main/java/one/oth3r/sit/file/FileData.java +++ b/src/main/java/one/oth3r/sit/file/FileData.java @@ -96,19 +96,19 @@ public class FileData { public static final ArrayList SITTING_BLOCKS = new ArrayList<>(Arrays.asList( new SittingBlock(new ArrayList<>(),new ArrayList<>(Arrays.asList("#minecraft:campfires")), new ArrayList<>(Arrays.asList("lit=false")),.437), new SittingBlock(new ArrayList<>(Arrays.asList("!minecraft:crimson_stem","!minecraft:warped_stem","minecraft:polished_basalt")), new ArrayList<>(Arrays.asList("#minecraft:logs","!#minecraft:oak_logs")), new ArrayList<>(Arrays.asList("!axis=y")),1.0), - new SittingBlock(new ArrayList<>(Arrays.asList()), new ArrayList<>(Arrays.asList("#minecraft:beds")), new ArrayList<>(Arrays.asList("part=foot","occupied=false")),.5625) + new SittingBlock(new ArrayList<>(), new ArrayList<>(Arrays.asList("#minecraft:beds")), new ArrayList<>(Arrays.asList("part=foot","occupied=false")),.5625) )); - public static final ArrayList BLACKLISTED_BLOCKS = new ArrayList<>(Arrays.asList( - new CustomBlock(new ArrayList<>(),new ArrayList<>(Arrays.asList("#minecraft:shulker_boxes")),new ArrayList<>()) + public static final ArrayList BLACKLISTED_BLOCKS = new ArrayList<>(List.of( + new CustomBlock(new ArrayList<>(), new ArrayList<>(List.of("#minecraft:shulker_boxes")), new ArrayList<>()) )); - public static final ArrayList INTERACTION_BLOCKS = new ArrayList<>(Arrays.asList( + public static final ArrayList INTERACTION_BLOCKS = new ArrayList<>(List.of( new CustomBlock(new ArrayList<>(Arrays.asList( - "minecraft:crafter","minecraft:repeating_command_block","minecraft:chain_command_block","minecraft:command_block")), + "minecraft:crafter", "minecraft:repeating_command_block", "minecraft:chain_command_block", "minecraft:command_block")), new ArrayList<>(Arrays.asList( - "#minecraft:shulker_boxes","#c:player_workstations/furnaces","#c:player_workstations/crafting_tables", - "#c:villager_job_sites","#minecraft:trapdoors","#c:chests")), + "#minecraft:shulker_boxes", "#c:player_workstations/furnaces", "#c:player_workstations/crafting_tables", + "#c:villager_job_sites", "#minecraft:trapdoors", "#c:chests")), new ArrayList<>()) )); diff --git a/src/main/java/one/oth3r/sit/file/ServerConfig.java b/src/main/java/one/oth3r/sit/file/ServerConfig.java index ce416b7..bfc8660 100644 --- a/src/main/java/one/oth3r/sit/file/ServerConfig.java +++ b/src/main/java/one/oth3r/sit/file/ServerConfig.java @@ -314,6 +314,9 @@ public class ServerConfig implements CustomFile { return Objects.hash(version, lang, langOptions, keepActive, sitWhileSeated, presetBlocks, yDifferenceLimit, customEnabled, sittingBlocks, blacklistedBlocks, interactionBlocks, allowedAboveSeat); } + /** + * legacy updater + */ protected static class Legacy { /** * gets the legacy file, from the old directory for fabric, and the same one for spigot From 91faaba5c80bacf3995aa495c5bf8a7a30210aa0 Mon Sep 17 00:00:00 2001 From: Oth3r <68134921+oth3r@users.noreply.github.com> Date: Sat, 16 Aug 2025 20:15:58 -0500 Subject: [PATCH 09/14] increase version range --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9fcfc73..6c937d2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,9 +4,9 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -min_minecraft_version=1.21.8 +min_minecraft_version=1.21.6 max_minecraft_version=1.21.8 -minecraft_versions=1.21.8 +minecraft_versions=1.21.6,1.21.7,1.21.8 minecraft_version=1.21.8 yarn_mappings=1.21.8+build.1 From 9ac4cd5156406a817a345bff6d8cfabfbb2257d9 Mon Sep 17 00:00:00 2001 From: Oth3r <68134921+oth3r@users.noreply.github.com> Date: Thu, 21 Aug 2025 14:47:19 -0500 Subject: [PATCH 10/14] switch to OtterLib language registry --- src/main/java/one/oth3r/sit/file/FileData.java | 12 ------------ src/main/java/one/oth3r/sit/file/ServerConfig.java | 3 +++ src/main/java/one/oth3r/sit/utl/Chat.java | 4 ++-- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/main/java/one/oth3r/sit/file/FileData.java b/src/main/java/one/oth3r/sit/file/FileData.java index 71b978c..1c781c5 100644 --- a/src/main/java/one/oth3r/sit/file/FileData.java +++ b/src/main/java/one/oth3r/sit/file/FileData.java @@ -60,23 +60,11 @@ public class FileData { return playerSettings.getOrDefault(player, sittingConfig); } - /// the language / text system for the mod - private static final LanguageReader langReader = new LanguageReader( - new ResourceReader("assets/sit-oth3r/lang/",Sit.class.getClassLoader()), - new ResourceReader(Data.CONFIG_DIR),"en_us","en_us"); - - public static LanguageReader getLangReader() { - return langReader; - } - /** * loads all config files to memory */ public static void loadFiles() { getServerConfig().load(); - // load the language reader - langReader.updateLanguage(getServerConfig().getLang()); - getSittingConfig().load(); // if loading file and is on supported server on client, send the new settings over if (Data.isClient() && Data.isSupportedServer()) { diff --git a/src/main/java/one/oth3r/sit/file/ServerConfig.java b/src/main/java/one/oth3r/sit/file/ServerConfig.java index bfc8660..9eb2ff2 100644 --- a/src/main/java/one/oth3r/sit/file/ServerConfig.java +++ b/src/main/java/one/oth3r/sit/file/ServerConfig.java @@ -283,6 +283,9 @@ public class ServerConfig implements CustomFile { version = 2.3; this.lang = this.lang.substring(0,3)+this.lang.substring(3).toLowerCase(); } + + // update the language reader + LanguageReg.getLang(Data.MOD_ID).updateLanguage(lang); } @Override diff --git a/src/main/java/one/oth3r/sit/utl/Chat.java b/src/main/java/one/oth3r/sit/utl/Chat.java index 6dc2867..57f8536 100644 --- a/src/main/java/one/oth3r/sit/utl/Chat.java +++ b/src/main/java/one/oth3r/sit/utl/Chat.java @@ -1,7 +1,7 @@ package one.oth3r.sit.utl; import one.oth3r.otterlib.chat.CTxT; -import one.oth3r.sit.file.FileData; +import one.oth3r.otterlib.registry.LanguageReg; import java.awt.*; @@ -11,6 +11,6 @@ public class Chat { } public static CTxT lang(String key, Object... args) { - return FileData.getLangReader().dynamicTranslatable(key, args); + return LanguageReg.getLang(Data.MOD_ID).dynamicTranslatable(key, args); } } From 65f7f6f6e03364e3163ef8356e48f2fe89839cd7 Mon Sep 17 00:00:00 2001 From: Oth3r <68134921+oth3r@users.noreply.github.com> Date: Thu, 21 Aug 2025 14:55:09 -0500 Subject: [PATCH 11/14] switch to OtterLib file registry --- src/main/java/one/oth3r/sit/Sit.java | 18 ++++++++++++ .../java/one/oth3r/sit/file/FileData.java | 29 ++++--------------- .../java/one/oth3r/sit/file/ServerConfig.java | 13 +++++---- .../one/oth3r/sit/file/SittingConfig.java | 2 +- src/main/java/one/oth3r/sit/utl/Logic.java | 5 +--- 5 files changed, 33 insertions(+), 34 deletions(-) diff --git a/src/main/java/one/oth3r/sit/Sit.java b/src/main/java/one/oth3r/sit/Sit.java index b062269..831c7ad 100644 --- a/src/main/java/one/oth3r/sit/Sit.java +++ b/src/main/java/one/oth3r/sit/Sit.java @@ -2,13 +2,31 @@ package one.oth3r.sit; import net.fabricmc.api.ModInitializer; +import one.oth3r.otterlib.file.LanguageReader; +import one.oth3r.otterlib.file.ResourceReader; +import one.oth3r.otterlib.registry.CustomFileReg; +import one.oth3r.otterlib.registry.LanguageReg; import one.oth3r.sit.file.FileData; +import one.oth3r.sit.file.ServerConfig; +import one.oth3r.sit.file.SittingConfig; +import one.oth3r.sit.utl.Data; import one.oth3r.sit.utl.Events; public class Sit implements ModInitializer { @Override public void onInitialize() { + LanguageReg.registerLang(Data.MOD_ID, new LanguageReader( + new ResourceReader("assets/sit-oth3r/lang/",Sit.class.getClassLoader()), + new ResourceReader(Data.CONFIG_DIR),"en_us","en_us")); + + /// autoload is off, we will handle loading and saving manually + CustomFileReg.registerFile(Data.MOD_ID,new CustomFileReg.FileEntry( + ServerConfig.ID,new ServerConfig(),false,false)); + CustomFileReg.registerFile(Data.MOD_ID,new CustomFileReg.FileEntry( + SittingConfig.ID,new SittingConfig(),false,false)); + + FileData.loadFiles(); // save the files to populate all missing config options FileData.saveFiles(); diff --git a/src/main/java/one/oth3r/sit/file/FileData.java b/src/main/java/one/oth3r/sit/file/FileData.java index 1c781c5..da0ac66 100644 --- a/src/main/java/one/oth3r/sit/file/FileData.java +++ b/src/main/java/one/oth3r/sit/file/FileData.java @@ -1,9 +1,7 @@ package one.oth3r.sit.file; import net.minecraft.server.network.ServerPlayerEntity; -import one.oth3r.otterlib.file.LanguageReader; -import one.oth3r.otterlib.file.ResourceReader; -import one.oth3r.sit.Sit; +import one.oth3r.otterlib.registry.CustomFileReg; import one.oth3r.sit.utl.Data; import one.oth3r.sit.utl.Utl; @@ -13,30 +11,13 @@ import java.util.HashMap; import java.util.List; public class FileData { - /** - * Sit! config file - */ - private static ServerConfig serverConfig = new ServerConfig(); - + /// getters for Sit! config files public static ServerConfig getServerConfig() { - return serverConfig; + return (ServerConfig) CustomFileReg.getFile(Data.MOD_ID,ServerConfig.ID); } - public static void setServerConfig(ServerConfig newServerConfig) { - serverConfig = new ServerConfig(newServerConfig); - } - - /** - * The default sitting config for all new players - */ - private static SittingConfig sittingConfig = new SittingConfig(); - public static SittingConfig getSittingConfig() { - return sittingConfig; - } - - public static void setSittingConfig(SittingConfig newSittingConfig) { - sittingConfig = new SittingConfig(newSittingConfig); + return (SittingConfig) CustomFileReg.getFile(Data.MOD_ID,SittingConfig.ID); } /** @@ -57,7 +38,7 @@ public class FileData { } public static SittingConfig getPlayerSetting(ServerPlayerEntity player) { - return playerSettings.getOrDefault(player, sittingConfig); + return playerSettings.getOrDefault(player, getSittingConfig()); } /** diff --git a/src/main/java/one/oth3r/sit/file/ServerConfig.java b/src/main/java/one/oth3r/sit/file/ServerConfig.java index 9eb2ff2..990c244 100644 --- a/src/main/java/one/oth3r/sit/file/ServerConfig.java +++ b/src/main/java/one/oth3r/sit/file/ServerConfig.java @@ -8,6 +8,7 @@ import net.minecraft.util.Hand; import one.oth3r.otterlib.base.Num; import one.oth3r.otterlib.file.CustomFile; import one.oth3r.otterlib.file.FileSettings; +import one.oth3r.otterlib.registry.LanguageReg; import one.oth3r.sit.utl.Data; import org.jetbrains.annotations.NotNull; @@ -24,6 +25,7 @@ import java.util.Properties; import java.util.stream.Collectors; public class ServerConfig implements CustomFile { + public static final String ID = "server-config"; @SerializedName("version") private Double version = 2.3; @@ -360,9 +362,6 @@ public class ServerConfig implements CustomFile { Data.LOGGER.error("Failed to delete the old Sit! config."); } - // save the updated configs - FileData.saveFiles(); - // continue loading as normal... } @@ -511,8 +510,12 @@ public class ServerConfig implements CustomFile { } catch (JsonSyntaxException ignored) {} } - FileData.setServerConfig(serverConfig); - FileData.setSittingConfig(sittingConfig); + // update and save the new files + FileData.getServerConfig().copyFileData(serverConfig); + FileData.getServerConfig().save(); + + FileData.getSittingConfig().copyFileData(sittingConfig); + FileData.getSittingConfig().save(); } catch (Exception e) { Data.LOGGER.error("Error loading legacy config: %s", e.getMessage()); } diff --git a/src/main/java/one/oth3r/sit/file/SittingConfig.java b/src/main/java/one/oth3r/sit/file/SittingConfig.java index 2e7337b..c60a41c 100644 --- a/src/main/java/one/oth3r/sit/file/SittingConfig.java +++ b/src/main/java/one/oth3r/sit/file/SittingConfig.java @@ -1,7 +1,6 @@ package one.oth3r.sit.file; import com.google.common.base.Objects; -import com.google.gson.JsonElement; import com.google.gson.annotations.SerializedName; import net.minecraft.util.Hand; import one.oth3r.otterlib.file.CustomFile; @@ -13,6 +12,7 @@ import java.nio.file.Path; import java.nio.file.Paths; public class SittingConfig implements CustomFile { + public static final String ID = "sitting-config"; @SerializedName("version") private Double version = 1.0; diff --git a/src/main/java/one/oth3r/sit/utl/Logic.java b/src/main/java/one/oth3r/sit/utl/Logic.java index e5d8387..ae8bcf7 100644 --- a/src/main/java/one/oth3r/sit/utl/Logic.java +++ b/src/main/java/one/oth3r/sit/utl/Logic.java @@ -204,7 +204,7 @@ public class Logic { } /** - * toggles the sit ablity config option + * toggles the sit ability config option * @return returns a message, that can be sent to the player */ public static MutableText toggleSiting() { @@ -213,9 +213,6 @@ public class Logic { SittingConfig config = FileData.getSittingConfig(); // toggle the setting config.setEnabled(!config.getEnabled()); - - // set the sitting config to the new value - FileData.setSittingConfig(config); // save the changes to the file config.save(); // send the changes to the server From 360874357f40ead7d9154c5edef8ae38303960fa Mon Sep 17 00:00:00 2001 From: Oth3r <68134921+oth3r@users.noreply.github.com> Date: Thu, 21 Aug 2025 14:59:46 -0500 Subject: [PATCH 12/14] changed the default trapdoor entry for allowed-above-seat to require an open=true blockstate --- src/main/java/one/oth3r/sit/file/FileData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/one/oth3r/sit/file/FileData.java b/src/main/java/one/oth3r/sit/file/FileData.java index da0ac66..f0d7788 100644 --- a/src/main/java/one/oth3r/sit/file/FileData.java +++ b/src/main/java/one/oth3r/sit/file/FileData.java @@ -85,7 +85,7 @@ public class FileData { new CustomBlock( new ArrayList<>(), new ArrayList<>(List.of("#minecraft:trapdoors")), - new ArrayList<>()) + new ArrayList<>(List.of("open=true"))) )); public static final HandSetting MAIN_HAND = new HandSetting(HandSetting.SittingRequirement.EMPTY, new HandSetting.Filter( From 1558f94a5d8009056b8afee834c1569acde12a76 Mon Sep 17 00:00:00 2001 From: Oth3r <68134921+oth3r@users.noreply.github.com> Date: Thu, 21 Aug 2025 15:03:38 -0500 Subject: [PATCH 13/14] added doors to the default allowed-above-seat entry --- src/main/java/one/oth3r/sit/file/FileData.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/one/oth3r/sit/file/FileData.java b/src/main/java/one/oth3r/sit/file/FileData.java index f0d7788..fd77520 100644 --- a/src/main/java/one/oth3r/sit/file/FileData.java +++ b/src/main/java/one/oth3r/sit/file/FileData.java @@ -85,7 +85,12 @@ public class FileData { new CustomBlock( new ArrayList<>(), new ArrayList<>(List.of("#minecraft:trapdoors")), - new ArrayList<>(List.of("open=true"))) + new ArrayList<>(List.of("open=true"))), + new CustomBlock( + new ArrayList<>(), + new ArrayList<>(List.of("#minecraft:doors")), + new ArrayList<>() + ) )); public static final HandSetting MAIN_HAND = new HandSetting(HandSetting.SittingRequirement.EMPTY, new HandSetting.Filter( From 458333d347c2e7486ce6917c21f72103776ba194 Mon Sep 17 00:00:00 2001 From: Oth3r <68134921+oth3r@users.noreply.github.com> Date: Sat, 23 Aug 2025 12:32:12 -0500 Subject: [PATCH 14/14] v1.2.5.0 --- changelog.md | 36 +++++------------------------------- gradle.properties | 2 +- 2 files changed, 6 insertions(+), 32 deletions(-) diff --git a/changelog.md b/changelog.md index 6c48664..7a97995 100644 --- a/changelog.md +++ b/changelog.md @@ -1,32 +1,6 @@ -# v1.2.4.7 -* fixed legacy file updater causing a stack overflow crash +# v1.2.5.0 +New allowed-above-seat config option! -# v1.2.4.6 -* fixed max otterlib version (1.21.8) - -# v1.2.4.5 -* bumped OtterLib version to `0.2.1.0` - * fixed default languages files not being able to be loaded - -# v1.2.4.4 -* bumped OtterLib version to `0.2.0.0` - * now relies on OtterLib Language Reader - -# v1.2.4.3 -* added a max OtterLib version as the beta will have breaking changes between major versions - -# v1.2.4.2 -* fixed language file not loading (reverted uppercase locales) -* fixed block checking having a hardcoded player reach - now uses player reach (1.20.6+) -* fixed block and item tag check logic for cases with only not(!) tags - -# v1.2.4.1 -* removed unused assets -* enabled file logging for easier debugging - -# v1.2.4.0 -Small changelog but big update! -\ -Switching to OtterLib will allow for a simplified main mod and lead to more unified mod development across my projects! Download OtterLib today: [Link](https://modrinth.com/mod/otterlib) -* make sitting via hand execute the `/sit` command, to allow for universal sitting permission control -* switch to using OtterLib for file management, config screen management, and more to come \ No newline at end of file +* added new config option `allowed-above-seat` to allow certain blocks to be above the seat block +* switched to OtterLib for language file loading +* switched to OtterLib for config file loading \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 6c937d2..2a62c1c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ yarn_mappings=1.21.8+build.1 loader_version=0.16.14 # Mod Properties -mod_version=1.2.4.7+1.21.8 +mod_version=1.2.5.0+1.21.8 maven_group=one.oth3r file_name=sit!