-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
89 additions
and
28 deletions.
There are no files selected for viewing
28 changes: 0 additions & 28 deletions
28
forge/forge-1.16.5/src/main/java/io/github/kituin/chatimage/widget/LimitSliderUpdate.java
This file was deleted.
Oops, something went wrong.
89 changes: 89 additions & 0 deletions
89
forge/origin/src/main/java/io/github/kituin/chatimage/widget/LimitSlider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package io.github.kituin.chatimage.widget; | ||
|
||
import io.github.kituin.ChatImageCode.ChatImageConfig; | ||
// IF forge-1.16.5 | ||
//import net.minecraft.util.text.ITextComponent; | ||
//import net.minecraftforge.fml.client.gui.widget.Slider; | ||
// ELSE | ||
//import net.minecraft.network.chat.Component; | ||
// END IF | ||
import net.minecraftforge.api.distmarker.Dist; | ||
import net.minecraftforge.api.distmarker.OnlyIn; | ||
|
||
import static io.github.kituin.chatimage.ChatImage.CONFIG; | ||
import static io.github.kituin.chatimage.tool.SimpleUtil.*; | ||
|
||
|
||
@OnlyIn(Dist.CLIENT) | ||
public class LimitSlider extends SettingSliderWidget { | ||
protected final LimitType limitType; | ||
|
||
|
||
// IF forge-1.16.5 | ||
// public LimitSlider(int x, int y, int width, int height, ITextComponent title, int value, float max, LimitType limitType, SettingSliderWidget.OnTooltip tooltip) { | ||
// super(x, y, width, height, title, | ||
// createLiteralComponent(""), | ||
// value, 1F, max, tooltip,new LimitSliderUpdate(limitType)); | ||
// this.limitType = limitType; | ||
// } | ||
// public static ITextComponent tooltip(LimitType limitType) { | ||
// switch (limitType) { | ||
// case WIDTH: | ||
// return createTranslatableComponent("width.limit.chatimage.tooltip"); | ||
// case HEIGHT: | ||
// return createTranslatableComponent("height.limit.chatimage.tooltip"); | ||
// } | ||
// return null; | ||
// } | ||
// public static class LimitSliderUpdate implements Slider.ISlider { | ||
// | ||
// private final LimitSlider.LimitType limitType; | ||
// | ||
// public LimitSliderUpdate(LimitSlider.LimitType limitType) { | ||
// this.limitType = limitType; | ||
// } | ||
// | ||
// @Override | ||
// public void onChangeSliderValue(Slider slider) { | ||
// int position = (int) (slider.sliderValue * (slider.maxValue - slider.minValue) + slider.minValue); | ||
// switch (limitType) { | ||
// case WIDTH: | ||
// CONFIG.limitWidth = position; | ||
// break; | ||
// case HEIGHT: | ||
// CONFIG.limitHeight = position; | ||
// break; | ||
// } | ||
// ChatImageConfig.saveConfig(CONFIG); | ||
// } | ||
// } | ||
// ELSE | ||
// protected final Component title; | ||
// public LimitSlider(int x, int y, int width, int height, Component title, int value, float max, LimitType limitType, SettingSliderWidget.OnTooltip tooltip) { | ||
// super(x, y, width, height, value, 1F, max, tooltip); | ||
// this.title = title; | ||
// this.limitType = limitType; | ||
// this.updateMessage(); | ||
// } | ||
// @Override | ||
// protected void updateMessage() { | ||
// switch (limitType) { | ||
// case WIDTH -> { | ||
// this.setMessage(composeGenericOptionComponent(title, CONFIG.limitWidth == 0 ? createTranslatableComponent("default.chatimage.gui") : createLiteralComponent(String.valueOf(this.position)))); | ||
// CONFIG.limitWidth = this.position; | ||
// } | ||
// case HEIGHT -> { | ||
// this.setMessage(composeGenericOptionComponent(title, CONFIG.limitHeight == 0 ? createTranslatableComponent("default.chatimage.gui") : createLiteralComponent(String.valueOf(this.position)))); | ||
// CONFIG.limitHeight = this.position; | ||
// } | ||
// default -> { | ||
// return; | ||
// } | ||
// } | ||
// ChatImageConfig.saveConfig(CONFIG); | ||
// } | ||
// END IF | ||
public enum LimitType { | ||
WIDTH, HEIGHT | ||
} | ||
} |