Fix potential client freeze bug
This commit is contained in:
parent
ee633284df
commit
89ca942c31
7 changed files with 28 additions and 32 deletions
|
@ -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.
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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,8 +165,13 @@ public class ClientProxy extends CommonProxy
|
|||
Minecraft.getInstance().player.sendMessage(text, UUID.randomUUID());
|
||||
}
|
||||
|
||||
private void checkBattleTypes()
|
||||
private void checkBattleTypes(boolean entityLeft)
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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/";
|
||||
|
|
|
@ -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 <here>
|
||||
|
|
|
@ -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": "",
|
||||
|
|
Loading…
Reference in a new issue