diff --git a/Changelog.md b/Changelog.md index 3d17041..5b1b23d 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,9 @@ # Upcoming changes +# Version 1.17.2 + +(try to) Fix potential freeze bug when an entity leaves battle. + # Version 1.17.1 Add experimental support for Pam's Harvestcraft foods. diff --git a/build.gradle b/build.gradle index 00c8933..9f1ee80 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ apply plugin: 'eclipse' //apply plugin: 'maven-publish' apply plugin: 'com.github.johnrengelman.shadow' -version = "1.17.1" +version = "1.17.2" group = "com.burnedkirby.TurnBasedMinecraft" archivesBaseName = "TurnBasedMinecraft" diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/ClientProxy.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/ClientProxy.java index 14b8c1a..f11d253 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/ClientProxy.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/ClientProxy.java @@ -116,53 +116,40 @@ public class ClientProxy extends CommonProxy @Override public void typeEnteredBattle(String type) { - if(localBattle == null) - { + if(localBattle == null) { return; - } - if(type == null || type.isEmpty() || getConfig().isBattleMusicType(type)) - { + } if(type == null || type.isEmpty() || getConfig().isBattleMusicType(type)) { ++battleMusicCount; - } - else if(getConfig().isSillyMusicType(type)) - { + } else if(getConfig().isSillyMusicType(type)) { ++sillyMusicCount; - } - else - { + } else { ++battleMusicCount; } - checkBattleTypes(); + checkBattleTypes(false); } @Override public void typeLeftBattle(String type) { - if(localBattle == null) + if(localBattle == null || localBattle.getSideA().isEmpty() || localBattle.getSideB().isEmpty()) { + battleMusicCount = 0; + sillyMusicCount = 0; return; - } - if(type == null || type.isEmpty() || getConfig().isBattleMusicType(type)) - { + } else if(type == null || type.isEmpty() || getConfig().isBattleMusicType(type)) { --battleMusicCount; - } - else if(getConfig().isSillyMusicType(type)) - { + } else if(getConfig().isSillyMusicType(type)) { --sillyMusicCount; - } - else - { + } else { --battleMusicCount; } - checkBattleTypes(); + checkBattleTypes(true); } @Override public void displayString(String message) { StringTextComponent prefix = new StringTextComponent("TBM: "); - // func_240718_a_ is set color - // func_240713_a_ is set bold prefix.withStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true)); StringTextComponent text = new StringTextComponent(message); prefix.getSiblings().add(text); @@ -178,9 +165,14 @@ public class ClientProxy extends CommonProxy Minecraft.getInstance().player.sendMessage(text, UUID.randomUUID()); } - private void checkBattleTypes() + private void checkBattleTypes(boolean entityLeft) { - float percentage = 0.0f; + // check that battle is still valid + if(localBattle == null && entityLeft && (localBattle.getSideA().isEmpty() || localBattle.getSideB().isEmpty())) { + return; + } + + float percentage = 0.0f; if(sillyMusicCount == 0 && battleMusicCount == 0) { percentage = 0.0f; diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Battle.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Battle.java index 8d187c0..1bacc90 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Battle.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/Battle.java @@ -1290,8 +1290,8 @@ public class Battle { fleeingCategory = "player"; } - sendMessageToAllPlayers(PacketBattleMessage.MessageType.FLEE, next.entity.getId(), 0, 1, fleeingCategory); removeCombatant(next); + sendMessageToAllPlayers(PacketBattleMessage.MessageType.FLEE, next.entity.getId(), 0, 1, fleeingCategory); } else { diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/TurnBasedMinecraftMod.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/TurnBasedMinecraftMod.java index ecf63d1..2deee8f 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/TurnBasedMinecraftMod.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/TurnBasedMinecraftMod.java @@ -35,7 +35,7 @@ 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.17.1"; + public static final String VERSION = "1.17.2"; 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 16d644e..99b8c78 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.17.1" #mandatory +version="1.17.2" #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 297c8dd..b61db10 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.17.1", + "version": "1.17.2", "mcversion": "1.16.3", "url": "", "updateUrl": "",