Skip to content

Commit

Permalink
🎨 fuc name
Browse files Browse the repository at this point in the history
  • Loading branch information
kitUIN committed Dec 2, 2024
1 parent 508fdf5 commit 78d9211
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 72 deletions.
1 change: 1 addition & 0 deletions .idea/ModAliasState.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void onInitializeClient() {
));
ClientTickEvents.END_CLIENT_TICK.register(client -> {
while (configKeyBinding.wasPressed()) {
setScreen(client,new ConfigScreen());
setScreen(client, new ConfigScreen());
}
});
// IF fabric-1.16.5 || fabric-1.18.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import static io.github.kituin.ChatImageCode.ChatImageCodeInstance.LOGGER;
import static io.github.kituin.chatimage.client.ChatImageClient.CONFIG;
import static io.github.kituin.chatimage.tool.SimpleUtil.createTranslatableText;
import static io.github.kituin.chatimage.tool.SimpleUtil.createTranslatableComponent;

public class ChatImageCommand {
public static int sendChatImage(CommandContext<FabricClientCommandSource> context) {
Expand Down Expand Up @@ -51,7 +51,7 @@ public static int help(CommandContext<FabricClientCommandSource> context) {

public static int reloadConfig(CommandContext<FabricClientCommandSource> context) {
CONFIG = ChatImageConfig.loadConfig();
context.getSource().sendFeedback(createTranslatableText("success.reload.chatimage.command").setStyle(Style.EMPTY.withColor(Formatting.GREEN)));
context.getSource().sendFeedback(createTranslatableComponent("success.reload.chatimage.command").setStyle(Style.EMPTY.withColor(Formatting.GREEN)));
return Command.SINGLE_SUCCESS;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
// IF <= fabric-1.19.2
//public class ConfigScreen extends ConfigRawScreen {
// public ConfigScreen(Screen screen) {
// super(createTranslatableText("config.chatimage.category"), screen);
// super(createTranslatableComponent("config.chatimage.category"), screen);
// }
// ELSE
//public class ConfigScreen extends Screen {
// private final Screen parent;
//
// public ConfigScreen(Screen screen) {
// super(createTranslatableText("config.chatimage.category"));
// super(createTranslatableComponent("config.chatimage.category"));
// parent = screen;
// }
// END IF
Expand All @@ -50,12 +50,12 @@ public ConfigScreen() {
//IF <= fabric-1.19.4
// public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
// super.render(matrices, mouseX, mouseY, delta);
// #drawCenteredTextWithShadow#(matrices, this.textRenderer, createTranslatableText("nsfw.chatimage.warning"), this.width / 2, 110, 16764108);
// #drawCenteredTextWithShadow#(matrices, this.textRenderer, createTranslatableComponent("nsfw.chatimage.warning"), this.width / 2, 110, 16764108);
// }
// ELSE
// public void render(DrawContext matrices, int mouseX, int mouseY, float delta) {
// super.render(matrices, mouseX, mouseY, delta);
// matrices.#drawCenteredTextWithShadow#(this.textRenderer, createTranslatableText("nsfw.chatimage.warning"), this.width / 2, 110, 16764108);
// matrices.#drawCenteredTextWithShadow#(this.textRenderer, createTranslatableComponent("nsfw.chatimage.warning"), this.width / 2, 110, 16764108);
// }
// END IF
// IF >= fabric-1.19.3
Expand Down Expand Up @@ -104,30 +104,30 @@ public ConfigScreen() {
// CONFIG.nsfw = !CONFIG.nsfw;
// button.setMessage(getNsfw(CONFIG.nsfw));
// ChatImageConfig.saveConfig(CONFIG);
// }, getButtonTooltip(createTranslatableText("nsfw.chatimage.tooltip"))));
// addDrawableWeight(new GifSlider(this.width / 2 + 4, this.height / 4 + 24 + -16, 150, 20, getSliderTooltip(createTranslatableText("gif.chatimage.tooltip"))));
// addDrawableWeight(new TimeOutSlider(this.width / 2 - 154, this.height / 4 + 48 + -16, 150, 20, getSliderTooltip(createTranslatableText("timeout.chatimage.tooltip"))));
// addDrawableWeight(new ButtonWidget(this.width / 2 + 4, this.height / 4 + 48 + -16, 150, 20, createTranslatableText("padding.chatimage.gui"), (button) -> {
// }, getButtonTooltip(createTranslatableComponent("nsfw.chatimage.tooltip"))));
// addDrawableWeight(new GifSlider(this.width / 2 + 4, this.height / 4 + 24 + -16, 150, 20, getSliderTooltip(createTranslatableComponent("gif.chatimage.tooltip"))));
// addDrawableWeight(new TimeOutSlider(this.width / 2 - 154, this.height / 4 + 48 + -16, 150, 20, getSliderTooltip(createTranslatableComponent("timeout.chatimage.tooltip"))));
// addDrawableWeight(new ButtonWidget(this.width / 2 + 4, this.height / 4 + 48 + -16, 150, 20, createTranslatableComponent("padding.chatimage.gui"), (button) -> {
// if (this.client != null) {
// setScreen(this.client, new LimitPaddingScreen(this));
// }
// }, getButtonTooltip(createTranslatableText("padding.chatimage.tooltip"))));
// }, getButtonTooltip(createTranslatableComponent("padding.chatimage.tooltip"))));
// addDrawableWeight(new ButtonWidget(this.width / 2 - 154, this.height / 4 + 72 - 16, 150, 20, getCq(CONFIG.cqCode), (button) -> {
// CONFIG.cqCode = !CONFIG.cqCode;
// button.setMessage(getCq(CONFIG.cqCode));
// ChatImageConfig.saveConfig(CONFIG);
// }, getButtonTooltip(createTranslatableText("cq.chatimage.tooltip"))));
// }, getButtonTooltip(createTranslatableComponent("cq.chatimage.tooltip"))));
// addDrawableWeight(new ButtonWidget(this.width / 2 + 4, this.height / 4 + 72 - 16, 150, 20, getDrag(CONFIG.dragUseCicode), (button) -> {
// CONFIG.dragUseCicode = !CONFIG.dragUseCicode;
// button.setMessage(getDrag(CONFIG.dragUseCicode));
// ChatImageConfig.saveConfig(CONFIG);
// }, getButtonTooltip(createTranslatableText("drag.chatimage.tooltip"))));
// }, getButtonTooltip(createTranslatableComponent("drag.chatimage.tooltip"))));
// addDrawableWeight(new ButtonWidget(this.width / 2 - 154, this.height / 4 + 96 - 16, 150, 20, getUri(CONFIG.checkImageUri), (button) -> {
// CONFIG.checkImageUri = !CONFIG.checkImageUri;
// button.setMessage(getUri(CONFIG.checkImageUri));
// ChatImageConfig.saveConfig(CONFIG);
// }));
// addDrawableWeight(new ButtonWidget(this.width / 2 - 77, this.height / 4 + 120 + -16, 150, 20, createTranslatableText("gui.back"), (button) -> {
// addDrawableWeight(new ButtonWidget(this.width / 2 - 77, this.height / 4 + 120 + -16, 150, 20, createTranslatableComponent("gui.back"), (button) -> {
// if (this.client != null) {
// setScreen(this.client, this.parent);
// }
Expand Down Expand Up @@ -159,7 +159,7 @@ private MutableText getUri(boolean enable) {
}

public static MutableText getEnable(String key, boolean enable) {
return composeGenericOptionText(createTranslatableText(key), createTranslatableText((enable ? "open" : "close") + ".chatimage.common"));
return composeGenericOptionText(createTranslatableComponent(key), createTranslatableComponent((enable ? "open" : "close") + ".chatimage.common"));
}

// IF fabric-1.16.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public class ConfirmNsfwScreen extends ConfirmScreen {

public ConfirmNsfwScreen(BooleanConsumer callback, String link) {
this(callback, createTranslatableText("nsfw.chatimage.open"), createLiteralText(link));
this(callback, createTranslatableComponent("nsfw.chatimage.open"), createLiteralComponent(link));
}

public ConfirmNsfwScreen(BooleanConsumer callback, Text title, Text message) {
Expand Down Expand Up @@ -74,12 +74,12 @@ protected void addButtons(int y) {
//IF <= fabric-1.19.4
// public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
// super.render(matrices, mouseX, mouseY, delta);
// #drawCenteredTextWithShadow#(matrices, this.textRenderer, createTranslatableText("nsfw.chatimage.warning"), this.width / 2, 110, 16764108);
// #drawCenteredTextWithShadow#(matrices, this.textRenderer, createTranslatableComponent("nsfw.chatimage.warning"), this.width / 2, 110, 16764108);
// }
// ELSE
// public void render(DrawContext matrices, int mouseX, int mouseY, float delta) {
// super.render(matrices, mouseX, mouseY, delta);
// matrices.#drawCenteredTextWithShadow#(this.textRenderer, createTranslatableText("nsfw.chatimage.warning"), this.width / 2, 110, 16764108);
// matrices.#drawCenteredTextWithShadow#(this.textRenderer, createTranslatableComponent("nsfw.chatimage.warning"), this.width / 2, 110, 16764108);
// }
// END IF
// IF fabric-1.16.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@
// END IF
import net.minecraft.text.Text;

import static io.github.kituin.chatimage.tool.SimpleUtil.createTranslatableText;
import static io.github.kituin.chatimage.tool.SimpleUtil.createTranslatableComponent;
import static io.github.kituin.chatimage.tool.SimpleUtil.setScreen;
import static io.github.kituin.chatimage.widget.PaddingSlider.PaddingType.*;

@Environment(EnvType.CLIENT)
// IF fabric-1.16.5 || fabric-1.18.2 || fabric-1.19.1 || fabric-1.19.2
//public class LimitPaddingScreen extends ConfigRawScreen {
// public LimitPaddingScreen(Screen screen) {
// super(createTranslatableText("padding.chatimage.gui"), screen);
// super(createTranslatableComponent("padding.chatimage.gui"), screen);
// }
// ELSE
//public class LimitPaddingScreen extends Screen {
// private final Screen parent;
// public LimitPaddingScreen(Screen screen) {
// super(createTranslatableText("padding.chatimage.gui"));
// super(createTranslatableComponent("padding.chatimage.gui"));
// this.parent = screen;
// }
// END IF
Expand All @@ -52,31 +52,31 @@ protected void init() {
// IF fabric-1.16.5 || fabric-1.18.2 || fabric-1.19.1 || fabric-1.19.2
// addDrawableWeight(new PaddingSlider(
// this.width / 2 - 154, this.height / 4 + 24 + -16, 150, 20,
// createTranslatableText("left.padding.chatimage.gui"), ChatImageClient.CONFIG.paddingLeft,
// createTranslatableComponent("left.padding.chatimage.gui"), ChatImageClient.CONFIG.paddingLeft,
// (float) this.width / 2, LEFT, getSliderTooltip(getPaddingTooltipText(LEFT))));
// addDrawableWeight(new PaddingSlider(
// this.width / 2 + 4, this.height / 4 + 24 + -16, 150, 20,
// createTranslatableText("right.padding.chatimage.gui"), ChatImageClient.CONFIG.paddingRight,
// createTranslatableComponent("right.padding.chatimage.gui"), ChatImageClient.CONFIG.paddingRight,
// (float) this.width / 2, RIGHT, getSliderTooltip(getPaddingTooltipText(RIGHT))));
// addDrawableWeight(new PaddingSlider(
// this.width / 2 - 154, this.height / 4 + 48 + -16, 150, 20,
// createTranslatableText("top.padding.chatimage.gui"), ChatImageClient.CONFIG.paddingTop,
// createTranslatableComponent("top.padding.chatimage.gui"), ChatImageClient.CONFIG.paddingTop,
// (float) this.height / 2, TOP, getSliderTooltip(getPaddingTooltipText(TOP))));
// addDrawableWeight(new PaddingSlider(
// this.width / 2 + 4, this.height / 4 + 48 + -16, 150, 20,
// createTranslatableText("bottom.padding.chatimage.gui"), ChatImageClient.CONFIG.paddingBottom,
// createTranslatableComponent("bottom.padding.chatimage.gui"), ChatImageClient.CONFIG.paddingBottom,
// (float) this.height / 2, BOTTOM, getSliderTooltip(getPaddingTooltipText(BOTTOM))));
// addDrawableWeight(new LimitSlider(
// this.width / 2 - 154, this.height / 4 + 72 + -16, 150, 20,
// createTranslatableText("width.limit.chatimage.gui"), ChatImageClient.CONFIG.limitWidth,
// createTranslatableComponent("width.limit.chatimage.gui"), ChatImageClient.CONFIG.limitWidth,
// this.width, LimitSlider.LimitType.WIDTH, getSliderTooltip(getLimitTooltipText(LimitSlider.LimitType.WIDTH))));
// addDrawableWeight(new LimitSlider(
// this.width / 2 + 4, this.height / 4 + 72 + -16, 150, 20,
// createTranslatableText("height.limit.chatimage.gui"), ChatImageClient.CONFIG.limitHeight,
// createTranslatableComponent("height.limit.chatimage.gui"), ChatImageClient.CONFIG.limitHeight,
// this.height, LimitSlider.LimitType.HEIGHT, getSliderTooltip(getLimitTooltipText(LimitSlider.LimitType.HEIGHT))));
// addDrawableWeight(new ButtonWidget(
// this.width / 2 - 77, this.height / 4 + 96 + -16, 150, 20,
// createTranslatableText("gui.back"), (button) -> {
// createTranslatableComponent("gui.back"), (button) -> {
// if (this.client != null) {
// setScreen(this.client, this.parent);
// }
Expand All @@ -85,19 +85,19 @@ protected void init() {
// GridWidget gridWidget = new GridWidget();
// gridWidget.getMainPositioner().marginX(5).marginBottom(4).alignHorizontalCenter();
// GridWidget.Adder adder = gridWidget.createAdder(2);
// adder.add(new PaddingSlider(createTranslatableText("left.padding.chatimage.gui"),
// adder.add(new PaddingSlider(createTranslatableComponent("left.padding.chatimage.gui"),
// ChatImageClient.CONFIG.paddingLeft, 0F, (float) this.width / 2, PaddingSlider.PaddingType.LEFT));
// adder.add(new PaddingSlider(createTranslatableText("right.padding.chatimage.gui"),
// adder.add(new PaddingSlider(createTranslatableComponent("right.padding.chatimage.gui"),
// ChatImageClient.CONFIG.paddingRight, 0F, (float) this.width / 2, PaddingSlider.PaddingType.RIGHT));
// adder.add(new PaddingSlider(createTranslatableText("top.padding.chatimage.gui"),
// adder.add(new PaddingSlider(createTranslatableComponent("top.padding.chatimage.gui"),
// ChatImageClient.CONFIG.paddingTop, 0F, (float) this.height / 2, PaddingSlider.PaddingType.TOP));
// adder.add(new PaddingSlider(createTranslatableText("bottom.padding.chatimage.gui"),
// adder.add(new PaddingSlider(createTranslatableComponent("bottom.padding.chatimage.gui"),
// ChatImageClient.CONFIG.paddingBottom, 0F, (float) this.height / 2, PaddingSlider.PaddingType.BOTTOM));
// adder.add(new LimitSlider(createTranslatableText("width.limit.chatimage.gui"),
// adder.add(new LimitSlider(createTranslatableComponent("width.limit.chatimage.gui"),
// ChatImageClient.CONFIG.limitWidth, 1F, this.width, LimitSlider.LimitType.WIDTH));
// adder.add(new LimitSlider(createTranslatableText("height.limit.chatimage.gui"),
// adder.add(new LimitSlider(createTranslatableComponent("height.limit.chatimage.gui"),
// ChatImageClient.CONFIG.limitHeight, 1F, this.height, LimitSlider.LimitType.HEIGHT));
// adder.add(ButtonWidget.builder(createTranslatableText("gui.back"), (button) -> {
// adder.add(ButtonWidget.builder(createTranslatableComponent("gui.back"), (button) -> {
// if (this.client != null) {
// this.client.setScreen(this.parent);
// }
Expand All @@ -117,37 +117,37 @@ protected void init() {
//IF <= fabric-1.19.4
// public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
// super.render(matrices, mouseX, mouseY, delta);
// #drawCenteredTextWithShadow#(matrices, this.textRenderer, createTranslatableText("nsfw.chatimage.warning"), this.width / 2, 110, 16764108);
// #drawCenteredTextWithShadow#(matrices, this.textRenderer, createTranslatableComponent("nsfw.chatimage.warning"), this.width / 2, 110, 16764108);
// }
// ELSE
// public void render(DrawContext matrices, int mouseX, int mouseY, float delta) {
// super.render(matrices, mouseX, mouseY, delta);
// matrices.#drawCenteredTextWithShadow#(this.textRenderer, createTranslatableText("nsfw.chatimage.warning"), this.width / 2, 110, 16764108);
// matrices.#drawCenteredTextWithShadow#(this.textRenderer, createTranslatableComponent("nsfw.chatimage.warning"), this.width / 2, 110, 16764108);
// }
// END IF

// IF fabric-1.16.5 || fabric-1.18.2 || fabric-1.19.1 || fabric-1.19.2
// private Text getLimitTooltipText(LimitSlider.LimitType limitType) {
// if (limitType == LimitSlider.LimitType.WIDTH) {
// return createTranslatableText("width.limit.chatimage.tooltip");
// return createTranslatableComponent("width.limit.chatimage.tooltip");
// } else {
// return createTranslatableText("height.limit.chatimage.tooltip");
// return createTranslatableComponent("height.limit.chatimage.tooltip");
// }
// }
// private Text getPaddingTooltipText(PaddingSlider.PaddingType paddingType) {
// Text text;
// switch (paddingType) {
// case TOP:
// text = createTranslatableText("top.padding.chatimage.tooltip");
// text = createTranslatableComponent("top.padding.chatimage.tooltip");
// break;
// case BOTTOM:
// text = createTranslatableText("bottom.padding.chatimage.tooltip");
// text = createTranslatableComponent("bottom.padding.chatimage.tooltip");
// break;
// case LEFT:
// text = createTranslatableText("left.padding.chatimage.tooltip");
// text = createTranslatableComponent("left.padding.chatimage.tooltip");
// break;
// case RIGHT:
// text = createTranslatableText("right.padding.chatimage.tooltip");
// text = createTranslatableComponent("right.padding.chatimage.tooltip");
// break;
// default:
// return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import static io.github.kituin.chatimage.client.ChatImageClient.CONFIG;
import static io.github.kituin.chatimage.client.ChatImageClient.MOD_ID;
import static io.github.kituin.chatimage.network.ChatImagePacket.*;
import static io.github.kituin.chatimage.tool.SimpleUtil.createTranslatableText;
import static io.github.kituin.chatimage.tool.SimpleUtil.createTranslatableComponent;

public class ChatImageClientAdapter implements IClientAdapter {
@Override
Expand Down Expand Up @@ -67,7 +67,7 @@ public int getMaxFileSize() {

@Override
public Text getProcessMessage(int i) {
return createTranslatableText("process.chatimage.message", i);
return createTranslatableComponent("process.chatimage.message", i);
}


Expand Down
Loading

0 comments on commit 78d9211

Please sign in to comment.