make the relado config realoda core otr oto

This commit is contained in:
Chayapak 2023-06-26 21:09:54 +07:00
parent 535154a1a0
commit 9c99b9edcf
2 changed files with 7 additions and 1 deletions

View file

@ -4,6 +4,7 @@ import com.mojang.brigadier.Command;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.context.CommandContext;
import land.chipmunk.chipmunkmod.ChipmunkMod; import land.chipmunk.chipmunkmod.ChipmunkMod;
import land.chipmunk.chipmunkmod.modules.CommandCore;
import land.chipmunk.chipmunkmod.modules.CustomChat; import land.chipmunk.chipmunkmod.modules.CustomChat;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.text.Text; import net.minecraft.text.Text;
@ -27,6 +28,7 @@ public class ReloadConfigCommand {
ChipmunkMod.CONFIG = ChipmunkMod.loadConfig(); ChipmunkMod.CONFIG = ChipmunkMod.loadConfig();
CustomChat.INSTANCE.reloadFormat(); CustomChat.INSTANCE.reloadFormat();
CommandCore.INSTANCE.reloadRelativeArea();
source.sendFeedback(Text.literal("Successfully reloaded the config")); source.sendFeedback(Text.literal("Successfully reloaded the config"));
} catch (IOException e) { } catch (IOException e) {

View file

@ -20,7 +20,7 @@ public class CommandCore {
private final MinecraftClient client; private final MinecraftClient client;
@Getter @Setter private boolean ready = false; @Getter @Setter private boolean ready = false;
@Getter @Setter private BlockPos origin; @Getter @Setter private BlockPos origin;
@Getter private final BlockArea relativeArea; @Getter private BlockArea relativeArea;
@Getter @Setter private BlockPos currentBlockRelative; @Getter @Setter private BlockPos currentBlockRelative;
public static CommandCore INSTANCE = new CommandCore(MinecraftClient.getInstance(), ChipmunkMod.CONFIG.core.relativeArea); public static CommandCore INSTANCE = new CommandCore(MinecraftClient.getInstance(), ChipmunkMod.CONFIG.core.relativeArea);
@ -30,6 +30,10 @@ public class CommandCore {
this.relativeArea = relativeArea; this.relativeArea = relativeArea;
} }
public void reloadRelativeArea () {
relativeArea = ChipmunkMod.CONFIG.core.relativeArea;
}
public void move (Vec3d position) { public void move (Vec3d position) {
if (!ready) { if (!ready) {
ready = true; ready = true;