]> git.seodisparate.com - TurnBasedMinecraftMod/commitdiff
v1.23.1 More robust possible damage source loading 1.23.1
authorStephen Seo <seo.disparate@gmail.com>
Thu, 12 Oct 2023 08:19:19 +0000 (17:19 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Thu, 12 Oct 2023 08:23:21 +0000 (17:23 +0900)
Changelog.md
README.md
build.gradle
gradle.properties
src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Config.java
src/main/java/com/burnedkirby/TurnBasedMinecraft/common/TurnBasedMinecraftMod.java
src/main/resources/assets/com_burnedkirby_turnbasedminecraft/TBM_Config.toml
src/main/resources/mcmod.info

index 51efa6b204235af26d42433b75b98f304005aad3..afdf9d1c0b3dc852e26c27cf4ac12242eb49b407 100644 (file)
@@ -1,5 +1,13 @@
 # Upcoming changes
 
+# Version 1.23.1
+
+More robust handling of disallowed Damage Sources in battle (via config).
+Basically, the mod will load all possible damage sources. Damage sources to be
+ignored in battle can be modified with "/tbm-server-edit" and clicking on
+"ignore\_damage\_sources". It can also be manually modified in the server
+config's "ignore\_damage\_sources" array.
+
 # Version 1.23.0
 
 Support reproducible builds. This means that if this mod is compiled, then it
index 16b0df735147b983bef85dbfe609cdf220565814..564dde0c670173c69787ef226bd1163d074dd20c 100644 (file)
--- a/README.md
+++ b/README.md
@@ -58,7 +58,7 @@ configured for them.)
 # Building
 
 Simply invoke `./gradlew build` in the mod directory and after some time the
-finished jar will be saved at "build/libs/TurnBasedMinecraft-1.23.0.jar"
+finished jar will be saved at "build/libs/TurnBasedMinecraft-1.23.1.jar"
 
 # Other notes
 
index f0d3f3e2f295775e24665b856130a57856a42ad5..55e2214d0c1257994c62a449d118b3609648c746 100644 (file)
@@ -6,7 +6,7 @@ plugins {
     id 'com.github.johnrengelman.shadow' version '8.1.1'
 }
 
-version = "1.23.0"
+version = "1.23.1"
 group = "com.burnedkirby.TurnBasedMinecraft"
 archivesBaseName = "TurnBasedMinecraft"
 
index c0c0e7ea45e0ec77ee67f4909b8afa8476513bb5..21d3ce10fb459ac16cbf8af1fa2f37a790e65f9b 100644 (file)
@@ -44,7 +44,7 @@ mod_name=TurnBasedMinecraftMod
 # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
 mod_license=MIT
 # The mod version. See https://semver.org/
-mod_version=1.23.0
+mod_version=1.23.1
 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
 # This should match the base package used for the mod sources.
 # See https://maven.apache.org/guides/mini/guide-naming-conventions.html
index 5a12f2e36c71869067cf2fd81fbc7fa1ece48eb9..4e27953f04e21624350003543455cb0e20410012 100644 (file)
@@ -7,6 +7,8 @@ import java.util.*;
 
 import com.electronwill.nightconfig.core.file.CommentedFileConfig;
 import com.electronwill.nightconfig.toml.TomlFormat;
+import net.minecraft.core.registries.Registries;
+import net.minecraft.data.registries.VanillaRegistries;
 import org.apache.logging.log4j.Logger;
 
 import com.electronwill.nightconfig.core.file.FileConfig;
@@ -67,29 +69,7 @@ public class Config
         possibleIgnoreHurtDamageSources = new HashSet<String>();
         ignoreHurtDamageSources = new HashSet<String>();
 
-        possibleIgnoreHurtDamageSources.add("inFire");
-        possibleIgnoreHurtDamageSources.add("lightningBolt");
-        possibleIgnoreHurtDamageSources.add("onFire");
-        possibleIgnoreHurtDamageSources.add("lava");
-        possibleIgnoreHurtDamageSources.add("hotFloor");
-        possibleIgnoreHurtDamageSources.add("inWall");
-        possibleIgnoreHurtDamageSources.add("cramming");
-        possibleIgnoreHurtDamageSources.add("drown");
-        possibleIgnoreHurtDamageSources.add("starve");
-        possibleIgnoreHurtDamageSources.add("cactus");
-        possibleIgnoreHurtDamageSources.add("fall");
-        possibleIgnoreHurtDamageSources.add("flyIntoWall");
-        possibleIgnoreHurtDamageSources.add("outOfWorld");
-        possibleIgnoreHurtDamageSources.add("magic");
-        possibleIgnoreHurtDamageSources.add("wither");
-        possibleIgnoreHurtDamageSources.add("anvil");
-        possibleIgnoreHurtDamageSources.add("fallingBlock");
-        possibleIgnoreHurtDamageSources.add("dragonBreath");
-        possibleIgnoreHurtDamageSources.add("dryout");
-        possibleIgnoreHurtDamageSources.add("sweetBerryBush");
-        possibleIgnoreHurtDamageSources.add("freeze");
-        possibleIgnoreHurtDamageSources.add("fallingStalactite");
-        possibleIgnoreHurtDamageSources.add("stalagmite");
+        loadDamageSources();
 
         {
             File confPath = new File(TurnBasedMinecraftMod.CONFIG_DIRECTORY);
@@ -1536,4 +1516,15 @@ public class Config
     public void setIsPlayerOnlyBattles(boolean enabled) {
         playerOnlyBattles = enabled;
     }
-}
\ No newline at end of file
+
+    private void loadDamageSources() {
+        possibleIgnoreHurtDamageSources.clear();
+
+        try {
+            VanillaRegistries.createLookup().lookupOrThrow(Registries.DAMAGE_TYPE).listElements().forEach(dt -> possibleIgnoreHurtDamageSources.add(dt.get().msgId()));
+        } catch (Exception e) {
+            logger.warn("Config failed to load possible DamageSources! Undesired things may happen, like Zombies dying from Fire during battle!");
+            logger.warn(e);
+        }
+    }
+}
index d5ac33d26843f06afc2a8123f8e51604147c3c87..451430724d494813aa7a500c549ac0f338df6fb0 100644 (file)
@@ -39,7 +39,7 @@ import org.apache.logging.log4j.Logger;
 public class TurnBasedMinecraftMod {
     public static final String MODID = "com_burnedkirby_turnbasedminecraft";
     public static final String NAME = "Turn Based Minecraft Mod";
-    public static final String VERSION = "1.23.0";
+    public static final String VERSION = "1.23.1";
     public static final String CONFIG_FILENAME = "TBM_Config.toml";
     public static final String DEFAULT_CONFIG_FILENAME = "TBM_Config_DEFAULT.toml";
     public static final String CONFIG_DIRECTORY = "config/TurnBasedMinecraft/";
index 62fc04b7551b1e1809aa5919eccdaf828d72f0e8..dbdae74cf8f2300eb941a0cf2a13748703008c1e 100644 (file)
@@ -87,10 +87,7 @@ creeper_always_allow_damage = true
 
 # This array lists damage sources that are ignored for an entity in battle.
 # To allow damage from all sources during battle, make this array empty.
-# Valid values:
-# "inFire", "lightningBolt", "onFire", "lava", "hotFloor", "inWall", "cramming", "drown", "starve",
-# "cactus", "fall", "flyIntoWall", "outOfWorld", "magic", "wither", "anvil", "fallingBlock",
-# "dragonBreath", "dryout", "sweetBerryBush", "freeze", "fallingStalactite", "stalagmite"
+# Check the output of "/tbm-server-edit" and clicking on "ignore_damage_sources" for possible values.
 ignore_damage_sources = [
     "inFire",
     "onFire",
index b582d0e49f2318141d15e763dd7f25d3634c68f4..71cef37a423af5b42414acf69053a1a842705140 100644 (file)
@@ -3,7 +3,7 @@
   "modid": "com_burnedkirby_turnbasedminecraft",
   "name": "Turn Based Minecraft",
   "description": "Changes battles to be turn-based.",
-  "version": "1.23.0",
+  "version": "1.23.1",
   "mcversion": "1.20.1",
   "url": "",
   "updateUrl": "",