# Upcoming changes
+# Version 1.21.1
+
+Refactored checking-if-in-battle code to be more efficient.
+
# Version 1.21.0
Updated mod to use forge-1.19.2-43.1.1
//apply plugin: 'eclipse'
//apply plugin: 'maven-publish'
-version = "1.21.0"
+version = "1.21.1"
group = "com.burnedkirby.TurnBasedMinecraft"
archivesBaseName = "TurnBasedMinecraft"
}
public boolean isInBattle(int entityID) {
- for (Battle battle : battleMap.values()) {
- if (battle.hasCombatant(entityID)) {
- return true;
- }
- }
-
- return false;
+ return entityToBattleMap.keySet().parallelStream().anyMatch(pair -> pair.id == entityID);
}
}
\ No newline at end of file
CommonProxy proxy = TurnBasedMinecraftMod.proxy;
if (event.getEntity().level.isClientSide || proxy.getBattleManager() == null) {
return;
- } else if (proxy.getBattleManager().isInBattle(event.getEntity().getId())
- && proxy.getConfig().getIgnoreHurtDamageSources().contains(event.getSource().msgId)) {
+ } else if (proxy.getConfig().getIgnoreHurtDamageSources().contains(event.getSource().msgId) && proxy.getBattleManager().isInBattle(event.getEntity().getId())) {
event.setCanceled(true);
}
}
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.21.0";
+ public static final String VERSION = "1.21.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/";
# The modid of the mod
modId="com_burnedkirby_turnbasedminecraft" #mandatory
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
-version="1.21.0" #mandatory
+version="1.21.1" #mandatory
# A display name for the mod
displayName="TurnBasedMinecraftMod" #mandatory
# A URL to query for updates for this mod. See the JSON update specification <here>
"modid": "com_burnedkirby_turnbasedminecraft",
"name": "Turn Based Minecraft",
"description": "Changes battles to be turn-based.",
- "version": "1.21.0",
+ "version": "1.21.1",
"mcversion": "1.18.2",
"url": "",
"updateUrl": "",