From c8add16c86b4901393bc4702507067bc27fa4f2e Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Fri, 2 Sep 2022 19:46:26 +0900 Subject: [PATCH] Version 1.21.4, bug fix Fix bug where client may not be able to attack entities for which an entry did not exist on the client-side config. --- Changelog.md | 6 ++++++ README.md | 2 +- build.gradle | 2 +- .../com/burnedkirby/TurnBasedMinecraft/common/Battle.java | 4 ++-- .../TurnBasedMinecraft/common/TurnBasedMinecraftMod.java | 2 +- src/main/resources/META-INF/mods.toml | 2 +- src/main/resources/mcmod.info | 2 +- 7 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Changelog.md b/Changelog.md index e27d61b..356bcd5 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,7 +1,13 @@ # Upcoming changes +# Version 1.21.4 + More refactoring of check-if-in-battle lookup code. +Fix potential bug where clients cannot attack entities if their config didn't +exist client-side. They should now always be available to attack regardless of +whether or not the client has the config entry for an entity. + # Version 1.21.3 Implemented "player-only" battles, which can be enabled in the server-side diff --git a/README.md b/README.md index 26e107c..6425146 100644 --- 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.21.3.jar" +finished jar will be saved at "build/libs/TurnBasedMinecraft-1.21.4.jar" # Other notes diff --git a/build.gradle b/build.gradle index 00d5ea0..2013561 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ apply plugin: 'net.minecraftforge.gradle' //apply plugin: 'eclipse' //apply plugin: 'maven-publish' -version = "1.21.3" +version = "1.21.4" group = "com.burnedkirby.TurnBasedMinecraft" archivesBaseName = "TurnBasedMinecraft" diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Battle.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Battle.java index cf192de..cde34af 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Battle.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Battle.java @@ -266,7 +266,7 @@ public class Battle { entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getMatchingEntityInfo(e); } - if (entityInfo == null && !(e instanceof Player) && TurnBasedMinecraftMod.proxy.isServerRunning()) { + if (isServer && entityInfo == null && !(e instanceof Player) && TurnBasedMinecraftMod.proxy.isServerRunning()) { return; } Combatant newCombatant = new Combatant(e, entityInfo); @@ -314,7 +314,7 @@ public class Battle { entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getMatchingEntityInfo(e); } - if (entityInfo == null && !(e instanceof Player) && TurnBasedMinecraftMod.proxy.isServerRunning()) { + if (isServer && entityInfo == null && !(e instanceof Player) && TurnBasedMinecraftMod.proxy.isServerRunning()) { return; } Combatant newCombatant = new Combatant(e, entityInfo); diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/TurnBasedMinecraftMod.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/TurnBasedMinecraftMod.java index 115125f..b7924a6 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/TurnBasedMinecraftMod.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/TurnBasedMinecraftMod.java @@ -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.3"; + public static final String VERSION = "1.21.4"; 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/"; diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 847c738..b8bae1e 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -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.3" #mandatory +version="1.21.4" #mandatory # A display name for the mod displayName="TurnBasedMinecraftMod" #mandatory # A URL to query for updates for this mod. See the JSON update specification diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 9060789..f0920b1 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "com_burnedkirby_turnbasedminecraft", "name": "Turn Based Minecraft", "description": "Changes battles to be turn-based.", - "version": "1.21.3", + "version": "1.21.4", "mcversion": "1.18.2", "url": "", "updateUrl": "",