Compare commits
No commits in common. "a9df1e3c4d4a74a5b3684410739a39597e06098a" and "95333b799a4d3e0127254a2db62503a4cedf4a7b" have entirely different histories.
a9df1e3c4d
...
95333b799a
10 changed files with 234 additions and 641 deletions
18
Changelog.md
18
Changelog.md
|
@ -1,23 +1,5 @@
|
|||
# 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
|
||||
|
|
|
@ -77,7 +77,7 @@ configured for them.)
|
|||
|
||||
Simply invoke `./gradlew build` in the mod directory and after some time the
|
||||
finished jar will be saved at
|
||||
`build/libs/TurnBasedMinecraft-Forge-1.26.4-all.jar`
|
||||
`build/libs/TurnBasedMinecraft-Forge-1.26.3-all.jar`
|
||||
|
||||
# Reproducibility
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ minecraft_version=1.21.1
|
|||
# as they do not follow standard versioning conventions.
|
||||
minecraft_version_range=[1.21.1,1.22)
|
||||
# The Forge version must agree with the Minecraft version to get a valid artifact
|
||||
forge_version=52.0.24
|
||||
forge_version=52.0.22
|
||||
# The Forge version range can use any version of Forge as bounds or match the loader version range
|
||||
forge_version_range=[0,)
|
||||
# The loader version range can only use the major version of Forge/FML as bounds
|
||||
|
@ -48,7 +48,7 @@ mod_name=TurnBasedMinecraftMod
|
|||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=MIT
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=1.26.4
|
||||
mod_version=1.26.3
|
||||
# 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.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
|
|
|
@ -482,27 +482,22 @@ public class ClientProxy extends CommonProxy {
|
|||
MutableComponent text = Component.literal("Edit what value? ");
|
||||
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
||||
|
||||
MutableComponent option;
|
||||
MutableComponent value;
|
||||
MutableComponent option = Component.literal("IgB");
|
||||
// HoverEvent.Action.SHOW_TEXT is probably SHOW_TEXT
|
||||
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);
|
||||
|
||||
if (pkt.getEntityInfo().playerName.isEmpty()) {
|
||||
option = Component.literal("IgB");
|
||||
// HoverEvent.Action.SHOW_TEXT is probably SHOW_TEXT
|
||||
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"))));
|
||||
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");
|
||||
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("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.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackProbability"))
|
||||
|
@ -512,15 +507,13 @@ public class ClientProxy extends CommonProxy {
|
|||
option.getSiblings().add(value);
|
||||
text.getSiblings().add(option);
|
||||
|
||||
if (pkt.getEntityInfo().playerName.isEmpty()) {
|
||||
option = Component.literal("AV");
|
||||
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackVariance"))
|
||||
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("AttackVariance"))));
|
||||
value = Component.literal("(" + pkt.getEntityInfo().attackVariance + ") ");
|
||||
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
||||
option.getSiblings().add(value);
|
||||
text.getSiblings().add(option);
|
||||
}
|
||||
option = Component.literal("AV");
|
||||
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackVariance"))
|
||||
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("AttackVariance"))));
|
||||
value = Component.literal("(" + pkt.getEntityInfo().attackVariance + ") ");
|
||||
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
||||
option.getSiblings().add(value);
|
||||
text.getSiblings().add(option);
|
||||
|
||||
option = Component.literal("AE");
|
||||
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit attackEffect"))
|
||||
|
@ -538,23 +531,21 @@ public class ClientProxy extends CommonProxy {
|
|||
option.getSiblings().add(value);
|
||||
text.getSiblings().add(option);
|
||||
|
||||
if (pkt.getEntityInfo().playerName.isEmpty()) {
|
||||
option = Component.literal("DD");
|
||||
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamage"))
|
||||
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("DefenseDamage"))));
|
||||
value = Component.literal("(" + pkt.getEntityInfo().defenseDamage + ") ");
|
||||
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
||||
option.getSiblings().add(value);
|
||||
text.getSiblings().add(option);
|
||||
option = Component.literal("DD");
|
||||
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit defenseDamage"))
|
||||
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("DefenseDamage"))));
|
||||
value = Component.literal("(" + pkt.getEntityInfo().defenseDamage + ") ");
|
||||
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
||||
option.getSiblings().add(value);
|
||||
text.getSiblings().add(option);
|
||||
|
||||
option = Component.literal("DDPr");
|
||||
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"))));
|
||||
value = Component.literal("(" + pkt.getEntityInfo().defenseDamageProbability + "%) ");
|
||||
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
||||
option.getSiblings().add(value);
|
||||
text.getSiblings().add(option);
|
||||
}
|
||||
option = Component.literal("DDPr");
|
||||
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"))));
|
||||
value = Component.literal("(" + pkt.getEntityInfo().defenseDamageProbability + "%) ");
|
||||
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
||||
option.getSiblings().add(value);
|
||||
text.getSiblings().add(option);
|
||||
|
||||
option = Component.literal("E");
|
||||
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit evasion"))
|
||||
|
@ -572,55 +563,37 @@ public class ClientProxy extends CommonProxy {
|
|||
option.getSiblings().add(value);
|
||||
text.getSiblings().add(option);
|
||||
|
||||
option = Component.literal("HS");
|
||||
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("HasteSpeed"))));
|
||||
value = Component.literal("(" + pkt.getEntityInfo().hasteSpeed + ") ");
|
||||
option = Component.literal("C");
|
||||
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category"))
|
||||
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("Category"))));
|
||||
value = Component.literal("(" + pkt.getEntityInfo().category + ") ");
|
||||
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
||||
option.getSiblings().add(value);
|
||||
text.getSiblings().add(option);
|
||||
|
||||
option = Component.literal("SS");
|
||||
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("SlowSpeed"))));
|
||||
value = Component.literal("(" + pkt.getEntityInfo().slowSpeed + ") ");
|
||||
option = Component.literal("DecA");
|
||||
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("DecisionAttack"))));
|
||||
value = Component.literal("(" + pkt.getEntityInfo().decisionAttack + "%) ");
|
||||
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
||||
option.getSiblings().add(value);
|
||||
text.getSiblings().add(option);
|
||||
|
||||
if (pkt.getEntityInfo().playerName.isEmpty()) {
|
||||
option = Component.literal("C");
|
||||
option.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFFFFFF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit edit category"))
|
||||
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("Category"))));
|
||||
value = Component.literal("(" + pkt.getEntityInfo().category + ") ");
|
||||
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
||||
option.getSiblings().add(value);
|
||||
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("DecA");
|
||||
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("DecisionAttack"))));
|
||||
value = Component.literal("(" + pkt.getEntityInfo().decisionAttack + "%) ");
|
||||
value.setStyle(value.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)));
|
||||
option.getSiblings().add(value);
|
||||
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("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.setStyle(option.getStyle().withColor(TextColor.fromRgb(0xFF00FF00)).withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tbm-edit finish")));
|
||||
|
@ -1330,44 +1303,6 @@ public class ClientProxy extends CommonProxy {
|
|||
TurnBasedMinecraftMod.proxy.displayComponent(parentComponent);
|
||||
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: {
|
||||
MutableComponent text = Component.literal("category: ");
|
||||
text.setStyle(text.getStyle().withColor(TextColor.fromRgb(0xFFFFFFFF)).withBold(false));
|
||||
|
@ -1538,10 +1473,6 @@ public class ClientProxy extends CommonProxy {
|
|||
TurnBasedMinecraftMod.proxy.displayComponent(parentComponent);
|
||||
break;
|
||||
}
|
||||
case PICK_PLAYER: {
|
||||
TurnBasedMinecraftMod.proxy.displayString("Use \"/tbm-edit player <player_name>\"");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -134,9 +134,6 @@ public class Battle {
|
|||
} catch (NullPointerException exception) {
|
||||
entityInfo = null;
|
||||
}
|
||||
if (entityInfo == null) {
|
||||
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getPlayerInfo(e.getName().getString());
|
||||
}
|
||||
if (entityInfo == null) {
|
||||
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getMatchingEntityInfo(e);
|
||||
}
|
||||
|
@ -169,9 +166,6 @@ public class Battle {
|
|||
} catch (NullPointerException exception) {
|
||||
entityInfo = null;
|
||||
}
|
||||
if (entityInfo == null) {
|
||||
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getPlayerInfo(e.getName().getString());
|
||||
}
|
||||
if (entityInfo == null) {
|
||||
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getMatchingEntityInfo(e);
|
||||
}
|
||||
|
@ -274,9 +268,6 @@ public class Battle {
|
|||
} catch (NullPointerException exception) {
|
||||
entityInfo = null;
|
||||
}
|
||||
if (entityInfo == null) {
|
||||
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getPlayerInfo(e.getName().getString());
|
||||
}
|
||||
if (entityInfo == null) {
|
||||
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getMatchingEntityInfo(e);
|
||||
}
|
||||
|
@ -325,9 +316,6 @@ public class Battle {
|
|||
} catch (NullPointerException exception) {
|
||||
entityInfo = null;
|
||||
}
|
||||
if (entityInfo == null) {
|
||||
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getPlayerInfo(e.getName().getString());
|
||||
}
|
||||
if (entityInfo == null) {
|
||||
entityInfo = TurnBasedMinecraftMod.proxy.getConfig().getMatchingEntityInfo(e);
|
||||
}
|
||||
|
@ -793,7 +781,7 @@ public class Battle {
|
|||
case ATTACK:
|
||||
debugLog += " attack";
|
||||
Combatant target = null;
|
||||
if (next.entity instanceof Player player) {
|
||||
if (next.entity instanceof Player) {
|
||||
debugLog += " as player";
|
||||
target = sideA.get(next.targetEntityID);
|
||||
if (target == null) {
|
||||
|
@ -802,10 +790,10 @@ public class Battle {
|
|||
if (target == null || !target.entity.isAlive() || target == next) {
|
||||
continue;
|
||||
}
|
||||
ItemStack heldItemStack = player.getMainHandItem();
|
||||
ItemStack heldItemStack = ((Player) next.entity).getMainHandItem();
|
||||
if (heldItemStack.getItem() instanceof BowItem) {
|
||||
debugLog += " with bow";
|
||||
if (Utility.doesPlayerHaveArrows(player)) {
|
||||
if (Utility.doesPlayerHaveArrows((Player) next.entity)) {
|
||||
final Entity nextEntity = next.entity;
|
||||
final Entity targetEntity = target.entity;
|
||||
final float yawDirection = Utility.yawDirection(next.entity.getX(), next.entity.getZ(), target.entity.getX(), target.entity.getZ());
|
||||
|
@ -827,8 +815,8 @@ public class Battle {
|
|||
continue;
|
||||
} else if (heldItemStack.getItem() instanceof CrossbowItem) {
|
||||
debugLog += " with crossbow";
|
||||
if (Utility.doesPlayerHaveArrows((Player)next.entity)) {
|
||||
// Similar to attack with bow.
|
||||
if (Utility.doesPlayerHaveArrows(player)) {
|
||||
final Entity nextEntity = next.entity;
|
||||
final Entity targetEntity = target.entity;
|
||||
final float yawDirection = Utility.yawDirection(next.entity.getX(), next.entity.getZ(), target.entity.getX(), target.entity.getZ());
|
||||
|
@ -841,7 +829,7 @@ public class Battle {
|
|||
((ServerPlayer) nextEntity).connection.teleport(nextEntity.getX(), nextEntity.getY(), nextEntity.getZ(), yawDirection, pitchDirection);
|
||||
CrossbowItem itemCrossbow = (CrossbowItem) heldItemStack.getItem();
|
||||
TurnBasedMinecraftMod.proxy.getAttackerViaBowSet().add(new AttackerViaBow(nextEntity, getId()));
|
||||
itemCrossbow.releaseUsing(player.getMainHandItem(), nextEntity.level(), (LivingEntity) nextEntity, -100);
|
||||
itemCrossbow.releaseUsing(((Player) nextEntity).getMainHandItem(), nextEntity.level(), (LivingEntity) nextEntity, -100);
|
||||
itemCrossbow.use(nextEntity.level(), (Player)nextEntity, InteractionHand.MAIN_HAND);
|
||||
sendMessageToAllPlayers(PacketBattleMessage.MessageType.FIRED_ARROW, nextEntity.getId(), targetEntity.getId(), 0);
|
||||
} else {
|
||||
|
@ -850,18 +838,9 @@ public class Battle {
|
|||
continue;
|
||||
}
|
||||
debugLog += " without bow";
|
||||
int hitChance;
|
||||
if (next.entityInfo != null && !next.entityInfo.playerName.isEmpty()) {
|
||||
hitChance = next.entityInfo.attackProbability;
|
||||
} else {
|
||||
hitChance = TurnBasedMinecraftMod.proxy.getConfig().getPlayerAttackProbability();
|
||||
}
|
||||
int hitChance = TurnBasedMinecraftMod.proxy.getConfig().getPlayerAttackProbability();
|
||||
if (target.entity instanceof Player) {
|
||||
if (target.entityInfo != null && !target.entityInfo.playerName.isEmpty()) {
|
||||
hitChance = hitChance * (100 - target.entityInfo.evasion) / 100;
|
||||
} else {
|
||||
hitChance = hitChance * (100 - TurnBasedMinecraftMod.proxy.getConfig().getPlayerEvasion()) / 100;
|
||||
}
|
||||
hitChance = hitChance * (100 - TurnBasedMinecraftMod.proxy.getConfig().getPlayerEvasion()) / 100;
|
||||
} else {
|
||||
hitChance = hitChance * (100 - target.entityInfo.evasion) / 100;
|
||||
}
|
||||
|
@ -898,13 +877,6 @@ public class Battle {
|
|||
((Player) nextEntity).attack(targetEntity);
|
||||
TurnBasedMinecraftMod.proxy.setAttackingEntity(null);
|
||||
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) {
|
||||
// defense damage
|
||||
DamageSource defenseDamageSource = targetEntity.damageSources().mobAttack((LivingEntity) targetEntity);
|
||||
|
@ -1049,111 +1021,48 @@ public class Battle {
|
|||
int fastestEnemySpeed = 0;
|
||||
if (next.isSideA) {
|
||||
for (Combatant c : sideB.values()) {
|
||||
if (c.entity instanceof Player player) {
|
||||
int playerSpeed;
|
||||
if (c.entityInfo != null && !c.entityInfo.playerName.isEmpty()) {
|
||||
playerSpeed = c.entityInfo.speed;
|
||||
} else {
|
||||
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 (c.entity instanceof Player) {
|
||||
int playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSpeed();
|
||||
if (((Player) c.entity).hasEffect(MobEffects.MOVEMENT_SPEED)) {
|
||||
playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerHasteSpeed();
|
||||
} else if (((Player) c.entity).hasEffect(MobEffects.MOVEMENT_SLOWDOWN)) {
|
||||
playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSlowSpeed();
|
||||
}
|
||||
if (playerSpeed > fastestEnemySpeed) {
|
||||
fastestEnemySpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSpeed();
|
||||
}
|
||||
} else {
|
||||
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) {
|
||||
if (c.entityInfo.speed > fastestEnemySpeed) {
|
||||
fastestEnemySpeed = c.entityInfo.speed;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (Combatant c : sideA.values()) {
|
||||
if (c.entity instanceof Player player) {
|
||||
int playerSpeed;
|
||||
if (c.entityInfo != null && !c.entityInfo.playerName.isEmpty()) {
|
||||
playerSpeed = c.entityInfo.speed;
|
||||
} else {
|
||||
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 (c.entity instanceof Player) {
|
||||
int playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSpeed();
|
||||
if (((Player) c.entity).hasEffect(MobEffects.MOVEMENT_SPEED)) {
|
||||
playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerHasteSpeed();
|
||||
} else if (((Player) c.entity).hasEffect(MobEffects.MOVEMENT_SLOWDOWN)) {
|
||||
playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSlowSpeed();
|
||||
}
|
||||
if (playerSpeed > fastestEnemySpeed) {
|
||||
fastestEnemySpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSpeed();
|
||||
}
|
||||
} else {
|
||||
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) {
|
||||
if (c.entityInfo.speed > fastestEnemySpeed) {
|
||||
fastestEnemySpeed = c.entityInfo.speed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int fleeProbability = 0;
|
||||
if (next.entity instanceof Player player) {
|
||||
int playerSpeed;
|
||||
if (next.entityInfo != null && !next.entityInfo.playerName.isEmpty()) {
|
||||
playerSpeed = next.entityInfo.speed;
|
||||
} else {
|
||||
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 (next.entity instanceof Player) {
|
||||
int playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSpeed();
|
||||
if (((Player) next.entity).hasEffect(MobEffects.MOVEMENT_SPEED)) {
|
||||
playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerHasteSpeed();
|
||||
} else if (((Player) next.entity).hasEffect(MobEffects.MOVEMENT_SLOWDOWN)) {
|
||||
playerSpeed = TurnBasedMinecraftMod.proxy.getConfig().getPlayerSlowSpeed();
|
||||
}
|
||||
if (fastestEnemySpeed >= playerSpeed) {
|
||||
fleeProbability = TurnBasedMinecraftMod.proxy.getConfig().getFleeBadProbability();
|
||||
|
|
|
@ -25,7 +25,6 @@ public class Config
|
|||
private boolean battleDecisionDurationForever = false;
|
||||
private Map<String, EntityInfo> entityInfoMap;
|
||||
private Map<String, EntityInfo> customEntityInfoMap;
|
||||
private Map<String, EntityInfo> customPlayerInfoMap;
|
||||
private Set<String> ignoreBattleTypes;
|
||||
private Logger logger;
|
||||
private int playerSpeed = 50;
|
||||
|
@ -59,7 +58,6 @@ public class Config
|
|||
{
|
||||
entityInfoMap = new HashMap<String, EntityInfo>();
|
||||
customEntityInfoMap = new HashMap<String, EntityInfo>();
|
||||
customPlayerInfoMap = new HashMap<String, EntityInfo>();
|
||||
ignoreBattleTypes = new HashSet<String>();
|
||||
this.logger = logger;
|
||||
battleIgnoringPlayers = new HashSet<Integer>();
|
||||
|
@ -520,33 +518,23 @@ public class Config
|
|||
logger.error("Entity with invalid custom_name (must be a string), skipping...");
|
||||
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 {
|
||||
logger.error("Entity must have \"name\" or \"custom_name\" or \"player_name\" entry");
|
||||
logger.error("Entity must have \"name\" or \"custom_name\" entry");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (eInfo.playerName.isEmpty()) {
|
||||
try {
|
||||
eInfo.attackPower = nestedConf.getInt("attack_power");
|
||||
if (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;
|
||||
try {
|
||||
eInfo.attackPower = nestedConf.getInt("attack_power");
|
||||
if(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;
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -594,51 +582,49 @@ public class Config
|
|||
logEntityMissingOptionalValue("attack_effect", name, "unknown");
|
||||
}
|
||||
|
||||
if (eInfo.playerName.isEmpty()) {
|
||||
try {
|
||||
eInfo.attackVariance = nestedConf.getInt("attack_variance");
|
||||
if (eInfo.attackVariance < 0) {
|
||||
logClampedValueEntity("attack_variance", name, Integer.toString(eInfo.attackVariance), "0");
|
||||
eInfo.attackVariance = 0;
|
||||
}
|
||||
} catch (ClassCastException e) {
|
||||
try {
|
||||
eInfo.attackVariance = nestedConf.getInt("attack_variance");
|
||||
if(eInfo.attackVariance < 0) {
|
||||
logClampedValueEntity("attack_variance", name, Integer.toString(eInfo.attackVariance), "0");
|
||||
eInfo.attackVariance = 0;
|
||||
logEntityInvalidValue("attack_variance", name, "0");
|
||||
} catch (NullPointerException e) {
|
||||
eInfo.attackVariance = 0;
|
||||
logEntityMissingOptionalValue("attack_variance", name, "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");
|
||||
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 {
|
||||
|
@ -669,106 +655,82 @@ public class Config
|
|||
}
|
||||
|
||||
try {
|
||||
eInfo.hasteSpeed = nestedConf.getInt("haste_speed");
|
||||
eInfo.ignoreBattle = nestedConf.get("ignore_battle");
|
||||
} catch (ClassCastException e) {
|
||||
logEntityInvalidValue("haste_speed", name, "80");
|
||||
eInfo.hasteSpeed = 80;
|
||||
logEntityInvalidValue("ignore_battle", name, "false");
|
||||
eInfo.ignoreBattle = false;
|
||||
} catch (NullPointerException e) {
|
||||
logEntityMissingOptionalValue("haste_speed", name, "80");
|
||||
eInfo.hasteSpeed = 80;
|
||||
logEntityMissingRequiredValue("ignore_battle", name, "false");
|
||||
eInfo.ignoreBattle = false;
|
||||
}
|
||||
|
||||
try {
|
||||
eInfo.slowSpeed = nestedConf.getInt("slow_speed");
|
||||
eInfo.category = nestedConf.get("category");
|
||||
} catch (ClassCastException e) {
|
||||
logEntityInvalidValue("slow_speed", name, "20");
|
||||
eInfo.slowSpeed = 20;
|
||||
logEntityInvalidValue("category", name, "unknown");
|
||||
eInfo.category = "unknown";
|
||||
} catch (NullPointerException e) {
|
||||
logEntityMissingOptionalValue("slow_speed", name, "20");
|
||||
eInfo.slowSpeed = 20;
|
||||
logEntityMissingRequiredValue("category", name, "unknown");
|
||||
eInfo.category = "unknown";
|
||||
}
|
||||
|
||||
if (eInfo.playerName.isEmpty()) {
|
||||
try {
|
||||
eInfo.ignoreBattle = nestedConf.get("ignore_battle");
|
||||
} catch (ClassCastException e) {
|
||||
logEntityInvalidValue("ignore_battle", name, "false");
|
||||
eInfo.ignoreBattle = false;
|
||||
} catch (NullPointerException e) {
|
||||
logEntityMissingRequiredValue("ignore_battle", name, "false");
|
||||
eInfo.ignoreBattle = false;
|
||||
try {
|
||||
eInfo.decisionAttack = nestedConf.getInt("decision_attack_probability");
|
||||
if(eInfo.decisionAttack < 0) {
|
||||
logClampedValueEntity("decision_attack_probability", name, Integer.toString(eInfo.decisionAttack), "0");
|
||||
eInfo.decisionAttack = 0;
|
||||
} else if(eInfo.decisionAttack > 100) {
|
||||
logClampedValueEntity("decision_attack_probability", name, Integer.toString(eInfo.decisionAttack), "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.category = nestedConf.get("category");
|
||||
} catch (ClassCastException e) {
|
||||
logEntityInvalidValue("category", name, "unknown");
|
||||
eInfo.category = "unknown";
|
||||
} catch (NullPointerException e) {
|
||||
logEntityMissingRequiredValue("category", name, "unknown");
|
||||
eInfo.category = "unknown";
|
||||
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.decisionAttack = nestedConf.getInt("decision_attack_probability");
|
||||
if (eInfo.decisionAttack < 0) {
|
||||
logClampedValueEntity("decision_attack_probability", name, Integer.toString(eInfo.decisionAttack), "0");
|
||||
eInfo.decisionAttack = 0;
|
||||
} else if (eInfo.decisionAttack > 100) {
|
||||
logClampedValueEntity("decision_attack_probability", name, Integer.toString(eInfo.decisionAttack), "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;
|
||||
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;
|
||||
}
|
||||
|
||||
if(eInfo.classType != null) {
|
||||
entityInfoMap.put(eInfo.classType.getName(), eInfo);
|
||||
} else if(!eInfo.customName.isEmpty()) {
|
||||
customEntityInfoMap.put(eInfo.customName, eInfo);
|
||||
} else if (!eInfo.playerName.isEmpty()) {
|
||||
customPlayerInfoMap.put(eInfo.playerName, eInfo);
|
||||
} else {
|
||||
logger.error("Cannot add entity to internal config, no \"name\" or \"custom_name\" or \"player_name\"");
|
||||
logger.error("Cannot add entity to internal config, no \"name\" or \"custom_name\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -834,8 +796,6 @@ public class Config
|
|||
newConf.set("defense_damage_probability", eInfo.defenseDamageProbability);
|
||||
newConf.set("evasion", eInfo.evasion);
|
||||
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("category", eInfo.category);
|
||||
newConf.set("decision_attack_probability", eInfo.decisionAttack);
|
||||
|
@ -865,11 +825,9 @@ public class Config
|
|||
|
||||
boolean saved = false;
|
||||
try {
|
||||
if (eInfo.classType != null || !eInfo.customName.isEmpty() || !eInfo.playerName.isEmpty()) {
|
||||
if (eInfo.classType != null || !eInfo.customName.isEmpty()) {
|
||||
for (com.electronwill.nightconfig.core.Config entity : entities) {
|
||||
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()))) {
|
||||
entity.set("attack_power", eInfo.attackPower);
|
||||
entity.set("attack_probability", eInfo.attackProbability);
|
||||
|
@ -880,8 +838,6 @@ public class Config
|
|||
entity.set("defense_damage_probability", eInfo.defenseDamageProbability);
|
||||
entity.set("evasion", eInfo.evasion);
|
||||
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("category", eInfo.category);
|
||||
entity.set("decision_attack_probability", eInfo.decisionAttack);
|
||||
|
@ -889,35 +845,26 @@ public class Config
|
|||
entity.set("decision_flee_probability", eInfo.decisionFlee);
|
||||
saved = true;
|
||||
break;
|
||||
} else if (!eInfo.customName.isEmpty() && customName != null && customName.equals(eInfo.customName)) {
|
||||
entity.set("attack_power", eInfo.attackPower);
|
||||
entity.set("attack_probability", eInfo.attackProbability);
|
||||
entity.set("attack_variance", eInfo.attackVariance);
|
||||
entity.set("attack_effect", eInfo.attackEffect.toString());
|
||||
entity.set("attack_effect_probability", eInfo.attackEffectProbability);
|
||||
entity.set("defense_damage", eInfo.defenseDamage);
|
||||
entity.set("defense_damage_probability", eInfo.defenseDamageProbability);
|
||||
entity.set("evasion", eInfo.evasion);
|
||||
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("category", eInfo.category);
|
||||
entity.set("decision_attack_probability", eInfo.decisionAttack);
|
||||
entity.set("decision_defend_probability", eInfo.decisionDefend);
|
||||
entity.set("decision_flee_probability", eInfo.decisionFlee);
|
||||
saved = true;
|
||||
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;
|
||||
} else {
|
||||
String customName = entity.get("custom_name");
|
||||
if(!eInfo.customName.isEmpty() && customName != null && customName.equals(eInfo.customName)) {
|
||||
entity.set("attack_power", eInfo.attackPower);
|
||||
entity.set("attack_probability", eInfo.attackProbability);
|
||||
entity.set("attack_variance", eInfo.attackVariance);
|
||||
entity.set("attack_effect", eInfo.attackEffect.toString());
|
||||
entity.set("attack_effect_probability", eInfo.attackEffectProbability);
|
||||
entity.set("defense_damage", eInfo.defenseDamage);
|
||||
entity.set("defense_damage_probability", eInfo.defenseDamageProbability);
|
||||
entity.set("evasion", eInfo.evasion);
|
||||
entity.set("speed", eInfo.speed);
|
||||
entity.set("ignore_battle", eInfo.ignoreBattle);
|
||||
entity.set("category", eInfo.category);
|
||||
entity.set("decision_attack_probability", eInfo.decisionAttack);
|
||||
entity.set("decision_defend_probability", eInfo.decisionDefend);
|
||||
entity.set("decision_flee_probability", eInfo.decisionFlee);
|
||||
saved = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!saved) {
|
||||
|
@ -926,38 +873,25 @@ public class Config
|
|||
newEntry.set("name", eInfo.classType.getName());
|
||||
} else if(!eInfo.customName.isEmpty()) {
|
||||
newEntry.set("custom_name", eInfo.customName);
|
||||
} else if (!eInfo.playerName.isEmpty()) {
|
||||
newEntry.set("player_name", eInfo.playerName);
|
||||
} else {
|
||||
logger.error("Failed to save new entity entry into config, no name or custom_name");
|
||||
conf.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (eInfo.playerName.isEmpty()) {
|
||||
newEntry.set("attack_power", eInfo.attackPower);
|
||||
}
|
||||
newEntry.set("attack_power", eInfo.attackPower);
|
||||
newEntry.set("attack_probability", eInfo.attackProbability);
|
||||
if (eInfo.playerName.isEmpty()) {
|
||||
newEntry.set("attack_variance", eInfo.attackVariance);
|
||||
}
|
||||
newEntry.set("attack_variance", eInfo.attackVariance);
|
||||
newEntry.set("attack_effect", eInfo.attackEffect.toString());
|
||||
newEntry.set("attack_effect_probability", eInfo.attackEffectProbability);
|
||||
if (eInfo.playerName.isEmpty()) {
|
||||
newEntry.set("defense_damage", eInfo.defenseDamage);
|
||||
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("speed", eInfo.speed);
|
||||
newEntry.set("haste_speed", eInfo.hasteSpeed);
|
||||
newEntry.set("slow_speed", eInfo.slowSpeed);
|
||||
if (eInfo.playerName.isEmpty()) {
|
||||
newEntry.set("ignore_battle", eInfo.ignoreBattle);
|
||||
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);
|
||||
}
|
||||
newEntry.set("ignore_battle", eInfo.ignoreBattle);
|
||||
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);
|
||||
saved = true;
|
||||
}
|
||||
|
@ -982,10 +916,8 @@ public class Config
|
|||
|
||||
if(eInfo.classType != null) {
|
||||
entityInfoMap.put(eInfo.classType.getName(), eInfo);
|
||||
} else if(!eInfo.customName.isEmpty()) {
|
||||
} else if(!eInfo.customName.isEmpty()){
|
||||
customEntityInfoMap.put(eInfo.customName, eInfo);
|
||||
} else if (!eInfo.playerName.isEmpty()) {
|
||||
customPlayerInfoMap.put(eInfo.playerName, eInfo);
|
||||
} else {
|
||||
logger.warn("Failed to update entity info in memory");
|
||||
}
|
||||
|
@ -1165,22 +1097,6 @@ public class Config
|
|||
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)
|
||||
{
|
||||
if(customName == null) {
|
||||
|
@ -1189,13 +1105,6 @@ public class Config
|
|||
return customEntityInfoMap.get(customName);
|
||||
}
|
||||
|
||||
protected EntityInfo getPlayerInfoReference(String playerName) {
|
||||
if (playerName == null) {
|
||||
return null;
|
||||
}
|
||||
return customPlayerInfoMap.get(playerName);
|
||||
}
|
||||
|
||||
private int getConfigFileVersion(File configFile)
|
||||
{
|
||||
int version = 0;
|
||||
|
|
|
@ -8,7 +8,6 @@ public class EditingInfo
|
|||
public EntityInfo entityInfo;
|
||||
public boolean isPendingEntitySelection;
|
||||
public boolean isEditingCustomName;
|
||||
public boolean isEditingPlayer;
|
||||
|
||||
public EditingInfo()
|
||||
{
|
||||
|
@ -16,7 +15,6 @@ public class EditingInfo
|
|||
entityInfo = null;
|
||||
isPendingEntitySelection = true;
|
||||
isEditingCustomName = false;
|
||||
isEditingPlayer = false;
|
||||
}
|
||||
|
||||
public EditingInfo(Player player)
|
||||
|
@ -25,6 +23,5 @@ public class EditingInfo
|
|||
entityInfo = null;
|
||||
isPendingEntitySelection = true;
|
||||
isEditingCustomName = false;
|
||||
isEditingPlayer = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,15 +17,12 @@ public class EntityInfo
|
|||
public int defenseDamageProbability;
|
||||
public int evasion;
|
||||
public int speed;
|
||||
public int hasteSpeed;
|
||||
public int slowSpeed;
|
||||
public String category;
|
||||
public int decisionAttack;
|
||||
public int decisionDefend;
|
||||
public int decisionFlee;
|
||||
public String customName;
|
||||
public String playerName;
|
||||
|
||||
|
||||
public enum Effect
|
||||
{
|
||||
SPEED,
|
||||
|
@ -369,39 +366,11 @@ public class EntityInfo
|
|||
defenseDamageProbability = 0;
|
||||
evasion = 15;
|
||||
speed = 50;
|
||||
hasteSpeed = 80;
|
||||
slowSpeed = 20;
|
||||
category = "unknown";
|
||||
decisionAttack = 70;
|
||||
decisionDefend = 20;
|
||||
decisionFlee = 10;
|
||||
customName = "";
|
||||
playerName = "";
|
||||
}
|
||||
|
||||
public EntityInfo(Class classType, boolean ignoreBattle, int attackPower, int attackProbability, int attackVariance,
|
||||
Effect attackEffect, int attackEffectProbability, int defenseDamage, int defenseDamageProbability,
|
||||
int evasion, int speed, int hasteSpeed, int slowSpeed, String category, int decisionAttack, int decisionDefend, int decisionFlee,
|
||||
String customName, String playerName) {
|
||||
this.classType = classType;
|
||||
this.ignoreBattle = ignoreBattle;
|
||||
this.attackPower = attackPower;
|
||||
this.attackProbability = attackProbability;
|
||||
this.attackVariance = attackVariance;
|
||||
this.attackEffect = attackEffect;
|
||||
this.attackEffectProbability = attackEffectProbability;
|
||||
this.defenseDamage = defenseDamage;
|
||||
this.defenseDamageProbability = defenseDamageProbability;
|
||||
this.evasion = evasion;
|
||||
this.speed = speed;
|
||||
this.hasteSpeed = hasteSpeed;
|
||||
this.slowSpeed = slowSpeed;
|
||||
this.category = category;
|
||||
this.decisionAttack = decisionAttack;
|
||||
this.decisionDefend = decisionDefend;
|
||||
this.decisionFlee = decisionFlee;
|
||||
this.customName = customName;
|
||||
this.playerName = playerName;
|
||||
customName = new String();
|
||||
}
|
||||
|
||||
public EntityInfo clone()
|
||||
|
@ -418,14 +387,11 @@ public class EntityInfo
|
|||
newEntityInfo.defenseDamageProbability = defenseDamageProbability;
|
||||
newEntityInfo.evasion = evasion;
|
||||
newEntityInfo.speed = speed;
|
||||
newEntityInfo.hasteSpeed = hasteSpeed;
|
||||
newEntityInfo.slowSpeed = slowSpeed;
|
||||
newEntityInfo.category = category;
|
||||
newEntityInfo.decisionAttack = decisionAttack;
|
||||
newEntityInfo.decisionDefend = decisionDefend;
|
||||
newEntityInfo.decisionFlee = decisionFlee;
|
||||
newEntityInfo.customName = customName;
|
||||
newEntityInfo.playerName = playerName;
|
||||
newEntityInfo.customName = new String(customName);
|
||||
return newEntityInfo;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.apache.logging.log4j.Logger;
|
|||
public class TurnBasedMinecraftMod {
|
||||
public static final String MODID = "com_burnedkirby_turnbasedminecraft";
|
||||
public static final String NAME = "Turn Based Minecraft Mod";
|
||||
public static final String VERSION = "1.26.4";
|
||||
public static final String VERSION = "1.26.3";
|
||||
public static final String CONFIG_FILENAME = "TBM_Config.toml";
|
||||
public static final String DEFAULT_CONFIG_FILENAME = "TBM_Config_DEFAULT.toml";
|
||||
public static final String CONFIG_DIRECTORY = "config/TurnBasedMinecraft/";
|
||||
|
@ -292,30 +292,6 @@ public class TurnBasedMinecraftMod {
|
|||
}
|
||||
return 1;
|
||||
}))
|
||||
.then(Commands.literal("player")
|
||||
.executes(c -> {
|
||||
ServerPlayer player = c.getSource().getPlayerOrException();
|
||||
getHandler().send(new PacketEditingMessage(PacketEditingMessage.Type.PICK_PLAYER), PacketDistributor.PLAYER.with(player));
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("playerName", StringArgumentType.greedyString()).executes(c -> {
|
||||
String name = StringArgumentType.getString(c, "playerName");
|
||||
ServerPlayer player = c.getSource().getPlayerOrException();
|
||||
getHandler().send(new PacketGeneralMessage("Editing player \"" + name + "\""), PacketDistributor.PLAYER.with(player));
|
||||
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;
|
||||
getHandler().send(new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editInfo.entityInfo), PacketDistributor.PLAYER.with(player));
|
||||
return 1;
|
||||
}))
|
||||
)
|
||||
.then(Commands.literal("edit")
|
||||
.executes(c -> {
|
||||
ServerPlayer player = c.getSource().getPlayerOrException();
|
||||
|
@ -639,45 +615,11 @@ public class TurnBasedMinecraftMod {
|
|||
}))
|
||||
)
|
||||
.then(Commands.literal("speed")
|
||||
.executes(c -> {
|
||||
ServerPlayer player = c.getSource().getPlayerOrException();
|
||||
EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
|
||||
if (editingInfo != null && !editingInfo.isPendingEntitySelection) {
|
||||
getHandler().send(new PacketEditingMessage(PacketEditingMessage.Type.EDIT_SPEED), PacketDistributor.PLAYER.with(player));
|
||||
} else if (editingInfo != null) {
|
||||
getHandler().send(new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY), PacketDistributor.PLAYER.with(player));
|
||||
} 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;
|
||||
getHandler().send(new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo), PacketDistributor.PLAYER.with(player));
|
||||
} else if (editingInfo != null) {
|
||||
getHandler().send(new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY), PacketDistributor.PLAYER.with(player));
|
||||
} 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 -> {
|
||||
ServerPlayer player = c.getSource().getPlayerOrException();
|
||||
EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
|
||||
if (editingInfo != null && !editingInfo.isPendingEntitySelection) {
|
||||
getHandler().send(new PacketEditingMessage(PacketEditingMessage.Type.EDIT_HASTE_SPEED), PacketDistributor.PLAYER.with(player));
|
||||
getHandler().send(new PacketEditingMessage(PacketEditingMessage.Type.EDIT_SPEED), PacketDistributor.PLAYER.with(player));
|
||||
} else if (editingInfo != null) {
|
||||
getHandler().send(new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY), PacketDistributor.PLAYER.with(player));
|
||||
} else {
|
||||
|
@ -686,16 +628,16 @@ public class TurnBasedMinecraftMod {
|
|||
}
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("hasteSpeed", IntegerArgumentType.integer())
|
||||
.then(Commands.argument("speed", IntegerArgumentType.integer())
|
||||
.executes(c -> {
|
||||
ServerPlayer player = c.getSource().getPlayerOrException();
|
||||
EditingInfo editingInfo = TurnBasedMinecraftMod.proxy.getEditingInfo(player.getId());
|
||||
int hasteSpeed = IntegerArgumentType.getInteger(c, "hasteSpeed");
|
||||
if (hasteSpeed < 0) {
|
||||
hasteSpeed = 0;
|
||||
int speed = IntegerArgumentType.getInteger(c, "speed");
|
||||
if (speed < 0) {
|
||||
speed = 0;
|
||||
}
|
||||
if (editingInfo != null && !editingInfo.isPendingEntitySelection) {
|
||||
editingInfo.entityInfo.hasteSpeed = hasteSpeed;
|
||||
editingInfo.entityInfo.speed = speed;
|
||||
getHandler().send(new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo), PacketDistributor.PLAYER.with(player));
|
||||
} else if (editingInfo != null) {
|
||||
getHandler().send(new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY), PacketDistributor.PLAYER.with(player));
|
||||
|
@ -706,40 +648,6 @@ public class TurnBasedMinecraftMod {
|
|||
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) {
|
||||
getHandler().send(new PacketEditingMessage(PacketEditingMessage.Type.EDIT_SLOW_SPEED), PacketDistributor.PLAYER.with(player));
|
||||
} else if (editingInfo != null) {
|
||||
getHandler().send(new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY), PacketDistributor.PLAYER.with(player));
|
||||
} 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;
|
||||
getHandler().send(new PacketEditingMessage(PacketEditingMessage.Type.PICK_EDIT, editingInfo.entityInfo), PacketDistributor.PLAYER.with(player));
|
||||
} else if (editingInfo != null) {
|
||||
getHandler().send(new PacketEditingMessage(PacketEditingMessage.Type.ATTACK_ENTITY), PacketDistributor.PLAYER.with(player));
|
||||
} 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")
|
||||
.executes(c -> {
|
||||
ServerPlayer player = c.getSource().getPlayerOrException();
|
||||
|
|
|
@ -28,14 +28,11 @@ public class PacketEditingMessage
|
|||
EDIT_DEFENSE_DAMAGE_PROBABILITY(9),
|
||||
EDIT_EVASION(10),
|
||||
EDIT_SPEED(11),
|
||||
EDIT_HASTE_SPEED(18),
|
||||
EDIT_SLOW_SPEED(19),
|
||||
EDIT_CATEGORY(12),
|
||||
EDIT_DECISION_ATTACK(13),
|
||||
EDIT_DECISION_DEFEND(14),
|
||||
EDIT_DECISION_FLEE(15),
|
||||
SERVER_EDIT(16),
|
||||
PICK_PLAYER(17);
|
||||
SERVER_EDIT(16);
|
||||
|
||||
Type(int value)
|
||||
{
|
||||
|
@ -113,14 +110,11 @@ public class PacketEditingMessage
|
|||
buf.writeInt(pkt.entityInfo.defenseDamageProbability);
|
||||
buf.writeInt(pkt.entityInfo.evasion);
|
||||
buf.writeInt(pkt.entityInfo.speed);
|
||||
buf.writeInt(pkt.entityInfo.hasteSpeed);
|
||||
buf.writeInt(pkt.entityInfo.slowSpeed);
|
||||
buf.writeUtf(pkt.entityInfo.category);
|
||||
buf.writeInt(pkt.entityInfo.decisionAttack);
|
||||
buf.writeInt(pkt.entityInfo.decisionDefend);
|
||||
buf.writeInt(pkt.entityInfo.decisionFlee);
|
||||
buf.writeUtf(pkt.entityInfo.customName);
|
||||
buf.writeUtf(pkt.entityInfo.playerName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,14 +138,11 @@ public class PacketEditingMessage
|
|||
einfo.defenseDamageProbability = buf.readInt();
|
||||
einfo.evasion = buf.readInt();
|
||||
einfo.speed = buf.readInt();
|
||||
einfo.hasteSpeed = buf.readInt();
|
||||
einfo.slowSpeed = buf.readInt();
|
||||
einfo.category = buf.readUtf();
|
||||
einfo.decisionAttack = buf.readInt();
|
||||
einfo.decisionDefend = buf.readInt();
|
||||
einfo.decisionFlee = buf.readInt();
|
||||
einfo.customName = buf.readUtf();
|
||||
einfo.playerName = buf.readUtf();
|
||||
return new PacketEditingMessage(type, einfo);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue