v1.23.1 More robust possible damage source loading
This commit is contained in:
parent
fab8e2d4a0
commit
351fb1db55
8 changed files with 29 additions and 33 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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/";
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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": "",
|
||||
|
|
Loading…
Reference in a new issue