Refactor entity-in-battle checking code, v1.21.1
This commit is contained in:
parent
dbd4d3cdba
commit
12e6583b1f
7 changed files with 10 additions and 13 deletions
|
@ -1,5 +1,9 @@
|
|||
# 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
|
||||
|
|
|
@ -14,7 +14,7 @@ apply plugin: 'net.minecraftforge.gradle'
|
|||
//apply plugin: 'eclipse'
|
||||
//apply plugin: 'maven-publish'
|
||||
|
||||
version = "1.21.0"
|
||||
version = "1.21.1"
|
||||
group = "com.burnedkirby.TurnBasedMinecraft"
|
||||
archivesBaseName = "TurnBasedMinecraft"
|
||||
|
||||
|
|
|
@ -352,12 +352,6 @@ public class BattleManager
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -9,8 +9,7 @@ public class HurtEventHandler {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.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/";
|
||||
|
|
|
@ -15,7 +15,7 @@ license="MIT"
|
|||
# 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>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"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": "",
|
||||
|
|
Loading…
Reference in a new issue