Compare commits
15 commits
neoforge
...
neoforge-1
Author | SHA1 | Date | |
---|---|---|---|
fd89a9c3c2 | |||
171b912f1c | |||
01df575767 | |||
dfe27109be | |||
676955503c | |||
6625a495ca | |||
2c369a125a | |||
c58ca0fe37 | |||
58a9be3251 | |||
ea6451e558 | |||
1c119aa5db | |||
d39a15a4e2 | |||
0294198192 | |||
aaefb62501 | |||
367c407ec9 |
13 changed files with 714 additions and 248 deletions
38
Changelog.md
38
Changelog.md
|
@ -1,5 +1,43 @@
|
||||||
# Upcoming changes
|
# Upcoming changes
|
||||||
|
|
||||||
|
# Version Forge-1.26.4
|
||||||
|
|
||||||
|
Add support for "per-player-stats" in Turn-Based-Battle.
|
||||||
|
|
||||||
|
Update to Forge 52.0.24 (MC 1.21.1).
|
||||||
|
|
||||||
|
# Version NeoForge-1.26.4-MC-1.21.1
|
||||||
|
|
||||||
|
Add support for "per-player-stats" in Turn-Based-Battle.
|
||||||
|
|
||||||
|
Update to Neoforge 21.1.73 (Minecraft 1.21.1).
|
||||||
|
|
||||||
|
# Version NeoForge-1.26.4
|
||||||
|
|
||||||
|
Add support for "per-player-stats" in Turn-Based-Battle.
|
||||||
|
|
||||||
|
Update to NeoForge 21.3.6-beta (MC 1.21.3).
|
||||||
|
|
||||||
|
# Version Forge-1.26.3
|
||||||
|
|
||||||
|
Tweak to "Ping" packet to not create client-local Battle instance if it does
|
||||||
|
not exist.
|
||||||
|
|
||||||
|
# Version NeoForge-1.26.3
|
||||||
|
|
||||||
|
Port to NeoForge 21.3.2-beta (MC 1.21.3).
|
||||||
|
|
||||||
|
Note that MC 1.21.1 (NeoForge 21.1.72) will still be supported in a separate
|
||||||
|
branch (neoforge\_mc1.21.1) until MC version 1.22 is released.
|
||||||
|
|
||||||
|
Tweak to "Ping" packet to not create client-local Battle instance if it does
|
||||||
|
not exist.
|
||||||
|
|
||||||
|
# Version NeoForge-1.26.3-MC-1.21.1
|
||||||
|
|
||||||
|
Tweak to "Ping" packet to not create client-local Battle instance if it does
|
||||||
|
not exist.
|
||||||
|
|
||||||
# Version Forge-1.26.2
|
# Version Forge-1.26.2
|
||||||
|
|
||||||
Show battling Entities next to their attack button in the BattleGUI.
|
Show battling Entities next to their attack button in the BattleGUI.
|
||||||
|
|
|
@ -11,6 +11,10 @@ https://www.curseforge.com/minecraft/mc-mods/turnbasedminecraft/files
|
||||||
https://modrinth.com/mod/turnbasedmc
|
https://modrinth.com/mod/turnbasedmc
|
||||||
https://git.seodisparate.com/stephenseo/TurnBasedMinecraftMod/releases
|
https://git.seodisparate.com/stephenseo/TurnBasedMinecraftMod/releases
|
||||||
|
|
||||||
|
# Documentation Page
|
||||||
|
|
||||||
|
https://stephen-seo.github.io/TurnBasedMinecraftMod/
|
||||||
|
|
||||||
# Forge or NeoForge
|
# Forge or NeoForge
|
||||||
|
|
||||||
The `forge` branch tracks the version of the mod for Minecraft Forge.
|
The `forge` branch tracks the version of the mod for Minecraft Forge.
|
||||||
|
@ -74,7 +78,7 @@ configured for them.)
|
||||||
|
|
||||||
Simply invoke `./gradlew build` in the mod directory and after some time the
|
Simply invoke `./gradlew build` in the mod directory and after some time the
|
||||||
finished jar will be saved at
|
finished jar will be saved at
|
||||||
`build/libs/TurnBasedMinecraft-NeoForge-1.26.2-all.jar`
|
`build/libs/TurnBasedMinecraft-NeoForge-1.26.4-MC-1.21.1-all.jar`
|
||||||
|
|
||||||
# Reproducibility
|
# Reproducibility
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,45 @@ Starting with version 1.24.0 of this mod, this file will list what version of
|
||||||
Java was used to compile the jars. In theory, using the same version of Java
|
Java was used to compile the jars. In theory, using the same version of Java
|
||||||
should result in an identical jar due to reproducible builds.
|
should result in an identical jar due to reproducible builds.
|
||||||
|
|
||||||
|
## NeoForge 1.26.3
|
||||||
|
|
||||||
|
$ java --version
|
||||||
|
openjdk 21.0.5 2024-10-15
|
||||||
|
OpenJDK Runtime Environment (build 21.0.5+11)
|
||||||
|
OpenJDK 64-Bit Server VM (build 21.0.5+11, mixed mode, sharing)
|
||||||
|
|
||||||
|
$ javac --version
|
||||||
|
javac 21.0.5
|
||||||
|
|
||||||
|
$ sha256sum build/libs/TurnBasedMinecraft-NeoForge-1.26.3-all.jar
|
||||||
|
2c8f17499a475f22493244e16f499bed46ea6a32a20f6bd2be5b3151464b2225 build/libs/TurnBasedMinecraft-NeoForge-1.26.3-all.jar
|
||||||
|
|
||||||
|
## NeoForge 1.26.3-MC-1.21.1
|
||||||
|
|
||||||
|
$ java --version
|
||||||
|
openjdk 21.0.5 2024-10-15
|
||||||
|
OpenJDK Runtime Environment (build 21.0.5+11)
|
||||||
|
OpenJDK 64-Bit Server VM (build 21.0.5+11, mixed mode, sharing)
|
||||||
|
|
||||||
|
$ javac --version
|
||||||
|
javac 21.0.5
|
||||||
|
|
||||||
|
$ sha256sum build/libs/TurnBasedMinecraft-NeoForge-1.26.3-MC-1.21.1-all.jar
|
||||||
|
311018353109da4d9a49379d9ebc29dbac7e2aef3331ec177bd0edc300d15b89 /home/public/TurnBasedMC/TurnBasedMinecraft-NeoForge-1.26.3-MC-1.21.1-all.jar
|
||||||
|
|
||||||
|
## Forge 1.26.3
|
||||||
|
|
||||||
|
$ java --version
|
||||||
|
openjdk 21.0.5 2024-10-15
|
||||||
|
OpenJDK Runtime Environment (build 21.0.5+11)
|
||||||
|
OpenJDK 64-Bit Server VM (build 21.0.5+11, mixed mode, sharing)
|
||||||
|
|
||||||
|
$ javac --version
|
||||||
|
javac 21.0.5
|
||||||
|
|
||||||
|
$ sha256sum build/libs/TurnBasedMinecraft-Forge-1.26.3-all.jar
|
||||||
|
5fdaffd14f75c2340a410c37811a5f7644ade3c6852db4b982bf3161bab1aae7 build/libs/TurnBasedMinecraft-Forge-1.26.3-all.jar
|
||||||
|
|
||||||
## NeoForge 1.26.2
|
## NeoForge 1.26.2
|
||||||
|
|
||||||
$ java --version
|
$ java --version
|
||||||
|
|
|
@ -21,7 +21,7 @@ minecraft_version=1.21.1
|
||||||
minecraft_version_range=[1.21.1, 1.22)
|
minecraft_version_range=[1.21.1, 1.22)
|
||||||
|
|
||||||
# The Neo version must agree with the Minecraft version to get a valid artifact
|
# The Neo version must agree with the Minecraft version to get a valid artifact
|
||||||
neo_version=21.1.72
|
neo_version=21.1.73
|
||||||
# The Neo version range can use any version of Neo as bounds
|
# The Neo version range can use any version of Neo as bounds
|
||||||
neo_version_range=[21.1.0,)
|
neo_version_range=[21.1.0,)
|
||||||
# The loader version range can only use the major version of FML as bounds
|
# The loader version range can only use the major version of FML as bounds
|
||||||
|
@ -37,7 +37,7 @@ mod_name=TurnBasedMinecraftMod
|
||||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||||
mod_license=MIT
|
mod_license=MIT
|
||||||
# The mod version. See https://semver.org/
|
# The mod version. See https://semver.org/
|
||||||
mod_version=1.26.2
|
mod_version=1.26.4-MC-1.21.1
|
||||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||||
# This should match the base package used for the mod sources.
|
# This should match the base package used for the mod sources.
|
||||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
|
|
|
@ -481,22 +481,27 @@ public class ClientProxy extends CommonProxy {
|
||||||
MutableComponent text = Component.literal("Edit what value? ");
|
MutableComponent text = Component.literal("Edit what value? ");
|
||||||
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
||||||
|
|
||||||
MutableComponent option = Component.literal("IgB");
|
MutableComponent option;
|
||||||
// HoverEvent.Action.SHOW_TEXT is probably SHOW_TEXT
|
MutableComponent value;
|
||||||
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle"))
|
|
||||||
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("IgnoreBattle"))));
|
|
||||||
MutableComponent value = Component.literal("(" + pkt.getEntityInfo().ignoreBattle + ") ");
|
|
||||||
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
|
||||||
option.getSiblings().add(value);
|
|
||||||
text.getSiblings().add(option);
|
|
||||||
|
|
||||||
option = Component.literal("AP");
|
if (pkt.getEntityInfo().playerName.isEmpty()) {
|
||||||
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackPower"))
|
option = Component.literal("IgB");
|
||||||
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("AttackPower"))));
|
// HoverEvent.Action.SHOW_TEXT is probably SHOW_TEXT
|
||||||
value = Component.literal("(" + pkt.getEntityInfo().attackPower + ") ");
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit ignoreBattle"))
|
||||||
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("IgnoreBattle"))));
|
||||||
option.getSiblings().add(value);
|
value = Component.literal("(" + pkt.getEntityInfo().ignoreBattle + ") ");
|
||||||
text.getSiblings().add(option);
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
||||||
|
option.getSiblings().add(value);
|
||||||
|
text.getSiblings().add(option);
|
||||||
|
|
||||||
|
option = Component.literal("AP");
|
||||||
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackPower"))
|
||||||
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("AttackPower"))));
|
||||||
|
value = Component.literal("(" + pkt.getEntityInfo().attackPower + ") ");
|
||||||
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
||||||
|
option.getSiblings().add(value);
|
||||||
|
text.getSiblings().add(option);
|
||||||
|
}
|
||||||
|
|
||||||
option = Component.literal("APr");
|
option = Component.literal("APr");
|
||||||
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackProbability"))
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackProbability"))
|
||||||
|
@ -506,13 +511,15 @@ public class ClientProxy extends CommonProxy {
|
||||||
option.getSiblings().add(value);
|
option.getSiblings().add(value);
|
||||||
text.getSiblings().add(option);
|
text.getSiblings().add(option);
|
||||||
|
|
||||||
option = Component.literal("AV");
|
if (pkt.getEntityInfo().playerName.isEmpty()) {
|
||||||
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackVariance"))
|
option = Component.literal("AV");
|
||||||
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("AttackVariance"))));
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackVariance"))
|
||||||
value = Component.literal("(" + pkt.getEntityInfo().attackVariance + ") ");
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("AttackVariance"))));
|
||||||
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
value = Component.literal("(" + pkt.getEntityInfo().attackVariance + ") ");
|
||||||
option.getSiblings().add(value);
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
||||||
text.getSiblings().add(option);
|
option.getSiblings().add(value);
|
||||||
|
text.getSiblings().add(option);
|
||||||
|
}
|
||||||
|
|
||||||
option = Component.literal("AE");
|
option = Component.literal("AE");
|
||||||
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffect"))
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffect"))
|
||||||
|
@ -530,21 +537,23 @@ public class ClientProxy extends CommonProxy {
|
||||||
option.getSiblings().add(value);
|
option.getSiblings().add(value);
|
||||||
text.getSiblings().add(option);
|
text.getSiblings().add(option);
|
||||||
|
|
||||||
option = Component.literal("DD");
|
if (pkt.getEntityInfo().playerName.isEmpty()) {
|
||||||
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamage"))
|
option = Component.literal("DD");
|
||||||
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("DefenseDamage"))));
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamage"))
|
||||||
value = Component.literal("(" + pkt.getEntityInfo().defenseDamage + ") ");
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("DefenseDamage"))));
|
||||||
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
value = Component.literal("(" + pkt.getEntityInfo().defenseDamage + ") ");
|
||||||
option.getSiblings().add(value);
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
||||||
text.getSiblings().add(option);
|
option.getSiblings().add(value);
|
||||||
|
text.getSiblings().add(option);
|
||||||
|
|
||||||
option = Component.literal("DDPr");
|
option = Component.literal("DDPr");
|
||||||
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamageProbability"))
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamageProbability"))
|
||||||
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("DefenseDamageProbability"))));
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("DefenseDamageProbability"))));
|
||||||
value = Component.literal("(" + pkt.getEntityInfo().defenseDamageProbability + "%) ");
|
value = Component.literal("(" + pkt.getEntityInfo().defenseDamageProbability + "%) ");
|
||||||
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
||||||
option.getSiblings().add(value);
|
option.getSiblings().add(value);
|
||||||
text.getSiblings().add(option);
|
text.getSiblings().add(option);
|
||||||
|
}
|
||||||
|
|
||||||
option = Component.literal("E");
|
option = Component.literal("E");
|
||||||
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit evasion"))
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit evasion"))
|
||||||
|
@ -562,37 +571,55 @@ public class ClientProxy extends CommonProxy {
|
||||||
option.getSiblings().add(value);
|
option.getSiblings().add(value);
|
||||||
text.getSiblings().add(option);
|
text.getSiblings().add(option);
|
||||||
|
|
||||||
option = Component.literal("C");
|
option = Component.literal("HS");
|
||||||
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category"))
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit hasteSpeed"))
|
||||||
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("Category"))));
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("HasteSpeed"))));
|
||||||
value = Component.literal("(" + pkt.getEntityInfo().category + ") ");
|
value = Component.literal("(" + pkt.getEntityInfo().hasteSpeed + ") ");
|
||||||
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
||||||
option.getSiblings().add(value);
|
option.getSiblings().add(value);
|
||||||
text.getSiblings().add(option);
|
text.getSiblings().add(option);
|
||||||
|
|
||||||
option = Component.literal("DecA");
|
option = Component.literal("SS");
|
||||||
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionAttack"))
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit slowSpeed"))
|
||||||
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("DecisionAttack"))));
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("SlowSpeed"))));
|
||||||
value = Component.literal("(" + pkt.getEntityInfo().decisionAttack + "%) ");
|
value = Component.literal("(" + pkt.getEntityInfo().slowSpeed + ") ");
|
||||||
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
||||||
option.getSiblings().add(value);
|
option.getSiblings().add(value);
|
||||||
text.getSiblings().add(option);
|
text.getSiblings().add(option);
|
||||||
|
|
||||||
option = Component.literal("DecD");
|
if (pkt.getEntityInfo().playerName.isEmpty()) {
|
||||||
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionDefend"))
|
option = Component.literal("C");
|
||||||
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("DecisionDefend"))));
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category"))
|
||||||
value = Component.literal("(" + pkt.getEntityInfo().decisionDefend + "%) ");
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("Category"))));
|
||||||
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
value = Component.literal("(" + pkt.getEntityInfo().category + ") ");
|
||||||
option.getSiblings().add(value);
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
||||||
text.getSiblings().add(option);
|
option.getSiblings().add(value);
|
||||||
|
text.getSiblings().add(option);
|
||||||
|
|
||||||
option = Component.literal("DecF");
|
option = Component.literal("DecA");
|
||||||
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionFlee"))
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionAttack"))
|
||||||
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("DecisionFlee"))));
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("DecisionAttack"))));
|
||||||
value = Component.literal("(" + pkt.getEntityInfo().decisionFlee + "%) ");
|
value = Component.literal("(" + pkt.getEntityInfo().decisionAttack + "%) ");
|
||||||
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
||||||
option.getSiblings().add(value);
|
option.getSiblings().add(value);
|
||||||
text.getSiblings().add(option);
|
text.getSiblings().add(option);
|
||||||
|
|
||||||
|
option = Component.literal("DecD");
|
||||||
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionDefend"))
|
||||||
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("DecisionDefend"))));
|
||||||
|
value = Component.literal("(" + pkt.getEntityInfo().decisionDefend + "%) ");
|
||||||
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
||||||
|
option.getSiblings().add(value);
|
||||||
|
text.getSiblings().add(option);
|
||||||
|
|
||||||
|
option = Component.literal("DecF");
|
||||||
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit decisionFlee"))
|
||||||
|
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("DecisionFlee"))));
|
||||||
|
value = Component.literal("(" + pkt.getEntityInfo().decisionFlee + "%) ");
|
||||||
|
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
||||||
|
option.getSiblings().add(value);
|
||||||
|
text.getSiblings().add(option);
|
||||||
|
}
|
||||||
|
|
||||||
option = Component.literal("Finished Editing");
|
option = Component.literal("Finished Editing");
|
||||||
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit finish")));
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit finish")));
|
||||||
|
@ -1302,6 +1329,44 @@ public class ClientProxy extends CommonProxy {
|
||||||
TurnBasedMinecraftMod.proxy.displayComponent(parentComponent);
|
TurnBasedMinecraftMod.proxy.displayComponent(parentComponent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case EDIT_HASTE_SPEED: {
|
||||||
|
MutableComponent text = Component.literal("haste speed: ");
|
||||||
|
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
||||||
|
|
||||||
|
for (int i = 0; i <= 100; i += 10) {
|
||||||
|
MutableComponent option = Component.literal(Integer.toString(i));
|
||||||
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit hasteSpeed " + Integer.toString(i))));
|
||||||
|
text.getSiblings().add(option);
|
||||||
|
if (i < 100) {
|
||||||
|
text.getSiblings().add(Component.literal(", "));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
text.getSiblings().add(Component.literal(" (or use command \"/tbm-edit edit hasteSpeed <integer>\")"));
|
||||||
|
|
||||||
|
parentComponent.getSiblings().add(text);
|
||||||
|
TurnBasedMinecraftMod.proxy.displayComponent(parentComponent);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EDIT_SLOW_SPEED: {
|
||||||
|
MutableComponent text = Component.literal("slow speed: ");
|
||||||
|
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
||||||
|
|
||||||
|
for (int i = 0; i <= 100; i += 10) {
|
||||||
|
MutableComponent option = Component.literal(Integer.toString(i));
|
||||||
|
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit slowSpeed " + Integer.toString(i))));
|
||||||
|
text.getSiblings().add(option);
|
||||||
|
if (i < 100) {
|
||||||
|
text.getSiblings().add(Component.literal(", "));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
text.getSiblings().add(Component.literal(" (or use command \"/tbm-edit edit slowSpeed <integer>\")"));
|
||||||
|
|
||||||
|
parentComponent.getSiblings().add(text);
|
||||||
|
TurnBasedMinecraftMod.proxy.displayComponent(parentComponent);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case EDIT_CATEGORY: {
|
case EDIT_CATEGORY: {
|
||||||
MutableComponent text = Component.literal("category: ");
|
MutableComponent text = Component.literal("category: ");
|
||||||
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
||||||
|
@ -1472,6 +1537,10 @@ public class ClientProxy extends CommonProxy {
|
||||||
TurnBasedMinecraftMod.proxy.displayComponent(parentComponent);
|
TurnBasedMinecraftMod.proxy.displayComponent(parentComponent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case PICK_PLAYER: {
|
||||||
|
TurnBasedMinecraftMod.proxy.displayString("Use \"/tbm-edit player <player_name>\"");
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,6 +134,9 @@ public class Battle {
|
||||||
} catch (NullPointerException exception) {
|
} catch (NullPointerException exception) {
|
||||||
entityInfo = null;
|
entityInfo = null;
|
||||||
}
|
}
|
||||||
|
if (entityInfo == null) {
|
||||||
|
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getPlayerInfo(e.getName().getString());
|
||||||
|
}
|
||||||
if (entityInfo == null) {
|
if (entityInfo == null) {
|
||||||
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getMatchingEntityInfo(e);
|
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getMatchingEntityInfo(e);
|
||||||
}
|
}
|
||||||
|
@ -166,6 +169,9 @@ public class Battle {
|
||||||
} catch (NullPointerException exception) {
|
} catch (NullPointerException exception) {
|
||||||
entityInfo = null;
|
entityInfo = null;
|
||||||
}
|
}
|
||||||
|
if (entityInfo == null) {
|
||||||
|
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getPlayerInfo(e.getName().getString());
|
||||||
|
}
|
||||||
if (entityInfo == null) {
|
if (entityInfo == null) {
|
||||||
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getMatchingEntityInfo(e);
|
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getMatchingEntityInfo(e);
|
||||||
}
|
}
|
||||||
|
@ -268,6 +274,9 @@ public class Battle {
|
||||||
} catch (NullPointerException exception) {
|
} catch (NullPointerException exception) {
|
||||||
entityInfo = null;
|
entityInfo = null;
|
||||||
}
|
}
|
||||||
|
if (entityInfo == null) {
|
||||||
|
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getPlayerInfo(e.getName().getString());
|
||||||
|
}
|
||||||
if (entityInfo == null) {
|
if (entityInfo == null) {
|
||||||
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getMatchingEntityInfo(e);
|
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getMatchingEntityInfo(e);
|
||||||
}
|
}
|
||||||
|
@ -316,6 +325,9 @@ public class Battle {
|
||||||
} catch (NullPointerException exception) {
|
} catch (NullPointerException exception) {
|
||||||
entityInfo = null;
|
entityInfo = null;
|
||||||
}
|
}
|
||||||
|
if (entityInfo == null) {
|
||||||
|
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getPlayerInfo(e.getName().getString());
|
||||||
|
}
|
||||||
if (entityInfo == null) {
|
if (entityInfo == null) {
|
||||||
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getMatchingEntityInfo(e);
|
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getMatchingEntityInfo(e);
|
||||||
}
|
}
|
||||||
|
@ -781,7 +793,7 @@ public class Battle {
|
||||||
case ATTACK:
|
case ATTACK:
|
||||||
debugLog += " attack";
|
debugLog += " attack";
|
||||||
Combatant target = null;
|
Combatant target = null;
|
||||||
if (next.entity instanceof Player) {
|
if (next.entity instanceof Player player) {
|
||||||
debugLog += " as player";
|
debugLog += " as player";
|
||||||
target = sideA.get(next.targetEntityID);
|
target = sideA.get(next.targetEntityID);
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
|
@ -790,15 +802,15 @@ public class Battle {
|
||||||
if (target == null || !target.entity.isAlive() || target == next) {
|
if (target == null || !target.entity.isAlive() || target == next) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ItemStack heldItemStack = ((Player) next.entity).getMainHandItem();
|
ItemStack heldItemStack = player.getMainHandItem();
|
||||||
if (heldItemStack.getItem() instanceof BowItem) {
|
if (heldItemStack.getItem() instanceof BowItem) {
|
||||||
debugLog += " with bow";
|
debugLog += " with bow";
|
||||||
if (Utility.doesPlayerHaveArrows((Player) next.entity)) {
|
if (Utility.doesPlayerHaveArrows(player)) {
|
||||||
final Entity nextEntity = next.entity;
|
final Entity nextEntity = next.entity;
|
||||||
final Entity targetEntity = target.entity;
|
final Entity targetEntity = target.entity;
|
||||||
final float yawDirection = Utility.yawDirection(next.entity.getX(), next.entity.getZ(), target.entity.getX(), target.entity.getZ());
|
final float yawDirection = Utility.yawDirection(next.entity.getX(), next.entity.getZ(), target.entity.getX(), target.entity.getZ());
|
||||||
final float pitchDirection = Utility.pitchDirection(next.entity.getX(), next.entity.getY(), next.entity.getZ(), target.entity.getX(), target.entity.getY(), target.entity.getZ());
|
final float pitchDirection = Utility.pitchDirection(next.entity.getX(), next.entity.getY(), next.entity.getZ(), target.entity.getX(), target.entity.getY(), target.entity.getZ());
|
||||||
final int randomTimeLeft = random.nextInt(heldItemStack.getItem().getUseDuration(heldItemStack, (LivingEntity)next.entity) / 3);
|
final int randomTimeLeft = random.nextInt(heldItemStack.getItem().getUseDuration(heldItemStack, player) / 3);
|
||||||
if (TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled()) {
|
if (TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled()) {
|
||||||
next.yaw = yawDirection;
|
next.yaw = yawDirection;
|
||||||
next.pitch = pitchDirection;
|
next.pitch = pitchDirection;
|
||||||
|
@ -815,7 +827,7 @@ public class Battle {
|
||||||
continue;
|
continue;
|
||||||
} else if (heldItemStack.getItem() instanceof CrossbowItem) {
|
} else if (heldItemStack.getItem() instanceof CrossbowItem) {
|
||||||
debugLog += " with crossbow";
|
debugLog += " with crossbow";
|
||||||
if (Utility.doesPlayerHaveArrows((Player) next.entity)) {
|
if (Utility.doesPlayerHaveArrows(player)) {
|
||||||
final Entity nextEntity = next.entity;
|
final Entity nextEntity = next.entity;
|
||||||
final Entity targetEntity = target.entity;
|
final Entity targetEntity = target.entity;
|
||||||
final float yawDirection = Utility.yawDirection(next.entity.getX(), next.entity.getZ(), target.entity.getX(), target.entity.getZ());
|
final float yawDirection = Utility.yawDirection(next.entity.getX(), next.entity.getZ(), target.entity.getX(), target.entity.getZ());
|
||||||
|
@ -837,9 +849,18 @@ public class Battle {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
debugLog += " without bow";
|
debugLog += " without bow";
|
||||||
int hitChance = TurnBasedMinecraftMod.proxy.getConfig().getPlayerAttackProbability();
|
int hitChance;
|
||||||
|
if (next.entityInfo != null && !next.entityInfo.playerName.isEmpty()) {
|
||||||
|
hitChance = next.entityInfo.attackProbability;
|
||||||
|
} else {
|
||||||
|
hitChance = TurnBasedMinecraftMod.proxy.getConfig().getPlayerAttackProbability();
|
||||||
|
}
|
||||||
if (target.entity instanceof Player) {
|
if (target.entity instanceof Player) {
|
||||||
hitChance = hitChance * (100 - TurnBasedMinecraftMod.proxy.getConfig().getPlayerEvasion()) / 100;
|
if (target.entityInfo != null && !target.entityInfo.playerName.isEmpty()) {
|
||||||
|
hitChance = hitChance * (100 - target.entityInfo.evasion) / 100;
|
||||||
|
} else {
|
||||||
|
hitChance = hitChance * (100 - TurnBasedMinecraftMod.proxy.getConfig().getPlayerEvasion()) / 100;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
hitChance = hitChance * (100 - target.entityInfo.evasion) / 100;
|
hitChance = hitChance * (100 - target.entityInfo.evasion) / 100;
|
||||||
}
|
}
|
||||||
|
@ -876,6 +897,13 @@ public class Battle {
|
||||||
((Player) nextEntity).attack(targetEntity);
|
((Player) nextEntity).attack(targetEntity);
|
||||||
TurnBasedMinecraftMod.proxy.setAttackingEntity(null);
|
TurnBasedMinecraftMod.proxy.setAttackingEntity(null);
|
||||||
sendMessageToAllPlayers(PacketBattleMessage.MessageType.ATTACK, nextEntity.getId(), targetEntity.getId(), TurnBasedMinecraftMod.proxy.getAttackingDamage());
|
sendMessageToAllPlayers(PacketBattleMessage.MessageType.ATTACK, nextEntity.getId(), targetEntity.getId(), TurnBasedMinecraftMod.proxy.getAttackingDamage());
|
||||||
|
// Attack effect
|
||||||
|
if (next.entityInfo != null && next.entityInfo.attackEffect != EntityInfo.Effect.UNKNOWN && next.entityInfo.attackEffectProbability > 0) {
|
||||||
|
if (random.nextInt(100) < next.entityInfo.attackEffectProbability) {
|
||||||
|
next.entityInfo.attackEffect.applyEffectToEntity((LivingEntity)targetEntity);
|
||||||
|
sendMessageToAllPlayers(PacketBattleMessage.MessageType.WAS_AFFECTED, nextEntity.getId(), targetEntity.getId(), 0, next.entityInfo.attackEffect.getAffectedString());
|
||||||
|
}
|
||||||
|
}
|
||||||
if (defenseDamageTriggered) {
|
if (defenseDamageTriggered) {
|
||||||
// defense damage
|
// defense damage
|
||||||
DamageSource defenseDamageSource = targetEntity.damageSources().mobAttack((LivingEntity) targetEntity);
|
DamageSource defenseDamageSource = targetEntity.damageSources().mobAttack((LivingEntity) targetEntity);
|
||||||
|
@ -1020,48 +1048,111 @@ public class Battle {
|
||||||
int fastestEnemySpeed = 0;
|
int fastestEnemySpeed = 0;
|
||||||
if (next.isSideA) {
|
if (next.isSideA) {
|
||||||
for (Combatant c : sideB.values()) {
|
for (Combatant c : sideB.values()) {
|
||||||
if (c.entity instanceof Player) {
|
if (c.entity instanceof Player player) {
|
||||||
int playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSpeed();
|
int playerSpeed;
|
||||||
if (((Player) c.entity).hasEffect(MobEffects.MOVEMENT_SPEED)) {
|
if (c.entityInfo != null && !c.entityInfo.playerName.isEmpty()) {
|
||||||
playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerHasteSpeed();
|
playerSpeed = c.entityInfo.speed;
|
||||||
} else if (((Player) c.entity).hasEffect(MobEffects.MOVEMENT_SLOWDOWN)) {
|
} else {
|
||||||
playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSlowSpeed();
|
playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSpeed();
|
||||||
|
}
|
||||||
|
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
|
||||||
|
if (c.entityInfo != null && !c.entityInfo.playerName.isEmpty()) {
|
||||||
|
playerSpeed = c.entityInfo.hasteSpeed;
|
||||||
|
} else {
|
||||||
|
playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerHasteSpeed();
|
||||||
|
}
|
||||||
|
} else if (player.hasEffect(MobEffects.MOVEMENT_SLOWDOWN)) {
|
||||||
|
if (c.entityInfo != null && !c.entityInfo.playerName.isEmpty()) {
|
||||||
|
playerSpeed = c.entityInfo.slowSpeed;
|
||||||
|
} else {
|
||||||
|
playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSlowSpeed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (playerSpeed > fastestEnemySpeed) {
|
if (playerSpeed > fastestEnemySpeed) {
|
||||||
fastestEnemySpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSpeed();
|
fastestEnemySpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSpeed();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (c.entityInfo.speed > fastestEnemySpeed) {
|
if (c.entity instanceof LivingEntity livingEntity) {
|
||||||
|
if (livingEntity.hasEffect(MobEffects.MOVEMENT_SPEED)) {
|
||||||
|
if (c.entityInfo.hasteSpeed > fastestEnemySpeed) {
|
||||||
|
fastestEnemySpeed = c.entityInfo.hasteSpeed;
|
||||||
|
}
|
||||||
|
} else if (livingEntity.hasEffect(MobEffects.MOVEMENT_SLOWDOWN)) {
|
||||||
|
if (c.entityInfo.slowSpeed > fastestEnemySpeed) {
|
||||||
|
fastestEnemySpeed = c.entityInfo.slowSpeed;
|
||||||
|
}
|
||||||
|
} else if (c.entityInfo.speed > fastestEnemySpeed) {
|
||||||
|
fastestEnemySpeed = c.entityInfo.speed;
|
||||||
|
}
|
||||||
|
} else if (c.entityInfo.speed > fastestEnemySpeed) {
|
||||||
fastestEnemySpeed = c.entityInfo.speed;
|
fastestEnemySpeed = c.entityInfo.speed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Combatant c : sideA.values()) {
|
for (Combatant c : sideA.values()) {
|
||||||
if (c.entity instanceof Player) {
|
if (c.entity instanceof Player player) {
|
||||||
int playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSpeed();
|
int playerSpeed;
|
||||||
if (((Player) c.entity).hasEffect(MobEffects.MOVEMENT_SPEED)) {
|
if (c.entityInfo != null && !c.entityInfo.playerName.isEmpty()) {
|
||||||
playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerHasteSpeed();
|
playerSpeed = c.entityInfo.speed;
|
||||||
} else if (((Player) c.entity).hasEffect(MobEffects.MOVEMENT_SLOWDOWN)) {
|
} else {
|
||||||
playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSlowSpeed();
|
playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSpeed();
|
||||||
|
}
|
||||||
|
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
|
||||||
|
if (c.entityInfo != null && !c.entityInfo.playerName.isEmpty()) {
|
||||||
|
playerSpeed = c.entityInfo.hasteSpeed;
|
||||||
|
} else {
|
||||||
|
playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerHasteSpeed();
|
||||||
|
}
|
||||||
|
} else if (player.hasEffect(MobEffects.MOVEMENT_SLOWDOWN)) {
|
||||||
|
if (c.entityInfo != null && !c.entityInfo.playerName.isEmpty()) {
|
||||||
|
playerSpeed = c.entityInfo.slowSpeed;
|
||||||
|
} else {
|
||||||
|
playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSlowSpeed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (playerSpeed > fastestEnemySpeed) {
|
if (playerSpeed > fastestEnemySpeed) {
|
||||||
fastestEnemySpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSpeed();
|
fastestEnemySpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSpeed();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (c.entityInfo.speed > fastestEnemySpeed) {
|
if (c.entity instanceof LivingEntity livingEntity) {
|
||||||
|
if (livingEntity.hasEffect(MobEffects.MOVEMENT_SPEED)) {
|
||||||
|
if (c.entityInfo.hasteSpeed > fastestEnemySpeed) {
|
||||||
|
fastestEnemySpeed = c.entityInfo.hasteSpeed;
|
||||||
|
}
|
||||||
|
} else if (livingEntity.hasEffect(MobEffects.MOVEMENT_SLOWDOWN)) {
|
||||||
|
if (c.entityInfo.slowSpeed > fastestEnemySpeed) {
|
||||||
|
fastestEnemySpeed = c.entityInfo.slowSpeed;
|
||||||
|
}
|
||||||
|
} else if (c.entityInfo.speed > fastestEnemySpeed) {
|
||||||
|
fastestEnemySpeed = c.entityInfo.speed;
|
||||||
|
}
|
||||||
|
} else if (c.entityInfo.speed > fastestEnemySpeed) {
|
||||||
fastestEnemySpeed = c.entityInfo.speed;
|
fastestEnemySpeed = c.entityInfo.speed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int fleeProbability = 0;
|
int fleeProbability = 0;
|
||||||
if (next.entity instanceof Player) {
|
if (next.entity instanceof Player player) {
|
||||||
int playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSpeed();
|
int playerSpeed;
|
||||||
if (((Player) next.entity).hasEffect(MobEffects.MOVEMENT_SPEED)) {
|
if (next.entityInfo != null && !next.entityInfo.playerName.isEmpty()) {
|
||||||
playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerHasteSpeed();
|
playerSpeed = next.entityInfo.speed;
|
||||||
} else if (((Player) next.entity).hasEffect(MobEffects.MOVEMENT_SLOWDOWN)) {
|
} else {
|
||||||
playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSlowSpeed();
|
playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSpeed();
|
||||||
|
}
|
||||||
|
if (player.hasEffect(MobEffects.MOVEMENT_SPEED)) {
|
||||||
|
if (next.entityInfo != null && !next.entityInfo.playerName.isEmpty()) {
|
||||||
|
playerSpeed = next.entityInfo.hasteSpeed;
|
||||||
|
} else {
|
||||||
|
playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerHasteSpeed();
|
||||||
|
}
|
||||||
|
} else if (player.hasEffect(MobEffects.MOVEMENT_SLOWDOWN)) {
|
||||||
|
if (next.entityInfo != null && !next.entityInfo.playerName.isEmpty()) {
|
||||||
|
playerSpeed = next.entityInfo.slowSpeed;
|
||||||
|
} else {
|
||||||
|
playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSlowSpeed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (fastestEnemySpeed >= playerSpeed) {
|
if (fastestEnemySpeed >= playerSpeed) {
|
||||||
fleeProbability = TurnBasedMinecraftMod.proxy.getConfig().getFleeBadProbability();
|
fleeProbability = TurnBasedMinecraftMod.proxy.getConfig().getFleeBadProbability();
|
||||||
|
|
|
@ -24,6 +24,7 @@ public class Config
|
||||||
private boolean battleDecisionDurationForever = false;
|
private boolean battleDecisionDurationForever = false;
|
||||||
private Map<String, EntityInfo> entityInfoMap;
|
private Map<String, EntityInfo> entityInfoMap;
|
||||||
private Map<String, EntityInfo> customEntityInfoMap;
|
private Map<String, EntityInfo> customEntityInfoMap;
|
||||||
|
private Map<String, EntityInfo> customPlayerInfoMap;
|
||||||
private Set<String> ignoreBattleTypes;
|
private Set<String> ignoreBattleTypes;
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
private int playerSpeed = 50;
|
private int playerSpeed = 50;
|
||||||
|
@ -57,6 +58,7 @@ public class Config
|
||||||
{
|
{
|
||||||
entityInfoMap = new HashMap<String, EntityInfo>();
|
entityInfoMap = new HashMap<String, EntityInfo>();
|
||||||
customEntityInfoMap = new HashMap<String, EntityInfo>();
|
customEntityInfoMap = new HashMap<String, EntityInfo>();
|
||||||
|
customPlayerInfoMap = new HashMap<String, EntityInfo>();
|
||||||
ignoreBattleTypes = new HashSet<String>();
|
ignoreBattleTypes = new HashSet<String>();
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
battleIgnoringPlayers = new HashSet<Integer>();
|
battleIgnoringPlayers = new HashSet<Integer>();
|
||||||
|
@ -517,23 +519,33 @@ public class Config
|
||||||
logger.error("Entity with invalid custom_name (must be a string), skipping...");
|
logger.error("Entity with invalid custom_name (must be a string), skipping...");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
} else if (nestedConf.contains("player_name")) {
|
||||||
|
try {
|
||||||
|
eInfo.playerName = nestedConf.get("player_name");
|
||||||
|
name = eInfo.playerName;
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
logger.error("Entity with invalid player_name (must be a string), skipping...");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.error("Entity must have \"name\" or \"custom_name\" entry");
|
logger.error("Entity must have \"name\" or \"custom_name\" or \"player_name\" entry");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (eInfo.playerName.isEmpty()) {
|
||||||
eInfo.attackPower = nestedConf.getInt("attack_power");
|
try {
|
||||||
if(eInfo.attackPower < 0) {
|
eInfo.attackPower = nestedConf.getInt("attack_power");
|
||||||
logClampedValueEntity("attack_power", name, Integer.toString(eInfo.attackPower), "0");
|
if (eInfo.attackPower < 0) {
|
||||||
eInfo.attackPower = 0;
|
logClampedValueEntity("attack_power", name, Integer.toString(eInfo.attackPower), "0");
|
||||||
|
eInfo.attackPower = 0;
|
||||||
|
}
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
logEntityInvalidValue("attack_power", name, "3");
|
||||||
|
eInfo.attackPower = 3;
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logEntityMissingRequiredValue("attack_power", name, "3");
|
||||||
|
eInfo.attackPower = 3;
|
||||||
}
|
}
|
||||||
} catch (ClassCastException e) {
|
|
||||||
logEntityInvalidValue("attack_power", name, "3");
|
|
||||||
eInfo.attackPower = 3;
|
|
||||||
} catch (NullPointerException e) {
|
|
||||||
logEntityMissingRequiredValue("attack_power", name, "3");
|
|
||||||
eInfo.attackPower = 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -581,49 +593,51 @@ public class Config
|
||||||
logEntityMissingOptionalValue("attack_effect", name, "unknown");
|
logEntityMissingOptionalValue("attack_effect", name, "unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (eInfo.playerName.isEmpty()) {
|
||||||
eInfo.attackVariance = nestedConf.getInt("attack_variance");
|
try {
|
||||||
if(eInfo.attackVariance < 0) {
|
eInfo.attackVariance = nestedConf.getInt("attack_variance");
|
||||||
logClampedValueEntity("attack_variance", name, Integer.toString(eInfo.attackVariance), "0");
|
if (eInfo.attackVariance < 0) {
|
||||||
eInfo.attackVariance = 0;
|
logClampedValueEntity("attack_variance", name, Integer.toString(eInfo.attackVariance), "0");
|
||||||
}
|
eInfo.attackVariance = 0;
|
||||||
} catch (ClassCastException e) {
|
|
||||||
eInfo.attackVariance = 0;
|
|
||||||
logEntityInvalidValue("attack_variance", name, "0");
|
|
||||||
} catch (NullPointerException e) {
|
|
||||||
eInfo.attackVariance = 0;
|
|
||||||
logEntityMissingOptionalValue("attack_variance", name, "0");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
eInfo.defenseDamage = nestedConf.getInt("defense_damage");
|
|
||||||
if(eInfo.defenseDamage < 0) {
|
|
||||||
logClampedValueEntity("defense_damage", name, Integer.toString(eInfo.defenseDamage), "0");
|
|
||||||
eInfo.defenseDamage = 0;
|
|
||||||
} else if(eInfo.defenseDamage != 0) {
|
|
||||||
try {
|
|
||||||
eInfo.defenseDamageProbability = nestedConf.getInt("defense_damage_probability");
|
|
||||||
if(eInfo.defenseDamageProbability < 1) {
|
|
||||||
logClampedValueEntity("defense_damage_probability", name, Integer.toString(eInfo.defenseDamageProbability), "1");
|
|
||||||
eInfo.defenseDamageProbability = 1;
|
|
||||||
} else if(eInfo.defenseDamageProbability > 100) {
|
|
||||||
logClampedValueEntity("defense_damage_probability", name, Integer.toString(eInfo.defenseDamageProbability), "100");
|
|
||||||
eInfo.defenseDamageProbability = 100;
|
|
||||||
}
|
|
||||||
} catch (ClassCastException e) {
|
|
||||||
eInfo.defenseDamage = 0;
|
|
||||||
logger.warn("Entity \"" + name + "\" has specified defense_damage but defense_damage_probability is invalid, disabling defense_damage");
|
|
||||||
} catch (NullPointerException e) {
|
|
||||||
eInfo.defenseDamage = 0;
|
|
||||||
logger.warn("Entity \"" + name + "\" has specified defense_damage but defense_damage_probability is missing, disabling defense_damage");
|
|
||||||
}
|
}
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
eInfo.attackVariance = 0;
|
||||||
|
logEntityInvalidValue("attack_variance", name, "0");
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
eInfo.attackVariance = 0;
|
||||||
|
logEntityMissingOptionalValue("attack_variance", name, "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
eInfo.defenseDamage = nestedConf.getInt("defense_damage");
|
||||||
|
if (eInfo.defenseDamage < 0) {
|
||||||
|
logClampedValueEntity("defense_damage", name, Integer.toString(eInfo.defenseDamage), "0");
|
||||||
|
eInfo.defenseDamage = 0;
|
||||||
|
} else if (eInfo.defenseDamage != 0) {
|
||||||
|
try {
|
||||||
|
eInfo.defenseDamageProbability = nestedConf.getInt("defense_damage_probability");
|
||||||
|
if (eInfo.defenseDamageProbability < 1) {
|
||||||
|
logClampedValueEntity("defense_damage_probability", name, Integer.toString(eInfo.defenseDamageProbability), "1");
|
||||||
|
eInfo.defenseDamageProbability = 1;
|
||||||
|
} else if (eInfo.defenseDamageProbability > 100) {
|
||||||
|
logClampedValueEntity("defense_damage_probability", name, Integer.toString(eInfo.defenseDamageProbability), "100");
|
||||||
|
eInfo.defenseDamageProbability = 100;
|
||||||
|
}
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
eInfo.defenseDamage = 0;
|
||||||
|
logger.warn("Entity \"" + name + "\" has specified defense_damage but defense_damage_probability is invalid, disabling defense_damage");
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
eInfo.defenseDamage = 0;
|
||||||
|
logger.warn("Entity \"" + name + "\" has specified defense_damage but defense_damage_probability is missing, disabling defense_damage");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
eInfo.defenseDamage = 0;
|
||||||
|
logEntityInvalidValue("defense_damage", name, "0");
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
eInfo.defenseDamage = 0;
|
||||||
|
logEntityMissingOptionalValue("defense_damage", name, "0");
|
||||||
}
|
}
|
||||||
} catch (ClassCastException e) {
|
|
||||||
eInfo.defenseDamage = 0;
|
|
||||||
logEntityInvalidValue("defense_damage", name, "0");
|
|
||||||
} catch (NullPointerException e) {
|
|
||||||
eInfo.defenseDamage = 0;
|
|
||||||
logEntityMissingOptionalValue("defense_damage", name, "0");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -654,82 +668,106 @@ public class Config
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
eInfo.ignoreBattle = nestedConf.get("ignore_battle");
|
eInfo.hasteSpeed = nestedConf.getInt("haste_speed");
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
logEntityInvalidValue("ignore_battle", name, "false");
|
logEntityInvalidValue("haste_speed", name, "80");
|
||||||
eInfo.ignoreBattle = false;
|
eInfo.hasteSpeed = 80;
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
logEntityMissingRequiredValue("ignore_battle", name, "false");
|
logEntityMissingOptionalValue("haste_speed", name, "80");
|
||||||
eInfo.ignoreBattle = false;
|
eInfo.hasteSpeed = 80;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
eInfo.category = nestedConf.get("category");
|
eInfo.slowSpeed = nestedConf.getInt("slow_speed");
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
logEntityInvalidValue("category", name, "unknown");
|
logEntityInvalidValue("slow_speed", name, "20");
|
||||||
eInfo.category = "unknown";
|
eInfo.slowSpeed = 20;
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
logEntityMissingRequiredValue("category", name, "unknown");
|
logEntityMissingOptionalValue("slow_speed", name, "20");
|
||||||
eInfo.category = "unknown";
|
eInfo.slowSpeed = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (eInfo.playerName.isEmpty()) {
|
||||||
eInfo.decisionAttack = nestedConf.getInt("decision_attack_probability");
|
try {
|
||||||
if(eInfo.decisionAttack < 0) {
|
eInfo.ignoreBattle = nestedConf.get("ignore_battle");
|
||||||
logClampedValueEntity("decision_attack_probability", name, Integer.toString(eInfo.decisionAttack), "0");
|
} catch (ClassCastException e) {
|
||||||
eInfo.decisionAttack = 0;
|
logEntityInvalidValue("ignore_battle", name, "false");
|
||||||
} else if(eInfo.decisionAttack > 100) {
|
eInfo.ignoreBattle = false;
|
||||||
logClampedValueEntity("decision_attack_probability", name, Integer.toString(eInfo.decisionAttack), "100");
|
} catch (NullPointerException e) {
|
||||||
eInfo.decisionAttack = 100;
|
logEntityMissingRequiredValue("ignore_battle", name, "false");
|
||||||
|
eInfo.ignoreBattle = false;
|
||||||
}
|
}
|
||||||
} catch (ClassCastException e) {
|
|
||||||
logEntityInvalidValue("decision_attack_probability", name, "70");
|
|
||||||
eInfo.decisionAttack = 70;
|
|
||||||
} catch (NullPointerException e) {
|
|
||||||
logEntityMissingRequiredValue("decision_attack_probability", name, "70");
|
|
||||||
eInfo.decisionAttack = 70;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
eInfo.decisionDefend = nestedConf.getInt("decision_defend_probability");
|
eInfo.category = nestedConf.get("category");
|
||||||
if(eInfo.decisionDefend < 0) {
|
} catch (ClassCastException e) {
|
||||||
logClampedValueEntity("decision_defend_probability", name, Integer.toString(eInfo.decisionDefend), "0");
|
logEntityInvalidValue("category", name, "unknown");
|
||||||
eInfo.decisionDefend = 0;
|
eInfo.category = "unknown";
|
||||||
} else if(eInfo.decisionDefend > 100) {
|
} catch (NullPointerException e) {
|
||||||
logClampedValueEntity("decision_defend_probability", name, Integer.toString(eInfo.decisionDefend), "100");
|
logEntityMissingRequiredValue("category", name, "unknown");
|
||||||
eInfo.decisionDefend = 100;
|
eInfo.category = "unknown";
|
||||||
}
|
}
|
||||||
} catch (ClassCastException e) {
|
|
||||||
logEntityInvalidValue("decision_defend_probability", name, "20");
|
|
||||||
eInfo.decisionDefend = 20;
|
|
||||||
} catch (NullPointerException e) {
|
|
||||||
logEntityMissingRequiredValue("decision_defend_probability", name, "20");
|
|
||||||
eInfo.decisionDefend = 20;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
eInfo.decisionFlee = nestedConf.getInt("decision_flee_probability");
|
eInfo.decisionAttack = nestedConf.getInt("decision_attack_probability");
|
||||||
if(eInfo.decisionFlee < 0) {
|
if (eInfo.decisionAttack < 0) {
|
||||||
logClampedValueEntity("decision_flee_probability", name, Integer.toString(eInfo.decisionFlee), "0");
|
logClampedValueEntity("decision_attack_probability", name, Integer.toString(eInfo.decisionAttack), "0");
|
||||||
eInfo.decisionFlee = 0;
|
eInfo.decisionAttack = 0;
|
||||||
} else if(eInfo.decisionFlee > 100) {
|
} else if (eInfo.decisionAttack > 100) {
|
||||||
logClampedValueEntity("decision_flee_probability", name, Integer.toString(eInfo.decisionFlee), "100");
|
logClampedValueEntity("decision_attack_probability", name, Integer.toString(eInfo.decisionAttack), "100");
|
||||||
eInfo.decisionFlee = 100;
|
eInfo.decisionAttack = 100;
|
||||||
|
}
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
logEntityInvalidValue("decision_attack_probability", name, "70");
|
||||||
|
eInfo.decisionAttack = 70;
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logEntityMissingRequiredValue("decision_attack_probability", name, "70");
|
||||||
|
eInfo.decisionAttack = 70;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
eInfo.decisionDefend = nestedConf.getInt("decision_defend_probability");
|
||||||
|
if (eInfo.decisionDefend < 0) {
|
||||||
|
logClampedValueEntity("decision_defend_probability", name, Integer.toString(eInfo.decisionDefend), "0");
|
||||||
|
eInfo.decisionDefend = 0;
|
||||||
|
} else if (eInfo.decisionDefend > 100) {
|
||||||
|
logClampedValueEntity("decision_defend_probability", name, Integer.toString(eInfo.decisionDefend), "100");
|
||||||
|
eInfo.decisionDefend = 100;
|
||||||
|
}
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
logEntityInvalidValue("decision_defend_probability", name, "20");
|
||||||
|
eInfo.decisionDefend = 20;
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logEntityMissingRequiredValue("decision_defend_probability", name, "20");
|
||||||
|
eInfo.decisionDefend = 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
eInfo.decisionFlee = nestedConf.getInt("decision_flee_probability");
|
||||||
|
if (eInfo.decisionFlee < 0) {
|
||||||
|
logClampedValueEntity("decision_flee_probability", name, Integer.toString(eInfo.decisionFlee), "0");
|
||||||
|
eInfo.decisionFlee = 0;
|
||||||
|
} else if (eInfo.decisionFlee > 100) {
|
||||||
|
logClampedValueEntity("decision_flee_probability", name, Integer.toString(eInfo.decisionFlee), "100");
|
||||||
|
eInfo.decisionFlee = 100;
|
||||||
|
}
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
logEntityInvalidValue("decision_flee_probability", name, "10");
|
||||||
|
eInfo.decisionFlee = 10;
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logEntityMissingRequiredValue("decision_flee_probability", name, "10");
|
||||||
|
eInfo.decisionFlee = 10;
|
||||||
}
|
}
|
||||||
} catch (ClassCastException e) {
|
|
||||||
logEntityInvalidValue("decision_flee_probability", name, "10");
|
|
||||||
eInfo.decisionFlee = 10;
|
|
||||||
} catch (NullPointerException e) {
|
|
||||||
logEntityMissingRequiredValue("decision_flee_probability", name, "10");
|
|
||||||
eInfo.decisionFlee = 10;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(eInfo.classType != null) {
|
if(eInfo.classType != null) {
|
||||||
entityInfoMap.put(eInfo.classType.getName(), eInfo);
|
entityInfoMap.put(eInfo.classType.getName(), eInfo);
|
||||||
} else if(!eInfo.customName.isEmpty()) {
|
} else if(!eInfo.customName.isEmpty()) {
|
||||||
customEntityInfoMap.put(eInfo.customName, eInfo);
|
customEntityInfoMap.put(eInfo.customName, eInfo);
|
||||||
|
} else if (!eInfo.playerName.isEmpty()) {
|
||||||
|
customPlayerInfoMap.put(eInfo.playerName, eInfo);
|
||||||
} else {
|
} else {
|
||||||
logger.error("Cannot add entity to internal config, no \"name\" or \"custom_name\"");
|
logger.error("Cannot add entity to internal config, no \"name\" or \"custom_name\" or \"player_name\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -795,6 +833,8 @@ public class Config
|
||||||
newConf.set("defense_damage_probability", eInfo.defenseDamageProbability);
|
newConf.set("defense_damage_probability", eInfo.defenseDamageProbability);
|
||||||
newConf.set("evasion", eInfo.evasion);
|
newConf.set("evasion", eInfo.evasion);
|
||||||
newConf.set("speed", eInfo.speed);
|
newConf.set("speed", eInfo.speed);
|
||||||
|
newConf.set("haste_speed", eInfo.hasteSpeed);
|
||||||
|
newConf.set("slow_speed", eInfo.slowSpeed);
|
||||||
newConf.set("ignore_battle", eInfo.ignoreBattle);
|
newConf.set("ignore_battle", eInfo.ignoreBattle);
|
||||||
newConf.set("category", eInfo.category);
|
newConf.set("category", eInfo.category);
|
||||||
newConf.set("decision_attack_probability", eInfo.decisionAttack);
|
newConf.set("decision_attack_probability", eInfo.decisionAttack);
|
||||||
|
@ -824,9 +864,11 @@ public class Config
|
||||||
|
|
||||||
boolean saved = false;
|
boolean saved = false;
|
||||||
try {
|
try {
|
||||||
if (eInfo.classType != null || !eInfo.customName.isEmpty()) {
|
if (eInfo.classType != null || !eInfo.customName.isEmpty() || !eInfo.playerName.isEmpty()) {
|
||||||
for (com.electronwill.nightconfig.core.Config entity : entities) {
|
for (com.electronwill.nightconfig.core.Config entity : entities) {
|
||||||
String entityName = entity.get("name");
|
String entityName = entity.get("name");
|
||||||
|
String customName = entity.get("custom_name");
|
||||||
|
String playerName = entity.get("player_name");
|
||||||
if ((eInfo.classType != null && entityName != null && entityName.equals(eInfo.classType.getName()))) {
|
if ((eInfo.classType != null && entityName != null && entityName.equals(eInfo.classType.getName()))) {
|
||||||
entity.set("attack_power", eInfo.attackPower);
|
entity.set("attack_power", eInfo.attackPower);
|
||||||
entity.set("attack_probability", eInfo.attackProbability);
|
entity.set("attack_probability", eInfo.attackProbability);
|
||||||
|
@ -837,6 +879,8 @@ public class Config
|
||||||
entity.set("defense_damage_probability", eInfo.defenseDamageProbability);
|
entity.set("defense_damage_probability", eInfo.defenseDamageProbability);
|
||||||
entity.set("evasion", eInfo.evasion);
|
entity.set("evasion", eInfo.evasion);
|
||||||
entity.set("speed", eInfo.speed);
|
entity.set("speed", eInfo.speed);
|
||||||
|
entity.set("haste_speed", eInfo.hasteSpeed);
|
||||||
|
entity.set("slow_speed", eInfo.slowSpeed);
|
||||||
entity.set("ignore_battle", eInfo.ignoreBattle);
|
entity.set("ignore_battle", eInfo.ignoreBattle);
|
||||||
entity.set("category", eInfo.category);
|
entity.set("category", eInfo.category);
|
||||||
entity.set("decision_attack_probability", eInfo.decisionAttack);
|
entity.set("decision_attack_probability", eInfo.decisionAttack);
|
||||||
|
@ -844,26 +888,35 @@ public class Config
|
||||||
entity.set("decision_flee_probability", eInfo.decisionFlee);
|
entity.set("decision_flee_probability", eInfo.decisionFlee);
|
||||||
saved = true;
|
saved = true;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else if (!eInfo.customName.isEmpty() && customName != null && customName.equals(eInfo.customName)) {
|
||||||
String customName = entity.get("custom_name");
|
entity.set("attack_power", eInfo.attackPower);
|
||||||
if(!eInfo.customName.isEmpty() && customName != null && customName.equals(eInfo.customName)) {
|
entity.set("attack_probability", eInfo.attackProbability);
|
||||||
entity.set("attack_power", eInfo.attackPower);
|
entity.set("attack_variance", eInfo.attackVariance);
|
||||||
entity.set("attack_probability", eInfo.attackProbability);
|
entity.set("attack_effect", eInfo.attackEffect.toString());
|
||||||
entity.set("attack_variance", eInfo.attackVariance);
|
entity.set("attack_effect_probability", eInfo.attackEffectProbability);
|
||||||
entity.set("attack_effect", eInfo.attackEffect.toString());
|
entity.set("defense_damage", eInfo.defenseDamage);
|
||||||
entity.set("attack_effect_probability", eInfo.attackEffectProbability);
|
entity.set("defense_damage_probability", eInfo.defenseDamageProbability);
|
||||||
entity.set("defense_damage", eInfo.defenseDamage);
|
entity.set("evasion", eInfo.evasion);
|
||||||
entity.set("defense_damage_probability", eInfo.defenseDamageProbability);
|
entity.set("speed", eInfo.speed);
|
||||||
entity.set("evasion", eInfo.evasion);
|
entity.set("haste_speed", eInfo.hasteSpeed);
|
||||||
entity.set("speed", eInfo.speed);
|
entity.set("slow_speed", eInfo.slowSpeed);
|
||||||
entity.set("ignore_battle", eInfo.ignoreBattle);
|
entity.set("ignore_battle", eInfo.ignoreBattle);
|
||||||
entity.set("category", eInfo.category);
|
entity.set("category", eInfo.category);
|
||||||
entity.set("decision_attack_probability", eInfo.decisionAttack);
|
entity.set("decision_attack_probability", eInfo.decisionAttack);
|
||||||
entity.set("decision_defend_probability", eInfo.decisionDefend);
|
entity.set("decision_defend_probability", eInfo.decisionDefend);
|
||||||
entity.set("decision_flee_probability", eInfo.decisionFlee);
|
entity.set("decision_flee_probability", eInfo.decisionFlee);
|
||||||
saved = true;
|
saved = true;
|
||||||
break;
|
break;
|
||||||
}
|
} else if (!eInfo.playerName.isEmpty() && playerName != null && playerName.equals(eInfo.playerName)) {
|
||||||
|
entity.set("attack_probability", eInfo.attackProbability);
|
||||||
|
entity.set("attack_effect", eInfo.attackEffect.toString());
|
||||||
|
entity.set("attack_effect_probability", eInfo.attackEffectProbability);
|
||||||
|
entity.set("evasion", eInfo.evasion);
|
||||||
|
entity.set("speed", eInfo.speed);
|
||||||
|
entity.set("haste_speed", eInfo.hasteSpeed);
|
||||||
|
entity.set("slow_speed", eInfo.slowSpeed);
|
||||||
|
saved = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!saved) {
|
if(!saved) {
|
||||||
|
@ -872,25 +925,38 @@ public class Config
|
||||||
newEntry.set("name", eInfo.classType.getName());
|
newEntry.set("name", eInfo.classType.getName());
|
||||||
} else if(!eInfo.customName.isEmpty()) {
|
} else if(!eInfo.customName.isEmpty()) {
|
||||||
newEntry.set("custom_name", eInfo.customName);
|
newEntry.set("custom_name", eInfo.customName);
|
||||||
|
} else if (!eInfo.playerName.isEmpty()) {
|
||||||
|
newEntry.set("player_name", eInfo.playerName);
|
||||||
} else {
|
} else {
|
||||||
logger.error("Failed to save new entity entry into config, no name or custom_name");
|
logger.error("Failed to save new entity entry into config, no name or custom_name");
|
||||||
conf.close();
|
conf.close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
newEntry.set("attack_power", eInfo.attackPower);
|
|
||||||
|
if (eInfo.playerName.isEmpty()) {
|
||||||
|
newEntry.set("attack_power", eInfo.attackPower);
|
||||||
|
}
|
||||||
newEntry.set("attack_probability", eInfo.attackProbability);
|
newEntry.set("attack_probability", eInfo.attackProbability);
|
||||||
newEntry.set("attack_variance", eInfo.attackVariance);
|
if (eInfo.playerName.isEmpty()) {
|
||||||
|
newEntry.set("attack_variance", eInfo.attackVariance);
|
||||||
|
}
|
||||||
newEntry.set("attack_effect", eInfo.attackEffect.toString());
|
newEntry.set("attack_effect", eInfo.attackEffect.toString());
|
||||||
newEntry.set("attack_effect_probability", eInfo.attackEffectProbability);
|
newEntry.set("attack_effect_probability", eInfo.attackEffectProbability);
|
||||||
newEntry.set("defense_damage", eInfo.defenseDamage);
|
if (eInfo.playerName.isEmpty()) {
|
||||||
newEntry.set("defense_damage_probability", eInfo.defenseDamageProbability);
|
newEntry.set("defense_damage", eInfo.defenseDamage);
|
||||||
|
newEntry.set("defense_damage_probability", eInfo.defenseDamageProbability);
|
||||||
|
}
|
||||||
newEntry.set("evasion", eInfo.evasion);
|
newEntry.set("evasion", eInfo.evasion);
|
||||||
newEntry.set("speed", eInfo.speed);
|
newEntry.set("speed", eInfo.speed);
|
||||||
newEntry.set("ignore_battle", eInfo.ignoreBattle);
|
newEntry.set("haste_speed", eInfo.hasteSpeed);
|
||||||
newEntry.set("category", eInfo.category);
|
newEntry.set("slow_speed", eInfo.slowSpeed);
|
||||||
newEntry.set("decision_attack_probability", eInfo.decisionAttack);
|
if (eInfo.playerName.isEmpty()) {
|
||||||
newEntry.set("decision_defend_probability", eInfo.decisionDefend);
|
newEntry.set("ignore_battle", eInfo.ignoreBattle);
|
||||||
newEntry.set("decision_flee_probability", eInfo.decisionFlee);
|
newEntry.set("category", eInfo.category);
|
||||||
|
newEntry.set("decision_attack_probability", eInfo.decisionAttack);
|
||||||
|
newEntry.set("decision_defend_probability", eInfo.decisionDefend);
|
||||||
|
newEntry.set("decision_flee_probability", eInfo.decisionFlee);
|
||||||
|
}
|
||||||
entities.add(newEntry);
|
entities.add(newEntry);
|
||||||
saved = true;
|
saved = true;
|
||||||
}
|
}
|
||||||
|
@ -915,8 +981,10 @@ public class Config
|
||||||
|
|
||||||
if(eInfo.classType != null) {
|
if(eInfo.classType != null) {
|
||||||
entityInfoMap.put(eInfo.classType.getName(), eInfo);
|
entityInfoMap.put(eInfo.classType.getName(), eInfo);
|
||||||
} else if(!eInfo.customName.isEmpty()){
|
} else if(!eInfo.customName.isEmpty()) {
|
||||||
customEntityInfoMap.put(eInfo.customName, eInfo);
|
customEntityInfoMap.put(eInfo.customName, eInfo);
|
||||||
|
} else if (!eInfo.playerName.isEmpty()) {
|
||||||
|
customPlayerInfoMap.put(eInfo.playerName, eInfo);
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Failed to update entity info in memory");
|
logger.warn("Failed to update entity info in memory");
|
||||||
}
|
}
|
||||||
|
@ -1096,6 +1164,22 @@ public class Config
|
||||||
return eInfo;
|
return eInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a clone of an EntityInfo (to prevent editing it).
|
||||||
|
* @param playerName
|
||||||
|
* @return a clone of the stored custom EntityInfo or null if invalid String
|
||||||
|
*/
|
||||||
|
public EntityInfo getPlayerInfo(String playerName) {
|
||||||
|
if (playerName == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
EntityInfo eInfo = customPlayerInfoMap.get(playerName);
|
||||||
|
if (eInfo != null) {
|
||||||
|
eInfo = eInfo.clone();
|
||||||
|
}
|
||||||
|
return eInfo;
|
||||||
|
}
|
||||||
|
|
||||||
protected EntityInfo getCustomEntityInfoReference(String customName)
|
protected EntityInfo getCustomEntityInfoReference(String customName)
|
||||||
{
|
{
|
||||||
if(customName == null) {
|
if(customName == null) {
|
||||||
|
@ -1104,6 +1188,13 @@ public class Config
|
||||||
return customEntityInfoMap.get(customName);
|
return customEntityInfoMap.get(customName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected EntityInfo getPlayerInfoReference(String playerName) {
|
||||||
|
if (playerName == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return customPlayerInfoMap.get(playerName);
|
||||||
|
}
|
||||||
|
|
||||||
private int getConfigFileVersion(File configFile)
|
private int getConfigFileVersion(File configFile)
|
||||||
{
|
{
|
||||||
int version = 0;
|
int version = 0;
|
||||||
|
|
|
@ -8,6 +8,7 @@ public class EditingInfo
|
||||||
public EntityInfo entityInfo;
|
public EntityInfo entityInfo;
|
||||||
public boolean isPendingEntitySelection;
|
public boolean isPendingEntitySelection;
|
||||||
public boolean isEditingCustomName;
|
public boolean isEditingCustomName;
|
||||||
|
public boolean isEditingPlayer;
|
||||||
|
|
||||||
public EditingInfo()
|
public EditingInfo()
|
||||||
{
|
{
|
||||||
|
@ -15,6 +16,7 @@ public class EditingInfo
|
||||||
entityInfo = null;
|
entityInfo = null;
|
||||||
isPendingEntitySelection = true;
|
isPendingEntitySelection = true;
|
||||||
isEditingCustomName = false;
|
isEditingCustomName = false;
|
||||||
|
isEditingPlayer = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EditingInfo(Player player)
|
public EditingInfo(Player player)
|
||||||
|
@ -23,5 +25,6 @@ public class EditingInfo
|
||||||
entityInfo = null;
|
entityInfo = null;
|
||||||
isPendingEntitySelection = true;
|
isPendingEntitySelection = true;
|
||||||
isEditingCustomName = false;
|
isEditingCustomName = false;
|
||||||
|
isEditingPlayer = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,15 @@ public class EntityInfo
|
||||||
public int defenseDamageProbability;
|
public int defenseDamageProbability;
|
||||||
public int evasion;
|
public int evasion;
|
||||||
public int speed;
|
public int speed;
|
||||||
|
public int hasteSpeed;
|
||||||
|
public int slowSpeed;
|
||||||
public String category;
|
public String category;
|
||||||
public int decisionAttack;
|
public int decisionAttack;
|
||||||
public int decisionDefend;
|
public int decisionDefend;
|
||||||
public int decisionFlee;
|
public int decisionFlee;
|
||||||
public String customName;
|
public String customName;
|
||||||
|
public String playerName;
|
||||||
|
|
||||||
public enum Effect
|
public enum Effect
|
||||||
{
|
{
|
||||||
SPEED,
|
SPEED,
|
||||||
|
@ -369,17 +372,20 @@ public class EntityInfo
|
||||||
defenseDamageProbability = 0;
|
defenseDamageProbability = 0;
|
||||||
evasion = 15;
|
evasion = 15;
|
||||||
speed = 50;
|
speed = 50;
|
||||||
|
hasteSpeed = 80;
|
||||||
|
slowSpeed = 20;
|
||||||
category = "unknown";
|
category = "unknown";
|
||||||
decisionAttack = 70;
|
decisionAttack = 70;
|
||||||
decisionDefend = 20;
|
decisionDefend = 20;
|
||||||
decisionFlee = 10;
|
decisionFlee = 10;
|
||||||
customName = new String();
|
customName = new String();
|
||||||
|
playerName = new String();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityInfo(Class classType, boolean ignoreBattle, int attackPower, int attackProbability, int attackVariance,
|
public EntityInfo(Class classType, boolean ignoreBattle, int attackPower, int attackProbability, int attackVariance,
|
||||||
Effect attackEffect, int attackEffectProbability, int defenseDamage, int defenseDamageProbability,
|
Effect attackEffect, int attackEffectProbability, int defenseDamage, int defenseDamageProbability,
|
||||||
int evasion, int speed, String category, int decisionAttack, int decisionDefend, int decisionFlee,
|
int evasion, int speed, int hasteSpeed, int slowSpeed, String category, int decisionAttack, int decisionDefend, int decisionFlee,
|
||||||
String customName) {
|
String customName, String playerName) {
|
||||||
this.classType = classType;
|
this.classType = classType;
|
||||||
this.ignoreBattle = ignoreBattle;
|
this.ignoreBattle = ignoreBattle;
|
||||||
this.attackPower = attackPower;
|
this.attackPower = attackPower;
|
||||||
|
@ -391,11 +397,14 @@ public class EntityInfo
|
||||||
this.defenseDamageProbability = defenseDamageProbability;
|
this.defenseDamageProbability = defenseDamageProbability;
|
||||||
this.evasion = evasion;
|
this.evasion = evasion;
|
||||||
this.speed = speed;
|
this.speed = speed;
|
||||||
|
this.hasteSpeed = hasteSpeed;
|
||||||
|
this.slowSpeed = slowSpeed;
|
||||||
this.category = category;
|
this.category = category;
|
||||||
this.decisionAttack = decisionAttack;
|
this.decisionAttack = decisionAttack;
|
||||||
this.decisionDefend = decisionDefend;
|
this.decisionDefend = decisionDefend;
|
||||||
this.decisionFlee = decisionFlee;
|
this.decisionFlee = decisionFlee;
|
||||||
this.customName = customName;
|
this.customName = customName;
|
||||||
|
this.playerName = playerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityInfo clone()
|
public EntityInfo clone()
|
||||||
|
@ -412,11 +421,14 @@ public class EntityInfo
|
||||||
newEntityInfo.defenseDamageProbability = defenseDamageProbability;
|
newEntityInfo.defenseDamageProbability = defenseDamageProbability;
|
||||||
newEntityInfo.evasion = evasion;
|
newEntityInfo.evasion = evasion;
|
||||||
newEntityInfo.speed = speed;
|
newEntityInfo.speed = speed;
|
||||||
|
newEntityInfo.hasteSpeed = hasteSpeed;
|
||||||
|
newEntityInfo.slowSpeed = slowSpeed;
|
||||||
newEntityInfo.category = category;
|
newEntityInfo.category = category;
|
||||||
newEntityInfo.decisionAttack = decisionAttack;
|
newEntityInfo.decisionAttack = decisionAttack;
|
||||||
newEntityInfo.decisionDefend = decisionDefend;
|
newEntityInfo.decisionDefend = decisionDefend;
|
||||||
newEntityInfo.decisionFlee = decisionFlee;
|
newEntityInfo.decisionFlee = decisionFlee;
|
||||||
newEntityInfo.customName = new String(customName);
|
newEntityInfo.customName = customName;
|
||||||
|
newEntityInfo.playerName = playerName;
|
||||||
return newEntityInfo;
|
return newEntityInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,6 +460,8 @@ public class EntityInfo
|
||||||
defenseDamageProbability = buffer.readInt();
|
defenseDamageProbability = buffer.readInt();
|
||||||
evasion = buffer.readInt();
|
evasion = buffer.readInt();
|
||||||
speed = buffer.readInt();
|
speed = buffer.readInt();
|
||||||
|
hasteSpeed = buffer.readInt();
|
||||||
|
slowSpeed = buffer.readInt();
|
||||||
|
|
||||||
int category_len = buffer.readInt();
|
int category_len = buffer.readInt();
|
||||||
ByteBuf category_bytes = buffer.readBytes(category_len);
|
ByteBuf category_bytes = buffer.readBytes(category_len);
|
||||||
|
@ -464,6 +478,14 @@ public class EntityInfo
|
||||||
} else {
|
} else {
|
||||||
customName = "";
|
customName = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int player_len = buffer.readInt();
|
||||||
|
if (player_len > 0) {
|
||||||
|
ByteBuf player_bytes = buffer.readBytes(player_len);
|
||||||
|
playerName = player_bytes.toString(StandardCharsets.UTF_8);
|
||||||
|
} else {
|
||||||
|
playerName = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void encode(ByteBuf buffer) {
|
public void encode(ByteBuf buffer) {
|
||||||
|
@ -491,6 +513,8 @@ public class EntityInfo
|
||||||
buffer.writeInt(defenseDamageProbability);
|
buffer.writeInt(defenseDamageProbability);
|
||||||
buffer.writeInt(evasion);
|
buffer.writeInt(evasion);
|
||||||
buffer.writeInt(speed);
|
buffer.writeInt(speed);
|
||||||
|
buffer.writeInt(hasteSpeed);
|
||||||
|
buffer.writeInt(slowSpeed);
|
||||||
|
|
||||||
byte[] category_bytes = category.getBytes(StandardCharsets.UTF_8);
|
byte[] category_bytes = category.getBytes(StandardCharsets.UTF_8);
|
||||||
buffer.writeInt(category_bytes.length);
|
buffer.writeInt(category_bytes.length);
|
||||||
|
@ -507,5 +531,13 @@ public class EntityInfo
|
||||||
buffer.writeInt(custom_bytes.length);
|
buffer.writeInt(custom_bytes.length);
|
||||||
buffer.writeBytes(custom_bytes);
|
buffer.writeBytes(custom_bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (playerName.isEmpty()) {
|
||||||
|
buffer.writeInt(0);
|
||||||
|
} else {
|
||||||
|
byte[] player_bytes = playerName.getBytes(StandardCharsets.UTF_8);
|
||||||
|
buffer.writeInt(player_bytes.length);
|
||||||
|
buffer.writeBytes(player_bytes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ import org.apache.logging.log4j.Logger;
|
||||||
public class TurnBasedMinecraftMod {
|
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.26.2";
|
public static final String VERSION = "1.26.4-MC-1.21.1";
|
||||||
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/";
|
||||||
|
@ -153,7 +153,6 @@ public class TurnBasedMinecraftMod {
|
||||||
for (ServerPlayer player : c.getSource().getServer().getPlayerList().getPlayers()) {
|
for (ServerPlayer player : c.getSource().getServer().getPlayerList().getPlayers()) {
|
||||||
proxy.getConfig().addBattleIgnoringPlayer(player.getId());
|
proxy.getConfig().addBattleIgnoringPlayer(player.getId());
|
||||||
PacketDistributor.sendToPlayer(player, new PacketGeneralMessage("OP disabled turn-based-combat for everyone"));
|
PacketDistributor.sendToPlayer(player, new PacketGeneralMessage("OP disabled turn-based-combat for everyone"));
|
||||||
PacketDistributor.sendToPlayer(player, new PacketGeneralMessage("OP disabled turn-based-combat for everyone"));
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}));
|
}));
|
||||||
|
@ -267,6 +266,30 @@ public class TurnBasedMinecraftMod {
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}))
|
}))
|
||||||
|
.then(Commands.literal("player")
|
||||||
|
.executes(c -> {
|
||||||
|
ServerPlayer player = c.getSource().getPlayerOrException();
|
||||||
|
PacketDistributor.sendToPlayer(player, new PacketEditingMessage(PacketEditingMessage.Type.PICK_PLAYER));
|
||||||
|
return 1;
|
||||||
|
})
|
||||||
|
.then(Commands.argument("playerName", StringArgumentType.greedyString()).executes(c -> {
|
||||||
|
String name = StringArgumentType.getString(c, "playerName");
|
||||||
|
ServerPlayer player = c.getSource().getPlayerOrException();
|
||||||
|
PacketDistributor.sendToPlayer(player, new PacketGeneralMessage("Editing player \"" + name + "\""));
|
||||||
|
TurnBasedMinecraftMod.logger.info("Begin editing player \"" + name + "\"");
|
||||||
|
proxy.setEditingPlayer(player);
|
||||||
|
EditingInfo editInfo = proxy.getEditingInfo(player.getId());
|
||||||
|
editInfo.isEditingPlayer = true;
|
||||||
|
editInfo.entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getPlayerInfo(name);
|
||||||
|
if (editInfo.entityInfo == null) {
|
||||||
|
editInfo.entityInfo = new EntityInfo();
|
||||||
|
}
|
||||||
|
editInfo.entityInfo.playerName = name;
|
||||||
|
editInfo.isPendingEntitySelection = false;
|
||||||
|
PacketDistributor.sendToPlayer(player, new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editInfo.entityInfo));
|
||||||
|
return 1;
|
||||||
|
}))
|
||||||
|
)
|
||||||
.then(Commands.literal("edit")
|
.then(Commands.literal("edit")
|
||||||
.executes(c -> {
|
.executes(c -> {
|
||||||
ServerPlayer player = c.getSource().getPlayerOrException();
|
ServerPlayer player = c.getSource().getPlayerOrException();
|
||||||
|
@ -590,11 +613,45 @@ public class TurnBasedMinecraftMod {
|
||||||
}))
|
}))
|
||||||
)
|
)
|
||||||
.then(Commands.literal("speed")
|
.then(Commands.literal("speed")
|
||||||
|
.executes(c -> {
|
||||||
|
ServerPlayer player = c.getSource().getPlayerOrException();
|
||||||
|
EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
|
||||||
|
if (editingInfo != null && !editingInfo.isPendingEntitySelection) {
|
||||||
|
PacketDistributor.sendToPlayer(player, new PacketEditingMessage(PacketEditingMessage.Type.EDIT_SPEED));
|
||||||
|
} else if (editingInfo != null) {
|
||||||
|
PacketDistributor.sendToPlayer(player, new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY));
|
||||||
|
} else {
|
||||||
|
Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\").");
|
||||||
|
throw new CommandSyntaxException(new SimpleCommandExceptionType(exceptionMessage), exceptionMessage);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
})
|
||||||
|
.then(Commands.argument("speed", IntegerArgumentType.integer())
|
||||||
|
.executes(c -> {
|
||||||
|
ServerPlayer player = c.getSource().getPlayerOrException();
|
||||||
|
EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
|
||||||
|
int speed = IntegerArgumentType.getInteger(c, "speed");
|
||||||
|
if (speed < 0) {
|
||||||
|
speed = 0;
|
||||||
|
}
|
||||||
|
if (editingInfo != null && !editingInfo.isPendingEntitySelection) {
|
||||||
|
editingInfo.entityInfo.speed = speed;
|
||||||
|
PacketDistributor.sendToPlayer(player, new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo));
|
||||||
|
} else if (editingInfo != null) {
|
||||||
|
PacketDistributor.sendToPlayer(player, new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY));
|
||||||
|
} else {
|
||||||
|
Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\").");
|
||||||
|
throw new CommandSyntaxException(new SimpleCommandExceptionType(exceptionMessage), exceptionMessage);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
.then(Commands.literal("hasteSpeed")
|
||||||
.executes(c -> {
|
.executes(c -> {
|
||||||
ServerPlayer player = c.getSource().getPlayerOrException();
|
ServerPlayer player = c.getSource().getPlayerOrException();
|
||||||
EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
|
EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
|
||||||
if (editingInfo != null && !editingInfo.isPendingEntitySelection) {
|
if (editingInfo != null && !editingInfo.isPendingEntitySelection) {
|
||||||
PacketDistributor.sendToPlayer(player, new PacketEditingMessage(PacketEditingMessage.Type.EDIT_SPEED));
|
PacketDistributor.sendToPlayer(player, new PacketEditingMessage(PacketEditingMessage.Type.EDIT_HASTE_SPEED));
|
||||||
} else if (editingInfo != null) {
|
} else if (editingInfo != null) {
|
||||||
PacketDistributor.sendToPlayer(player, new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY));
|
PacketDistributor.sendToPlayer(player, new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY));
|
||||||
} else {
|
} else {
|
||||||
|
@ -603,16 +660,16 @@ public class TurnBasedMinecraftMod {
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
})
|
})
|
||||||
.then(Commands.argument("speed", IntegerArgumentType.integer())
|
.then(Commands.argument("hasteSpeed", IntegerArgumentType.integer())
|
||||||
.executes(c -> {
|
.executes(c -> {
|
||||||
ServerPlayer player = c.getSource().getPlayerOrException();
|
ServerPlayer player = c.getSource().getPlayerOrException();
|
||||||
EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
|
EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
|
||||||
int speed = IntegerArgumentType.getInteger(c, "speed");
|
int hasteSpeed = IntegerArgumentType.getInteger(c, "hasteSpeed");
|
||||||
if (speed < 0) {
|
if (hasteSpeed < 0) {
|
||||||
speed = 0;
|
hasteSpeed = 0;
|
||||||
}
|
}
|
||||||
if (editingInfo != null && !editingInfo.isPendingEntitySelection) {
|
if (editingInfo != null && !editingInfo.isPendingEntitySelection) {
|
||||||
editingInfo.entityInfo.speed = speed;
|
editingInfo.entityInfo.hasteSpeed = hasteSpeed;
|
||||||
PacketDistributor.sendToPlayer(player, new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo));
|
PacketDistributor.sendToPlayer(player, new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo));
|
||||||
} else if (editingInfo != null) {
|
} else if (editingInfo != null) {
|
||||||
PacketDistributor.sendToPlayer(player, new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY));
|
PacketDistributor.sendToPlayer(player, new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY));
|
||||||
|
@ -623,6 +680,40 @@ public class TurnBasedMinecraftMod {
|
||||||
return 1;
|
return 1;
|
||||||
}))
|
}))
|
||||||
)
|
)
|
||||||
|
.then(Commands.literal("slowSpeed")
|
||||||
|
.executes(c -> {
|
||||||
|
ServerPlayer player = c.getSource().getPlayerOrException();
|
||||||
|
EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
|
||||||
|
if (editingInfo != null && !editingInfo.isPendingEntitySelection) {
|
||||||
|
PacketDistributor.sendToPlayer(player, new PacketEditingMessage(PacketEditingMessage.Type.EDIT_SLOW_SPEED));
|
||||||
|
} else if (editingInfo != null) {
|
||||||
|
PacketDistributor.sendToPlayer(player, new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY));
|
||||||
|
} else {
|
||||||
|
Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\").");
|
||||||
|
throw new CommandSyntaxException(new SimpleCommandExceptionType(exceptionMessage), exceptionMessage);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
})
|
||||||
|
.then(Commands.argument("slowSpeed", IntegerArgumentType.integer())
|
||||||
|
.executes(c -> {
|
||||||
|
ServerPlayer player = c.getSource().getPlayerOrException();
|
||||||
|
EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
|
||||||
|
int slowSpeed = IntegerArgumentType.getInteger(c, "slowSpeed");
|
||||||
|
if (slowSpeed < 0) {
|
||||||
|
slowSpeed = 0;
|
||||||
|
}
|
||||||
|
if (editingInfo != null && !editingInfo.isPendingEntitySelection) {
|
||||||
|
editingInfo.entityInfo.slowSpeed = slowSpeed;
|
||||||
|
PacketDistributor.sendToPlayer(player, new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo));
|
||||||
|
} else if (editingInfo != null) {
|
||||||
|
PacketDistributor.sendToPlayer(player, new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY));
|
||||||
|
} else {
|
||||||
|
Message exceptionMessage = new LiteralMessage("Cannot edit entity without starting editing (use \"/tbm-edit\").");
|
||||||
|
throw new CommandSyntaxException(new SimpleCommandExceptionType(exceptionMessage), exceptionMessage);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}))
|
||||||
|
)
|
||||||
.then(Commands.literal("category")
|
.then(Commands.literal("category")
|
||||||
.executes(c -> {
|
.executes(c -> {
|
||||||
ServerPlayer player = c.getSource().getPlayerOrException();
|
ServerPlayer player = c.getSource().getPlayerOrException();
|
||||||
|
|
|
@ -31,13 +31,12 @@ public record PacketBattlePing(int battleID, int remainingSeconds) implements Cu
|
||||||
@Override
|
@Override
|
||||||
public void handle(final @NotNull PacketBattlePing pkt, IPayloadContext ctx) {
|
public void handle(final @NotNull PacketBattlePing pkt, IPayloadContext ctx) {
|
||||||
ctx.enqueueWork(() -> {
|
ctx.enqueueWork(() -> {
|
||||||
if (TurnBasedMinecraftMod.proxy.getLocalBattle() == null) {
|
if (TurnBasedMinecraftMod.proxy.getLocalBattle() != null) {
|
||||||
TurnBasedMinecraftMod.proxy.createLocalBattle(pkt.battleID);
|
TurnBasedMinecraftMod.proxy.setBattleGuiAsGui();
|
||||||
|
TurnBasedMinecraftMod.proxy.setBattleGuiBattleChanged();
|
||||||
|
TurnBasedMinecraftMod.proxy.setBattleGuiTime(pkt.remainingSeconds);
|
||||||
|
TurnBasedMinecraftMod.proxy.pauseMCMusic();
|
||||||
}
|
}
|
||||||
TurnBasedMinecraftMod.proxy.setBattleGuiAsGui();
|
|
||||||
TurnBasedMinecraftMod.proxy.setBattleGuiBattleChanged();
|
|
||||||
TurnBasedMinecraftMod.proxy.setBattleGuiTime(pkt.remainingSeconds);
|
|
||||||
TurnBasedMinecraftMod.proxy.pauseMCMusic();
|
|
||||||
}).exceptionally(e -> {
|
}).exceptionally(e -> {
|
||||||
ctx.disconnect(Component.literal("Exception handling PacketBattlePing! " + e.getMessage()));
|
ctx.disconnect(Component.literal("Exception handling PacketBattlePing! " + e.getMessage()));
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -48,11 +48,14 @@ public class PacketEditingMessage implements CustomPacketPayload
|
||||||
EDIT_DEFENSE_DAMAGE_PROBABILITY(9),
|
EDIT_DEFENSE_DAMAGE_PROBABILITY(9),
|
||||||
EDIT_EVASION(10),
|
EDIT_EVASION(10),
|
||||||
EDIT_SPEED(11),
|
EDIT_SPEED(11),
|
||||||
|
EDIT_HASTE_SPEED(18),
|
||||||
|
EDIT_SLOW_SPEED(19),
|
||||||
EDIT_CATEGORY(12),
|
EDIT_CATEGORY(12),
|
||||||
EDIT_DECISION_ATTACK(13),
|
EDIT_DECISION_ATTACK(13),
|
||||||
EDIT_DECISION_DEFEND(14),
|
EDIT_DECISION_DEFEND(14),
|
||||||
EDIT_DECISION_FLEE(15),
|
EDIT_DECISION_FLEE(15),
|
||||||
SERVER_EDIT(16);
|
SERVER_EDIT(16),
|
||||||
|
PICK_PLAYER(17);
|
||||||
|
|
||||||
Type(int value)
|
Type(int value)
|
||||||
{
|
{
|
||||||
|
|
10
update.json
10
update.json
|
@ -1,12 +1,18 @@
|
||||||
{
|
{
|
||||||
"homepage": "https://github.com/Stephen-Seo/TurnBasedMinecraftMod",
|
"homepage": "https://github.com/Stephen-Seo/TurnBasedMinecraftMod",
|
||||||
|
"1.21.3": {
|
||||||
|
"1.26.3": "Ported to NeoForge 21.3.2-beta (MC 1.21.3), minor tweak to packet.\n https://github.com/Stephen-Seo/TurnBasedMinecraftMod/blob/neoforge/Changelog.md"
|
||||||
|
},
|
||||||
"1.21.1": {
|
"1.21.1": {
|
||||||
|
"1.26.3-MC-1.21.1": "Minor tweak to packet.\n https://github.com/Stephen-Seo/TurnBasedMinecraftMod/blob/neoforge/Changelog.md",
|
||||||
"1.26.2": "Display Entities on attack menu in BattleGUI.\n https://github.com/Stephen-Seo/TurnBasedMinecraftMod/blob/neoforge/Changelog.md",
|
"1.26.2": "Display Entities on attack menu in BattleGUI.\n https://github.com/Stephen-Seo/TurnBasedMinecraftMod/blob/neoforge/Changelog.md",
|
||||||
"1.26.1": "Ported to NeoForge 21.1.72, leave BattleGUI with Escape key, MC music paused in battle properly.\n https://github.com/Stephen-Seo/TurnBasedMinecraftMod/blob/neoforge/Changelog.md",
|
"1.26.1": "Ported to NeoForge 21.1.72, leave BattleGUI with Escape key, MC music paused in battle properly.\n https://github.com/Stephen-Seo/TurnBasedMinecraftMod/blob/neoforge/Changelog.md",
|
||||||
"1.26.0": "Ported to NeoForge 21.1.69, client config.\n https://github.com/Stephen-Seo/TurnBasedMinecraftMod/blob/neoforge/Changelog.md"
|
"1.26.0": "Ported to NeoForge 21.1.69, client config.\n https://github.com/Stephen-Seo/TurnBasedMinecraftMod/blob/neoforge/Changelog.md"
|
||||||
},
|
},
|
||||||
"promos": {
|
"promos": {
|
||||||
"1.21.1-latest": "1.26.2",
|
"1.21.3-latest": "1.26.3",
|
||||||
"1.21.1-recommended": "1.26.2"
|
"1.21.3-recommended": "1.26.3",
|
||||||
|
"1.21.1-latest": "1.26.3-MC-1.21.1",
|
||||||
|
"1.21.1-recommended": "1.26.3-MC-1.21.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue