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
|
# Upcoming changes
|
||||||
|
|
||||||
|
# Version 1.17.2
|
||||||
|
|
||||||
|
(try to) Fix potential freeze bug when an entity leaves battle.
|
||||||
|
|
||||||
# Version 1.17.1
|
# Version 1.17.1
|
||||||
|
|
||||||
Add experimental support for Pam's Harvestcraft foods.
|
Add experimental support for Pam's Harvestcraft foods.
|
||||||
|
|
|
@ -14,7 +14,7 @@ apply plugin: 'eclipse'
|
||||||
//apply plugin: 'maven-publish'
|
//apply plugin: 'maven-publish'
|
||||||
apply plugin: 'com.github.johnrengelman.shadow'
|
apply plugin: 'com.github.johnrengelman.shadow'
|
||||||
|
|
||||||
version = "1.17.1"
|
version = "1.17.2"
|
||||||
group = "com.burnedkirby.TurnBasedMinecraft"
|
group = "com.burnedkirby.TurnBasedMinecraft"
|
||||||
archivesBaseName = "TurnBasedMinecraft"
|
archivesBaseName = "TurnBasedMinecraft"
|
||||||
|
|
||||||
|
|
|
@ -116,53 +116,40 @@ public class ClientProxy extends CommonProxy
|
||||||
@Override
|
@Override
|
||||||
public void typeEnteredBattle(String type)
|
public void typeEnteredBattle(String type)
|
||||||
{
|
{
|
||||||
if(localBattle == null)
|
if(localBattle == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
} if(type == null || type.isEmpty() || getConfig().isBattleMusicType(type)) {
|
||||||
if(type == null || type.isEmpty() || getConfig().isBattleMusicType(type))
|
|
||||||
{
|
|
||||||
++battleMusicCount;
|
++battleMusicCount;
|
||||||
}
|
} else if(getConfig().isSillyMusicType(type)) {
|
||||||
else if(getConfig().isSillyMusicType(type))
|
|
||||||
{
|
|
||||||
++sillyMusicCount;
|
++sillyMusicCount;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
++battleMusicCount;
|
++battleMusicCount;
|
||||||
}
|
}
|
||||||
checkBattleTypes();
|
checkBattleTypes(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void typeLeftBattle(String type)
|
public void typeLeftBattle(String type)
|
||||||
{
|
{
|
||||||
if(localBattle == null)
|
if(localBattle == null || localBattle.getSideA().isEmpty() || localBattle.getSideB().isEmpty())
|
||||||
{
|
{
|
||||||
|
battleMusicCount = 0;
|
||||||
|
sillyMusicCount = 0;
|
||||||
return;
|
return;
|
||||||
}
|
} else if(type == null || type.isEmpty() || getConfig().isBattleMusicType(type)) {
|
||||||
if(type == null || type.isEmpty() || getConfig().isBattleMusicType(type))
|
|
||||||
{
|
|
||||||
--battleMusicCount;
|
--battleMusicCount;
|
||||||
}
|
} else if(getConfig().isSillyMusicType(type)) {
|
||||||
else if(getConfig().isSillyMusicType(type))
|
|
||||||
{
|
|
||||||
--sillyMusicCount;
|
--sillyMusicCount;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
--battleMusicCount;
|
--battleMusicCount;
|
||||||
}
|
}
|
||||||
checkBattleTypes();
|
checkBattleTypes(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void displayString(String message)
|
public void displayString(String message)
|
||||||
{
|
{
|
||||||
StringTextComponent prefix = new StringTextComponent("TBM: ");
|
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));
|
prefix.withStyle(prefix.getStyle().withColor(Color.fromRgb(0xFF00FF00)).withBold(true));
|
||||||
StringTextComponent text = new StringTextComponent(message);
|
StringTextComponent text = new StringTextComponent(message);
|
||||||
prefix.getSiblings().add(text);
|
prefix.getSiblings().add(text);
|
||||||
|
@ -178,8 +165,13 @@ public class ClientProxy extends CommonProxy
|
||||||
Minecraft.getInstance().player.sendMessage(text, UUID.randomUUID());
|
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;
|
float percentage = 0.0f;
|
||||||
if(sillyMusicCount == 0 && battleMusicCount == 0)
|
if(sillyMusicCount == 0 && battleMusicCount == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1290,8 +1290,8 @@ public class Battle
|
||||||
{
|
{
|
||||||
fleeingCategory = "player";
|
fleeingCategory = "player";
|
||||||
}
|
}
|
||||||
sendMessageToAllPlayers(PacketBattleMessage.MessageType.FLEE, next.entity.getId(), 0, 1, fleeingCategory);
|
|
||||||
removeCombatant(next);
|
removeCombatant(next);
|
||||||
|
sendMessageToAllPlayers(PacketBattleMessage.MessageType.FLEE, next.entity.getId(), 0, 1, fleeingCategory);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class TurnBasedMinecraftMod
|
||||||
{
|
{
|
||||||
public static final String MODID = "com_burnedkirby_turnbasedminecraft";
|
public static final String MODID = "com_burnedkirby_turnbasedminecraft";
|
||||||
public static final String NAME = "Turn Based Minecraft Mod";
|
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 CONFIG_FILENAME = "TBM_Config.toml";
|
||||||
public static final String DEFAULT_CONFIG_FILENAME = "TBM_Config_DEFAULT.toml";
|
public static final String DEFAULT_CONFIG_FILENAME = "TBM_Config_DEFAULT.toml";
|
||||||
public static final String CONFIG_DIRECTORY = "config/TurnBasedMinecraft/";
|
public static final String CONFIG_DIRECTORY = "config/TurnBasedMinecraft/";
|
||||||
|
|
|
@ -15,7 +15,7 @@ license="MIT"
|
||||||
# The modid of the mod
|
# The modid of the mod
|
||||||
modId="com_burnedkirby_turnbasedminecraft" #mandatory
|
modId="com_burnedkirby_turnbasedminecraft" #mandatory
|
||||||
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
|
# 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
|
# A display name for the mod
|
||||||
displayName="TurnBasedMinecraftMod" #mandatory
|
displayName="TurnBasedMinecraftMod" #mandatory
|
||||||
# A URL to query for updates for this mod. See the JSON update specification <here>
|
# A URL to query for updates for this mod. See the JSON update specification <here>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"modid": "com_burnedkirby_turnbasedminecraft",
|
"modid": "com_burnedkirby_turnbasedminecraft",
|
||||||
"name": "Turn Based Minecraft",
|
"name": "Turn Based Minecraft",
|
||||||
"description": "Changes battles to be turn-based.",
|
"description": "Changes battles to be turn-based.",
|
||||||
"version": "1.17.1",
|
"version": "1.17.2",
|
||||||
"mcversion": "1.16.3",
|
"mcversion": "1.16.3",
|
||||||
"url": "",
|
"url": "",
|
||||||
"updateUrl": "",
|
"updateUrl": "",
|
||||||
|
|
Loading…
Reference in a new issue