Update for forge-1.19-41.1.0, mod ver. 1.19
This commit is contained in:
parent
c4b10f1791
commit
74b9681253
13 changed files with 610 additions and 574 deletions
|
@ -58,7 +58,7 @@ configured for them.)
|
|||
# Building
|
||||
|
||||
Simply invoke `./gradlew build` in the mod directory and after some time the
|
||||
finished jar will be saved at "build/libs/TurnBasedMinecraft-1.18.7.jar"
|
||||
finished jar will be saved at "build/libs/TurnBasedMinecraft-1.19.0.jar"
|
||||
|
||||
# Other notes
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ apply plugin: 'net.minecraftforge.gradle'
|
|||
//apply plugin: 'eclipse'
|
||||
//apply plugin: 'maven-publish'
|
||||
|
||||
version = "1.18.7"
|
||||
version = "1.19.0"
|
||||
group = "com.burnedkirby.TurnBasedMinecraft"
|
||||
archivesBaseName = "TurnBasedMinecraft"
|
||||
|
||||
|
@ -27,7 +27,7 @@ minecraft {
|
|||
// stable_# Stables are built at the discretion of the MCP team.
|
||||
// Use non-default mappings at your own risk. they may not always work.
|
||||
// Simply re-run your setup task after changing the mappings to update your workspace.
|
||||
mappings channel: 'official', version: '1.18.2'
|
||||
mappings channel: 'official', version: '1.19'
|
||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||
|
||||
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
|
@ -151,7 +151,7 @@ dependencies {
|
|||
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
|
||||
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
|
||||
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
|
||||
minecraft 'net.minecraftforge:forge:1.18.2-40.1.0'
|
||||
minecraft 'net.minecraftforge:forge:1.19-41.1.0'
|
||||
|
||||
// Real mod deobf dependency examples - these get remapped to your current mappings
|
||||
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
import java.util.ConcurrentModificationException;
|
||||
import java.util.HashMap;
|
||||
|
@ -82,7 +82,7 @@ public class BattleGui extends Screen {
|
|||
}
|
||||
|
||||
public BattleGui() {
|
||||
super(new TextComponent("Battle Gui"));
|
||||
super(Component.literal("Battle Gui"));
|
||||
timeRemaining = new AtomicInteger((int) (Config.BATTLE_DECISION_DURATION_NANO_DEFAULT / 1000000000L));
|
||||
timerMax = timeRemaining.get();
|
||||
lastInstant = System.nanoTime();
|
||||
|
@ -127,16 +127,16 @@ public class BattleGui extends Screen {
|
|||
switch (state) {
|
||||
case MAIN_MENU:
|
||||
info = "What will you do?";
|
||||
addRenderableWidget(new Button(width * 3 / 7 - 25, 40, 50, 20, new TextComponent("Attack"), (button) -> {
|
||||
addRenderableWidget(new Button(width * 3 / 7 - 25, 40, 50, 20, Component.literal("Attack"), (button) -> {
|
||||
buttonActionEvent(button, ButtonAction.ATTACK);
|
||||
}));
|
||||
addRenderableWidget(new Button(width * 4 / 7 - 25, 40, 50, 20, new TextComponent("Defend"), (button) -> {
|
||||
addRenderableWidget(new Button(width * 4 / 7 - 25, 40, 50, 20, Component.literal("Defend"), (button) -> {
|
||||
buttonActionEvent(button, ButtonAction.DEFEND);
|
||||
}));
|
||||
addRenderableWidget(new Button(width * 3 / 7 - 25, 60, 50, 20, new TextComponent("Item"), (button) -> {
|
||||
addRenderableWidget(new Button(width * 3 / 7 - 25, 60, 50, 20, Component.literal("Item"), (button) -> {
|
||||
buttonActionEvent(button, ButtonAction.ITEM);
|
||||
}));
|
||||
addRenderableWidget(new Button(width * 4 / 7 - 25, 60, 50, 20, new TextComponent("Flee"), (button) -> {
|
||||
addRenderableWidget(new Button(width * 4 / 7 - 25, 60, 50, 20, Component.literal("Flee"), (button) -> {
|
||||
buttonActionEvent(button, ButtonAction.FLEE);
|
||||
}));
|
||||
break;
|
||||
|
@ -178,19 +178,19 @@ public class BattleGui extends Screen {
|
|||
} catch (ConcurrentModificationException e) {
|
||||
// ignored
|
||||
}
|
||||
addRenderableWidget(new Button(width / 2 - 30, height - 120, 60, 20, new TextComponent("Cancel"), (button) -> {
|
||||
addRenderableWidget(new Button(width / 2 - 30, height - 120, 60, 20, Component.literal("Cancel"), (button) -> {
|
||||
buttonActionEvent(button, ButtonAction.CANCEL);
|
||||
}));
|
||||
break;
|
||||
case ITEM_ACTION:
|
||||
info = "What will you do with an item?";
|
||||
addRenderableWidget(new Button(width * 1 / 4 - 40, height - 120, 80, 20, new TextComponent("Switch Held"), (button) -> {
|
||||
addRenderableWidget(new Button(width * 1 / 4 - 40, height - 120, 80, 20, Component.literal("Switch Held"), (button) -> {
|
||||
buttonActionEvent(button, ButtonAction.SWITCH_HELD_ITEM);
|
||||
}));
|
||||
addRenderableWidget(new Button(width * 2 / 4 - 40, height - 120, 80, 20, new TextComponent("Use"), (button) -> {
|
||||
addRenderableWidget(new Button(width * 2 / 4 - 40, height - 120, 80, 20, Component.literal("Use"), (button) -> {
|
||||
buttonActionEvent(button, ButtonAction.DECIDE_USE_ITEM);
|
||||
}));
|
||||
addRenderableWidget(new Button(width * 3 / 4 - 40, height - 120, 80, 20, new TextComponent("Cancel"), (button) -> {
|
||||
addRenderableWidget(new Button(width * 3 / 4 - 40, height - 120, 80, 20, Component.literal("Cancel"), (button) -> {
|
||||
buttonActionEvent(button, ButtonAction.CANCEL);
|
||||
}));
|
||||
break;
|
||||
|
@ -204,7 +204,7 @@ public class BattleGui extends Screen {
|
|||
buttonActionEvent(button, ButtonAction.DO_ITEM_SWITCH);
|
||||
}));
|
||||
}
|
||||
addRenderableWidget(new Button(width / 2 - 40, height - 120, 80, 20, new TextComponent("Cancel"), (button) -> {
|
||||
addRenderableWidget(new Button(width / 2 - 40, height - 120, 80, 20, Component.literal("Cancel"), (button) -> {
|
||||
buttonActionEvent(button, ButtonAction.CANCEL);
|
||||
}));
|
||||
break;
|
||||
|
@ -215,7 +215,7 @@ public class BattleGui extends Screen {
|
|||
buttonActionEvent(button, ButtonAction.DO_USE_ITEM);
|
||||
}));
|
||||
}
|
||||
addRenderableWidget(new Button(width / 2 - 40, height - 120, 80, 20, new TextComponent("Cancel"), (button) -> {
|
||||
addRenderableWidget(new Button(width / 2 - 40, height - 120, 80, 20, Component.literal("Cancel"), (button) -> {
|
||||
buttonActionEvent(button, ButtonAction.CANCEL);
|
||||
}));
|
||||
break;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -6,14 +6,13 @@ import net.minecraft.client.gui.components.Button;
|
|||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
|
||||
public class EntitySelectionButton extends Button {
|
||||
private int entityID;
|
||||
private boolean isSideA;
|
||||
|
||||
public EntitySelectionButton(int x, int y, int widthIn, int heightIn, String buttonText, int entityID, boolean isSideA, Button.OnPress onPress) {
|
||||
super(x, y, widthIn, heightIn, new TextComponent(buttonText), onPress);
|
||||
super(x, y, widthIn, heightIn, Component.literal(buttonText), onPress);
|
||||
this.entityID = entityID;
|
||||
this.isSideA = isSideA;
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@ package com.burnedkirby.TurnBasedMinecraft.client;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
public class ItemSelectionButton extends Button {
|
||||
private int itemStackID;
|
||||
|
||||
public ItemSelectionButton(int x, int y, int widthIn, int heightIn, String buttonText, int itemStackID, Button.OnPress onPress) {
|
||||
super(x, y, widthIn, heightIn, new TextComponent(buttonText), onPress);
|
||||
super(x, y, widthIn, heightIn, Component.literal(buttonText), onPress);
|
||||
this.itemStackID = itemStackID;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package com.burnedkirby.TurnBasedMinecraft.common;
|
||||
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.event.entity.EntityJoinLevelEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
public class PlayerJoinEventHandler
|
||||
{
|
||||
@SubscribeEvent
|
||||
public void entityJoinHandler(EntityJoinWorldEvent event)
|
||||
public void entityJoinHandler(EntityJoinLevelEvent event)
|
||||
{
|
||||
if(event.getWorld().isClientSide)
|
||||
if(event.getLevel().isClientSide)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,8 @@ import net.minecraft.commands.Commands;
|
|||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.network.chat.ClickEvent;
|
||||
import net.minecraft.network.chat.HoverEvent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
@ -38,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.18.7";
|
||||
public static final String VERSION = "1.19.0";
|
||||
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/";
|
||||
|
@ -157,7 +158,7 @@ public class TurnBasedMinecraftMod {
|
|||
})
|
||||
.executes(c -> {
|
||||
proxy.getConfig().addBattleIgnoringPlayer(c.getSource().getPlayerOrException().getId());
|
||||
c.getSource().sendSuccess(new TextComponent("Disabled turn-based-combat for current player"), true);
|
||||
c.getSource().sendSuccess(Component.literal("Disabled turn-based-combat for current player"), true);
|
||||
return 1;
|
||||
}));
|
||||
// tbm-disable-all
|
||||
|
@ -180,7 +181,7 @@ public class TurnBasedMinecraftMod {
|
|||
.requires(c -> !proxy.getConfig().getIfOnlyOPsCanDisableTurnBasedForSelf() || c.hasPermission(2))
|
||||
.executes(c -> {
|
||||
proxy.getConfig().removeBattleIgnoringPlayer(c.getSource().getPlayerOrException().getId());
|
||||
c.getSource().sendSuccess(new TextComponent("Enabled turn-based-combat for current player"), true);
|
||||
c.getSource().sendSuccess(Component.literal("Enabled turn-based-combat for current player"), true);
|
||||
return 1;
|
||||
}));
|
||||
// tbm-enable-all
|
||||
|
@ -203,7 +204,7 @@ public class TurnBasedMinecraftMod {
|
|||
for (ServerPlayer player : EntityArgument.getPlayers(c, "targets")) {
|
||||
proxy.getConfig().addBattleIgnoringPlayer(player.getId());
|
||||
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketGeneralMessage("OP enabled turn-based-combat for you"));
|
||||
c.getSource().sendSuccess(new TextComponent("Enabled turn-based-combat for " + player.getDisplayName().getString()), true);
|
||||
c.getSource().sendSuccess(Component.literal("Enabled turn-based-combat for " + player.getDisplayName().getString()), true);
|
||||
}
|
||||
return 1;
|
||||
})));
|
||||
|
@ -215,7 +216,7 @@ public class TurnBasedMinecraftMod {
|
|||
for (ServerPlayer player : EntityArgument.getPlayers(c, "targets")) {
|
||||
proxy.getConfig().removeBattleIgnoringPlayer(player.getId());
|
||||
getHandler().send(PacketDistributor.PLAYER.with(() -> player), new PacketGeneralMessage("OP disabled turn-based-combat for you"));
|
||||
c.getSource().sendSuccess(new TextComponent("Disabled turn-based-combat for " + player.getDisplayName().getString()), true);
|
||||
c.getSource().sendSuccess(Component.literal("Disabled turn-based-combat for " + player.getDisplayName().getString()), true);
|
||||
}
|
||||
return 1;
|
||||
})));
|
||||
|
@ -786,12 +787,12 @@ public class TurnBasedMinecraftMod {
|
|||
return 1;
|
||||
})
|
||||
.then(Commands.literal("leave_battle_cooldown").executes(c -> {
|
||||
TextComponent response = new TextComponent("leave_battle_cooldown requires an integer argument. ");
|
||||
TextComponent subResponse = new TextComponent("leave_battle_cooldown is currently: ");
|
||||
response.append(subResponse);
|
||||
subResponse = new TextComponent(String.valueOf(TurnBasedMinecraftMod.proxy.getConfig().getLeaveBattleCooldownSeconds()));
|
||||
MutableComponent response = Component.literal("leave_battle_cooldown requires an integer argument. ");
|
||||
MutableComponent subResponse = Component.literal("leave_battle_cooldown is currently: ");
|
||||
response.getSiblings().add(subResponse);
|
||||
subResponse = Component.literal(String.valueOf(TurnBasedMinecraftMod.proxy.getConfig().getLeaveBattleCooldownSeconds()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, false);
|
||||
return 1;
|
||||
})
|
||||
|
@ -806,27 +807,27 @@ public class TurnBasedMinecraftMod {
|
|||
cooldown)) {
|
||||
TurnBasedMinecraftMod.logger.warn(
|
||||
"Failed to set \"server_config.leave_battle_cooldown\" in config file!");
|
||||
c.getSource().sendFailure(new TextComponent("" +
|
||||
c.getSource().sendFailure(Component.literal("" +
|
||||
"Failed to set leave_battle_cooldown to \""
|
||||
+ cooldown
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
TextComponent response = new TextComponent("Successfully set leave_battle_cooldown to: ");
|
||||
TextComponent subResponse = new TextComponent(String.valueOf(cooldown));
|
||||
MutableComponent response = Component.literal("Successfully set leave_battle_cooldown to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(cooldown));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("aggro_start_battle_max_distance").executes(c -> {
|
||||
TextComponent response = new TextComponent("aggro_start_battle_max_distance requires an integer argument. ");
|
||||
TextComponent subResponse = new TextComponent("aggro_start_battle_max_distance is currently: ");
|
||||
response.append(subResponse);
|
||||
subResponse = new TextComponent(String.valueOf(
|
||||
MutableComponent response = Component.literal("aggro_start_battle_max_distance requires an integer argument. ");
|
||||
MutableComponent subResponse = Component.literal("aggro_start_battle_max_distance is currently: ");
|
||||
response.getSiblings().add(subResponse);
|
||||
subResponse = Component.literal(String.valueOf(
|
||||
TurnBasedMinecraftMod.proxy.getConfig().getAggroStartBattleDistance()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, false);
|
||||
return 1;
|
||||
})
|
||||
|
@ -841,27 +842,27 @@ public class TurnBasedMinecraftMod {
|
|||
distance)) {
|
||||
TurnBasedMinecraftMod.logger.warn(
|
||||
"Failed to set \"server_config.aggro_start_battle_max_distance\" in config file!");
|
||||
c.getSource().sendFailure(new TextComponent(
|
||||
c.getSource().sendFailure(Component.literal(
|
||||
"Failed to set aggro_start_battle_max_distance to \""
|
||||
+ distance
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
TextComponent response = new TextComponent("Successfully set aggro_start_battle_max_distance to: ");
|
||||
TextComponent subResponse = new TextComponent(String.valueOf(distance));
|
||||
MutableComponent response = Component.literal("Successfully set aggro_start_battle_max_distance to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(distance));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("old_battle_behavior").executes(c -> {
|
||||
TextComponent response = new TextComponent("old_battle_behavior requires a boolean argument. ");
|
||||
TextComponent subResponse = new TextComponent("old_battle_behavior is currently: ");
|
||||
response.append(subResponse);
|
||||
subResponse = new TextComponent(String.valueOf(
|
||||
MutableComponent response = Component.literal("old_battle_behavior requires a boolean argument. ");
|
||||
MutableComponent subResponse = Component.literal("old_battle_behavior is currently: ");
|
||||
response.getSiblings().add(subResponse);
|
||||
subResponse = Component.literal(String.valueOf(
|
||||
TurnBasedMinecraftMod.proxy.getConfig().isOldBattleBehaviorEnabled()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, false);
|
||||
return 1;
|
||||
})
|
||||
|
@ -874,27 +875,27 @@ public class TurnBasedMinecraftMod {
|
|||
enabled)) {
|
||||
TurnBasedMinecraftMod.logger.warn(
|
||||
"Failed to set \"server_config.old_battle_behavior\" in config file!");
|
||||
c.getSource().sendFailure(new TextComponent(
|
||||
c.getSource().sendFailure(Component.literal(
|
||||
"Failed to set old_battle_behavior to \""
|
||||
+ enabled
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
TextComponent response = new TextComponent("Successfully set old_battle_behavior to: ");
|
||||
TextComponent subResponse = new TextComponent(String.valueOf(enabled));
|
||||
MutableComponent response = Component.literal("Successfully set old_battle_behavior to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(enabled));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("anyone_can_disable_tbm_for_self").executes(c -> {
|
||||
TextComponent response = new TextComponent("anyone_can_disable_tbm_for_self requires a boolean argument. ");
|
||||
TextComponent subResponse = new TextComponent("anyone_can_disable_tbm_for_self is currently: ");
|
||||
response.append(subResponse);
|
||||
subResponse = new TextComponent(String.valueOf(
|
||||
MutableComponent response = Component.literal("anyone_can_disable_tbm_for_self requires a boolean argument. ");
|
||||
MutableComponent subResponse = Component.literal("anyone_can_disable_tbm_for_self is currently: ");
|
||||
response.getSiblings().add(subResponse);
|
||||
subResponse = Component.literal(String.valueOf(
|
||||
!TurnBasedMinecraftMod.proxy.getConfig().getIfOnlyOPsCanDisableTurnBasedForSelf()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, false);
|
||||
return 1;
|
||||
})
|
||||
|
@ -908,27 +909,27 @@ public class TurnBasedMinecraftMod {
|
|||
)) {
|
||||
TurnBasedMinecraftMod.logger.warn(
|
||||
"Failed to set \"server_config.anyone_can_disable_tbm_for_self\" in config file!");
|
||||
c.getSource().sendFailure(new TextComponent(
|
||||
c.getSource().sendFailure(Component.literal(
|
||||
"Failed to set anyone_can_disable_tbm_for_self to \""
|
||||
+ enabled_for_all
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
TextComponent response = new TextComponent("Successfully set anyone_can_disable_tbm_for_self to: ");
|
||||
TextComponent subResponse = new TextComponent(String.valueOf(enabled_for_all));
|
||||
MutableComponent response = Component.literal("Successfully set anyone_can_disable_tbm_for_self to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(enabled_for_all));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("max_in_battle").executes(c -> {
|
||||
TextComponent response = new TextComponent("max_in_battle requires an integer argument. ");
|
||||
TextComponent subResponse = new TextComponent("max_in_battle is currently: ");
|
||||
response.append(subResponse);
|
||||
subResponse = new TextComponent(String.valueOf(
|
||||
MutableComponent response = Component.literal("max_in_battle requires an integer argument. ");
|
||||
MutableComponent subResponse = Component.literal("max_in_battle is currently: ");
|
||||
response.getSiblings().add(subResponse);
|
||||
subResponse = Component.literal(String.valueOf(
|
||||
TurnBasedMinecraftMod.proxy.getConfig().getMaxInBattle()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, false);
|
||||
return 1;
|
||||
})
|
||||
|
@ -943,27 +944,27 @@ public class TurnBasedMinecraftMod {
|
|||
max_amount)) {
|
||||
TurnBasedMinecraftMod.logger.warn(
|
||||
"Failed to set \"server_config.max_in_battle\" in config file!");
|
||||
c.getSource().sendFailure(new TextComponent(
|
||||
c.getSource().sendFailure(Component.literal(
|
||||
"Failed to set max_in_battle to \""
|
||||
+ max_amount
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
TextComponent response = new TextComponent("Successfully set max_in_battle to: ");
|
||||
TextComponent subResponse = new TextComponent(String.valueOf(max_amount));
|
||||
MutableComponent response = Component.literal("Successfully set max_in_battle to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(max_amount));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("freeze_battle_combatants").executes(c -> {
|
||||
TextComponent response = new TextComponent("freeze_battle_combatants requires a boolean argument. ");
|
||||
TextComponent subResponse = new TextComponent("freeze_battle_combatants is currently: ");
|
||||
response.append(subResponse);
|
||||
subResponse = new TextComponent(String.valueOf(
|
||||
MutableComponent response = Component.literal("freeze_battle_combatants requires a boolean argument. ");
|
||||
MutableComponent subResponse = Component.literal("freeze_battle_combatants is currently: ");
|
||||
response.getSiblings().add(subResponse);
|
||||
subResponse = Component.literal(String.valueOf(
|
||||
!TurnBasedMinecraftMod.proxy.getConfig().isFreezeCombatantsEnabled()));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, false);
|
||||
return 1;
|
||||
})
|
||||
|
@ -974,34 +975,34 @@ public class TurnBasedMinecraftMod {
|
|||
if (!TurnBasedMinecraftMod.proxy.getConfig().updateConfig("server_config.freeze_battle_combatants", enabled)) {
|
||||
TurnBasedMinecraftMod.logger.warn(
|
||||
"Failed to set \"server_config.freeze_battle_combatants\" in config file!");
|
||||
c.getSource().sendFailure(new TextComponent(
|
||||
c.getSource().sendFailure(Component.literal(
|
||||
"Failed to set freeze_battle_combatants to \""
|
||||
+ enabled
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
TextComponent response = new TextComponent("Successfully set freeze_battle_combatants to: ");
|
||||
TextComponent subResponse = new TextComponent(String.valueOf(enabled));
|
||||
MutableComponent response = Component.literal("Successfully set freeze_battle_combatants to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(enabled));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("ignore_battle_types").executes(c -> {
|
||||
TextComponent response = new TextComponent("Use ");
|
||||
TextComponent subResponse = new TextComponent("/tbm-server-edit ignore_battle_types add/remove <category> ");
|
||||
MutableComponent response = Component.literal("Use ");
|
||||
MutableComponent subResponse = Component.literal("/tbm-server-edit ignore_battle_types add/remove <category> ");
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
|
||||
subResponse = new TextComponent("ignore_battle_types is currently: [");
|
||||
response.append(subResponse);
|
||||
subResponse = Component.literal("ignore_battle_types is currently: [");
|
||||
response.getSiblings().add(subResponse);
|
||||
|
||||
boolean isFirst = true;
|
||||
for (String category : TurnBasedMinecraftMod.proxy.getConfig().getIgnoreBattleTypes()) {
|
||||
if (!isFirst) {
|
||||
response.append(new TextComponent(", "));
|
||||
response.getSiblings().add(Component.literal(", "));
|
||||
}
|
||||
subResponse = new TextComponent(category);
|
||||
subResponse = Component.literal(category);
|
||||
subResponse.setStyle(subResponse.getStyle()
|
||||
.withColor(ChatFormatting.GREEN)
|
||||
.withClickEvent(new ClickEvent(
|
||||
|
@ -1009,69 +1010,69 @@ public class TurnBasedMinecraftMod {
|
|||
"/tbm-server-edit ignore_battle_types remove " + category))
|
||||
.withHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new TextComponent("Click to remove category"))));
|
||||
response.append(subResponse);
|
||||
Component.literal("Click to remove category"))));
|
||||
response.getSiblings().add(subResponse);
|
||||
isFirst = false;
|
||||
}
|
||||
response.append(new TextComponent("] "));
|
||||
response.getSiblings().add(Component.literal("] "));
|
||||
c.getSource().sendSuccess(response, false);
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.literal("add").executes(c -> {
|
||||
c.getSource().sendFailure(new TextComponent("/tbm-server-edit ignore_battle_types add <category>"));
|
||||
c.getSource().sendFailure(Component.literal("/tbm-server-edit ignore_battle_types add <category>"));
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("category", StringArgumentType.greedyString()).executes(c -> {
|
||||
String category = StringArgumentType.getString(c, "category");
|
||||
if (TurnBasedMinecraftMod.proxy.getConfig().addIgnoreBattleType(category)
|
||||
&& TurnBasedMinecraftMod.proxy.getConfig().updateConfigAppendToStringArray("server_config.ignore_battle_types", category)) {
|
||||
TextComponent response = new TextComponent("Successfully appended category \"");
|
||||
MutableComponent response = Component.literal("Successfully appended category \"");
|
||||
|
||||
TextComponent sub = new TextComponent(category);
|
||||
MutableComponent sub = Component.literal(category);
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(sub);
|
||||
response.getSiblings().add(sub);
|
||||
|
||||
sub = new TextComponent("\" to ignore_battle_types");
|
||||
response.append(sub);
|
||||
sub = Component.literal("\" to ignore_battle_types");
|
||||
response.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
c.getSource().sendFailure(new TextComponent(
|
||||
c.getSource().sendFailure(Component.literal(
|
||||
"Failed to append category \"" + category + "\" to ignore_battle_types"));
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("remove").executes(c -> {
|
||||
c.getSource().sendFailure(new TextComponent("/tbm-server-edit ignore_battle_types remove <category>"));
|
||||
c.getSource().sendFailure(Component.literal("/tbm-server-edit ignore_battle_types remove <category>"));
|
||||
return 1;
|
||||
})
|
||||
.then(Commands.argument("category", StringArgumentType.greedyString()).executes(c -> {
|
||||
String category = StringArgumentType.getString(c, "category");
|
||||
if (TurnBasedMinecraftMod.proxy.getConfig().removeIgnoreBattleType(category)
|
||||
&& TurnBasedMinecraftMod.proxy.getConfig().updateConfigRemoveFromStringArray("server_config.ignore_battle_types", category)) {
|
||||
TextComponent response = new TextComponent("Successfully removed category \"");
|
||||
MutableComponent response = Component.literal("Successfully removed category \"");
|
||||
|
||||
TextComponent sub = new TextComponent(category);
|
||||
MutableComponent sub = Component.literal(category);
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(sub);
|
||||
response.getSiblings().add(sub);
|
||||
|
||||
sub = new TextComponent("\" from ignore_battle_types");
|
||||
response.append(sub);
|
||||
sub = Component.literal("\" from ignore_battle_types");
|
||||
response.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(response, true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
c.getSource().sendFailure(new TextComponent(
|
||||
c.getSource().sendFailure(Component.literal(
|
||||
"Failed to remove category \"" + category + "\" to ignore_battle_types"));
|
||||
return 1;
|
||||
}))))
|
||||
.then(Commands.literal("player_speed").executes(c -> {
|
||||
TextComponent parent = new TextComponent("Use ");
|
||||
TextComponent sub = new TextComponent("/tbm-server-edit player_speed <0-100>");
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit player_speed <0-100>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.append(sub);
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return 1;
|
||||
|
@ -1084,24 +1085,24 @@ public class TurnBasedMinecraftMod {
|
|||
if (!TurnBasedMinecraftMod.proxy.getConfig().updateConfig("server_config.player_speed", speed)) {
|
||||
TurnBasedMinecraftMod.logger.warn(
|
||||
"Failed to set \"server_config.player_speed\" in config file!");
|
||||
c.getSource().sendFailure(new TextComponent(
|
||||
c.getSource().sendFailure(Component.literal(
|
||||
"Failed to set player_speed to \""
|
||||
+ speed
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
TextComponent response = new TextComponent("Successfully set player_speed to: ");
|
||||
TextComponent subResponse = new TextComponent(String.valueOf(speed));
|
||||
MutableComponent response = Component.literal("Successfully set player_speed to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(speed));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("player_haste_speed").executes(c -> {
|
||||
TextComponent parent = new TextComponent("Use ");
|
||||
TextComponent sub = new TextComponent("/tbm-server-edit player_haste_speed <0-100>");
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit player_haste_speed <0-100>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.append(sub);
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return 1;
|
||||
|
@ -1114,24 +1115,24 @@ public class TurnBasedMinecraftMod {
|
|||
if (!TurnBasedMinecraftMod.proxy.getConfig().updateConfig("server_config.player_haste_speed", haste_speed)) {
|
||||
TurnBasedMinecraftMod.logger.warn(
|
||||
"Failed to set \"server_config.player_haste_speed\" in config file!");
|
||||
c.getSource().sendFailure(new TextComponent(
|
||||
c.getSource().sendFailure(Component.literal(
|
||||
"Failed to set player_haste_speed to \""
|
||||
+ haste_speed
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
TextComponent response = new TextComponent("Successfully set player_haste_speed to: ");
|
||||
TextComponent subResponse = new TextComponent(String.valueOf(haste_speed));
|
||||
MutableComponent response = Component.literal("Successfully set player_haste_speed to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(haste_speed));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("player_slow_speed").executes(c -> {
|
||||
TextComponent parent = new TextComponent("Use ");
|
||||
TextComponent sub = new TextComponent("/tbm-server-edit player_slow_speed <0-100>");
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit player_slow_speed <0-100>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.append(sub);
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return 1;
|
||||
|
@ -1144,24 +1145,24 @@ public class TurnBasedMinecraftMod {
|
|||
if (!TurnBasedMinecraftMod.proxy.getConfig().updateConfig("server_config.player_slow_speed", slow_speed)) {
|
||||
TurnBasedMinecraftMod.logger.warn(
|
||||
"Failed to set \"server_config.player_slow_speed\" in config file!");
|
||||
c.getSource().sendFailure(new TextComponent(
|
||||
c.getSource().sendFailure(Component.literal(
|
||||
"Failed to set player_slow_speed to \""
|
||||
+ slow_speed
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
TextComponent response = new TextComponent("Successfully set player_slow_speed to: ");
|
||||
TextComponent subResponse = new TextComponent(String.valueOf(slow_speed));
|
||||
MutableComponent response = Component.literal("Successfully set player_slow_speed to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(slow_speed));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("player_attack_probability").executes(c -> {
|
||||
TextComponent parent = new TextComponent("Use ");
|
||||
TextComponent sub = new TextComponent("/tbm-server-edit player_attack_probability <1-100>");
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit player_attack_probability <1-100>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.append(sub);
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return 1;
|
||||
|
@ -1174,24 +1175,24 @@ public class TurnBasedMinecraftMod {
|
|||
if (!TurnBasedMinecraftMod.proxy.getConfig().updateConfig("server_config.player_attack_probability", probability)) {
|
||||
TurnBasedMinecraftMod.logger.warn(
|
||||
"Failed to set \"server_config.player_attack_probability\" in config file!");
|
||||
c.getSource().sendFailure(new TextComponent(
|
||||
c.getSource().sendFailure(Component.literal(
|
||||
"Failed to set player_attack_probability to \""
|
||||
+ probability
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
TextComponent response = new TextComponent("Successfully set player_attack_probability to: ");
|
||||
TextComponent subResponse = new TextComponent(String.valueOf(probability));
|
||||
MutableComponent response = Component.literal("Successfully set player_attack_probability to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(probability));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("player_evasion").executes(c -> {
|
||||
TextComponent parent = new TextComponent("Use ");
|
||||
TextComponent sub = new TextComponent("/tbm-server-edit player_evasion <0-100>");
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit player_evasion <0-100>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.append(sub);
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return 1;
|
||||
|
@ -1204,24 +1205,24 @@ public class TurnBasedMinecraftMod {
|
|||
if (!TurnBasedMinecraftMod.proxy.getConfig().updateConfig("server_config.player_evasion", evasion)) {
|
||||
TurnBasedMinecraftMod.logger.warn(
|
||||
"Failed to set \"server_config.player_evasion\" in config file!");
|
||||
c.getSource().sendFailure(new TextComponent(
|
||||
c.getSource().sendFailure(Component.literal(
|
||||
"Failed to set player_evasion to \""
|
||||
+ evasion
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
TextComponent response = new TextComponent("Successfully set player_evasion to: ");
|
||||
TextComponent subResponse = new TextComponent(String.valueOf(evasion));
|
||||
MutableComponent response = Component.literal("Successfully set player_evasion to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(evasion));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("defense_duration").executes(c -> {
|
||||
TextComponent parent = new TextComponent("Use ");
|
||||
TextComponent sub = new TextComponent("/tbm-server-edit defense_duration <0-5>");
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit defense_duration <0-5>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.append(sub);
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return 1;
|
||||
|
@ -1234,24 +1235,24 @@ public class TurnBasedMinecraftMod {
|
|||
if (!TurnBasedMinecraftMod.proxy.getConfig().updateConfig("server_config.defense_duration", defends)) {
|
||||
TurnBasedMinecraftMod.logger.warn(
|
||||
"Failed to set \"server_config.defense_duration\" in config file!");
|
||||
c.getSource().sendFailure(new TextComponent(
|
||||
c.getSource().sendFailure(Component.literal(
|
||||
"Failed to set defense_druation to \""
|
||||
+ defends
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
TextComponent response = new TextComponent("Successfully set defense_duration to: ");
|
||||
TextComponent subResponse = new TextComponent(String.valueOf(defends));
|
||||
MutableComponent response = Component.literal("Successfully set defense_duration to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(defends));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("flee_good_probability").executes(c -> {
|
||||
TextComponent parent = new TextComponent("Use ");
|
||||
TextComponent sub = new TextComponent("/tbm-server-edit flee_good_probability <1-100>");
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit flee_good_probability <1-100>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.append(sub);
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return 1;
|
||||
|
@ -1264,24 +1265,24 @@ public class TurnBasedMinecraftMod {
|
|||
if (!TurnBasedMinecraftMod.proxy.getConfig().updateConfig("server_config.flee_good_probability", probability)) {
|
||||
TurnBasedMinecraftMod.logger.warn(
|
||||
"Failed to set \"server_config.flee_good_probability\" in config file!");
|
||||
c.getSource().sendFailure(new TextComponent(
|
||||
c.getSource().sendFailure(Component.literal(
|
||||
"Failed to set flee_good_probability to \""
|
||||
+ probability
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
TextComponent response = new TextComponent("Successfully set flee_good_probability to: ");
|
||||
TextComponent subResponse = new TextComponent(String.valueOf(probability));
|
||||
MutableComponent response = Component.literal("Successfully set flee_good_probability to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(probability));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("flee_bad_probability").executes(c -> {
|
||||
TextComponent parent = new TextComponent("Use ");
|
||||
TextComponent sub = new TextComponent("/tbm-server-edit flee_bad_probability <1-100>");
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit flee_bad_probability <1-100>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.append(sub);
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return 1;
|
||||
|
@ -1294,24 +1295,24 @@ public class TurnBasedMinecraftMod {
|
|||
if (!TurnBasedMinecraftMod.proxy.getConfig().updateConfig("server_config.flee_bad_probability", probability)) {
|
||||
TurnBasedMinecraftMod.logger.warn(
|
||||
"Failed to set \"server_config.flee_bad_probability\" in config file!");
|
||||
c.getSource().sendFailure(new TextComponent(
|
||||
c.getSource().sendFailure(Component.literal(
|
||||
"Failed to set flee_bad_probability to \""
|
||||
+ probability
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
TextComponent response = new TextComponent("Successfully set flee_bad_probability to: ");
|
||||
TextComponent subResponse = new TextComponent(String.valueOf(probability));
|
||||
MutableComponent response = Component.literal("Successfully set flee_bad_probability to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(probability));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("minimum_hit_percentage").executes(c -> {
|
||||
TextComponent parent = new TextComponent("Use ");
|
||||
TextComponent sub = new TextComponent("/tbm-server-edit minimum_hit_percentage <1-100>");
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit minimum_hit_percentage <1-100>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.append(sub);
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return 1;
|
||||
|
@ -1324,24 +1325,24 @@ public class TurnBasedMinecraftMod {
|
|||
if (!TurnBasedMinecraftMod.proxy.getConfig().updateConfig("server_config.minimum_hit_percentage", percentage)) {
|
||||
TurnBasedMinecraftMod.logger.warn(
|
||||
"Failed to set \"server_config.minimum_hit_percentage\" in config file!");
|
||||
c.getSource().sendFailure(new TextComponent(
|
||||
c.getSource().sendFailure(Component.literal(
|
||||
"Failed to set minimum_hit_percentage to \""
|
||||
+ percentage
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
TextComponent response = new TextComponent("Successfully set minimum_hit_percentage to: ");
|
||||
TextComponent subResponse = new TextComponent(String.valueOf(percentage));
|
||||
MutableComponent response = Component.literal("Successfully set minimum_hit_percentage to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(percentage));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("battle_turn_wait_forever").executes(c -> {
|
||||
TextComponent parent = new TextComponent("Use ");
|
||||
TextComponent sub = new TextComponent("/tbm-server-edit battle_turn_wait_forever <true/false>");
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit battle_turn_wait_forever <true/false>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.append(sub);
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return 1;
|
||||
|
@ -1353,21 +1354,21 @@ public class TurnBasedMinecraftMod {
|
|||
TurnBasedMinecraftMod.logger.warn(
|
||||
"Failed to set \"server_config.battle_turn_wait_forever\" in config file!"
|
||||
);
|
||||
c.getSource().sendFailure(new TextComponent("Failed to set battle_turn_wait_forever to \"" + (enabled ? "true" : "false") + "\" in config file!"));
|
||||
c.getSource().sendFailure(Component.literal("Failed to set battle_turn_wait_forever to \"" + (enabled ? "true" : "false") + "\" in config file!"));
|
||||
} else {
|
||||
TextComponent response = new TextComponent("Successfully set battle_turn_wait_forever to: ");
|
||||
TextComponent subResponse = new TextComponent((enabled ? "true" : "false"));
|
||||
MutableComponent response = Component.literal("Successfully set battle_turn_wait_forever to: ");
|
||||
MutableComponent subResponse = Component.literal((enabled ? "true" : "false"));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("battle_turn_time_seconds").executes(c -> {
|
||||
TextComponent parent = new TextComponent("Use ");
|
||||
TextComponent sub = new TextComponent("/tbm-server-edit battle_turn_time_seconds <5-60>");
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit battle_turn_time_seconds <5-60>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.append(sub);
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return 1;
|
||||
|
@ -1380,24 +1381,24 @@ public class TurnBasedMinecraftMod {
|
|||
if (!TurnBasedMinecraftMod.proxy.getConfig().updateConfig("server_config.battle_turn_time_seconds", seconds)) {
|
||||
TurnBasedMinecraftMod.logger.warn(
|
||||
"Failed to set \"server_config.battle_turn_time_seconds\" in config file!");
|
||||
c.getSource().sendFailure(new TextComponent(
|
||||
c.getSource().sendFailure(Component.literal(
|
||||
"Failed to set battle_turn_time_seconds to \""
|
||||
+ seconds
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
TextComponent response = new TextComponent("Successfully set battle_turn_time_seconds to: ");
|
||||
TextComponent subResponse = new TextComponent(String.valueOf(seconds));
|
||||
MutableComponent response = Component.literal("Successfully set battle_turn_time_seconds to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(seconds));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("creeper_explode_turn").executes(c -> {
|
||||
TextComponent parent = new TextComponent("Use ");
|
||||
TextComponent sub = new TextComponent("/tbm-server-edit creeper_explode_turn <1-10>");
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit creeper_explode_turn <1-10>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.append(sub);
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return 1;
|
||||
|
@ -1410,24 +1411,24 @@ public class TurnBasedMinecraftMod {
|
|||
if (!TurnBasedMinecraftMod.proxy.getConfig().updateConfig("server_config.creeper_explode_turn", turns)) {
|
||||
TurnBasedMinecraftMod.logger.warn(
|
||||
"Failed to set \"server_config.creeper_explode_turn\" in config file!");
|
||||
c.getSource().sendFailure(new TextComponent(
|
||||
c.getSource().sendFailure(Component.literal(
|
||||
"Failed to set creeper_explode_turn to \""
|
||||
+ turns
|
||||
+ "\" in config file!"));
|
||||
} else {
|
||||
TextComponent response = new TextComponent("Successfully set creeper_explode_turn to: ");
|
||||
TextComponent subResponse = new TextComponent(String.valueOf(turns));
|
||||
MutableComponent response = Component.literal("Successfully set creeper_explode_turn to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(turns));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("creeper_stop_explode_on_leave_battle").executes(c -> {
|
||||
TextComponent parent = new TextComponent("Use ");
|
||||
TextComponent sub = new TextComponent("/tbm-server-edit creeper_stop_explode_on_leave_battle <true/false>");
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit creeper_stop_explode_on_leave_battle <true/false>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.append(sub);
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return 1;
|
||||
|
@ -1439,25 +1440,25 @@ public class TurnBasedMinecraftMod {
|
|||
TurnBasedMinecraftMod.logger.warn(
|
||||
"Failed to set \"server_config.creeper_stop_explode_on_leave_battle\" in config file!"
|
||||
);
|
||||
c.getSource().sendFailure(new TextComponent(
|
||||
c.getSource().sendFailure(Component.literal(
|
||||
"Failed to set creeper_stop_explode_on_leave_battle to \""
|
||||
+ stop_explode_on_leave
|
||||
+ "\" in config file!"
|
||||
));
|
||||
} else {
|
||||
TextComponent response = new TextComponent("Successfully set creeper_stop_explode_on_leave_battle to: ");
|
||||
TextComponent subResponse = new TextComponent(String.valueOf(stop_explode_on_leave));
|
||||
MutableComponent response = Component.literal("Successfully set creeper_stop_explode_on_leave_battle to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(stop_explode_on_leave));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
}
|
||||
return 1;
|
||||
})))
|
||||
.then(Commands.literal("creeper_always_allow_damage").executes(c -> {
|
||||
TextComponent parent = new TextComponent("Use ");
|
||||
TextComponent sub = new TextComponent("/tbm-server-edit creeper_always_allow_damage <true/false>");
|
||||
MutableComponent parent = Component.literal("Use ");
|
||||
MutableComponent sub = Component.literal("/tbm-server-edit creeper_always_allow_damage <true/false>");
|
||||
sub.setStyle(sub.getStyle().withColor(ChatFormatting.YELLOW));
|
||||
parent.append(sub);
|
||||
parent.getSiblings().add(sub);
|
||||
|
||||
c.getSource().sendSuccess(parent, false);
|
||||
return 1;
|
||||
|
@ -1469,16 +1470,16 @@ public class TurnBasedMinecraftMod {
|
|||
TurnBasedMinecraftMod.logger.warn(
|
||||
"Failed to set \"server_config.creeper_always_allow_damage\" in config file!"
|
||||
);
|
||||
c.getSource().sendFailure(new TextComponent(
|
||||
c.getSource().sendFailure(Component.literal(
|
||||
"Failed to set creeper_always_allow_damage to \""
|
||||
+ allow_damage
|
||||
+ "\" in config file!"
|
||||
));
|
||||
} else {
|
||||
TextComponent response = new TextComponent("Successfully set creeper_always_allow_damage to: ");
|
||||
TextComponent subResponse = new TextComponent(String.valueOf(allow_damage));
|
||||
MutableComponent response = Component.literal("Successfully set creeper_always_allow_damage to: ");
|
||||
MutableComponent subResponse = Component.literal(String.valueOf(allow_damage));
|
||||
subResponse.setStyle(subResponse.getStyle().withColor(ChatFormatting.GREEN));
|
||||
response.append(subResponse);
|
||||
response.getSiblings().add(subResponse);
|
||||
c.getSource().sendSuccess(response, true);
|
||||
}
|
||||
return 1;
|
||||
|
|
|
@ -55,7 +55,7 @@ public class Utility
|
|||
}
|
||||
|
||||
public static String serializeDimension(ResourceKey<Level> dimObject) {
|
||||
return dimObject.getRegistryName().toString();
|
||||
return dimObject.registry().toString();
|
||||
}
|
||||
|
||||
public static ResourceKey<Level> deserializeDimension(String dimString) {
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.function.Supplier;
|
|||
import com.burnedkirby.TurnBasedMinecraft.common.Battle;
|
||||
import com.burnedkirby.TurnBasedMinecraft.common.TurnBasedMinecraftMod;
|
||||
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraftforge.network.NetworkEvent;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ license="MIT"
|
|||
# The modid of the mod
|
||||
modId="com_burnedkirby_turnbasedminecraft" #mandatory
|
||||
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
|
||||
version="1.18.7" #mandatory
|
||||
version="1.19.0" #mandatory
|
||||
# A display name for the mod
|
||||
displayName="TurnBasedMinecraftMod" #mandatory
|
||||
# A URL to query for updates for this mod. See the JSON update specification <here>
|
||||
|
@ -48,6 +48,6 @@ Implements turn-based-battle in Minecraft.
|
|||
[[dependencies.com_burnedkirby_turnbasedminecraft]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
versionRange="[1.18.2,1.19)"
|
||||
versionRange="[1.19,1.20)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Please do not change this option, the mod uses this to keep track of what new
|
||||
# changes to add to the config.
|
||||
version = 7
|
||||
version = 8
|
||||
do_not_overwrite = false
|
||||
|
||||
[client_config]
|
||||
|
@ -446,6 +446,18 @@ decision_attack_probability = 100
|
|||
decision_defend_probability = 0
|
||||
decision_flee_probability = 0
|
||||
|
||||
[[server_config.entity]]
|
||||
name = "net.minecraft.world.entity.monster.warden.Warden"
|
||||
attack_power = 28
|
||||
attack_probability = 65
|
||||
attack_variance = 10
|
||||
evasion = 7
|
||||
category = "monster"
|
||||
speed = 50
|
||||
decision_attack_probability = 95
|
||||
decision_defend_probability = 0
|
||||
decision_flee_probability = 0
|
||||
|
||||
[[server_config.entity]]
|
||||
name = "net.minecraft.world.entity.monster.Witch"
|
||||
attack_power = 5
|
||||
|
@ -516,6 +528,17 @@ decision_attack_probability = 100
|
|||
decision_defend_probability = 0
|
||||
decision_flee_probability = 0
|
||||
|
||||
[[server_config.entity]]
|
||||
name = "net.minecraft.world.entity.animal.allay.Allay"
|
||||
attack_power = 0
|
||||
attack_probability = 50
|
||||
evasion = 40
|
||||
category = "passive"
|
||||
speed = 50
|
||||
decision_attack_probability = 0
|
||||
decision_defend_probability = 0
|
||||
decision_flee_probability = 100
|
||||
|
||||
[[server_config.entity]]
|
||||
name = "net.minecraft.world.entity.animal.axolotl.Axolotl"
|
||||
attack_power = 2
|
||||
|
@ -608,6 +631,28 @@ decision_attack_probability = 70
|
|||
decision_defend_probability = 0
|
||||
decision_flee_probability = 25
|
||||
|
||||
[[server_config.entity]]
|
||||
name = "net.minecraft.world.entity.animal.frog.Frog"
|
||||
attack_power = 2
|
||||
attack_probability = 50
|
||||
evasion = 60
|
||||
category = "animal"
|
||||
speed = 70
|
||||
decision_attack_probability = 0
|
||||
decision_defend_probability = 0
|
||||
decision_flee_probability = 100
|
||||
|
||||
[[server_config.entity]]
|
||||
name = "net.minecraft.world.entity.animal.frog.Tadpole"
|
||||
attack_power = 0
|
||||
attack_probability = 0
|
||||
evasion = 45
|
||||
category = "animal"
|
||||
speed = 50
|
||||
decision_attack_probability = 0
|
||||
decision_defend_probability = 0
|
||||
decision_flee_probability = 100
|
||||
|
||||
[[server_config.entity]]
|
||||
name = "net.minecraft.world.entity.animal.horse.Donkey"
|
||||
attack_power = 0
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"modid": "com_burnedkirby_turnbasedminecraft",
|
||||
"name": "Turn Based Minecraft",
|
||||
"description": "Changes battles to be turn-based.",
|
||||
"version": "1.18.7",
|
||||
"version": "1.19.0",
|
||||
"mcversion": "1.18.2",
|
||||
"url": "",
|
||||
"updateUrl": "",
|
||||
|
|
Loading…
Reference in a new issue