-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
64 changed files
with
8,110 additions
and
17 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
## 0.6.0 | ||
폰트 변경기능 추가 | ||
|
||
## 0.5.0 | ||
옵티파인 1.14.4_HD_U_F4_pre3 호환 | ||
- 옵티파인과 함께 쓸 때 한글 채팅이 정상 작동하지 않는 문제 수정 | ||
|
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
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
52 changes: 52 additions & 0 deletions
52
src/main/java/kr/neko/sokcuri/naraechat/Config/AbstractNaraeOption.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,52 @@ | ||
package kr.neko.sokcuri.naraechat.Config; | ||
|
||
import kr.neko.sokcuri.naraechat.Config.ConfigHelper; | ||
import kr.neko.sokcuri.naraechat.Fonts.FontManager; | ||
import net.minecraft.client.settings.AbstractOption; | ||
import net.minecraft.client.settings.SliderPercentageOption; | ||
|
||
public abstract class AbstractNaraeOption extends AbstractOption { | ||
public AbstractNaraeOption(String translationKeyIn) { | ||
super(translationKeyIn); | ||
} | ||
|
||
public static final SliderPercentageOption FONT_SIZE = new SliderPercentageOption("options.naraechat.fontsize", 8.0D, 15.0D, 1.0F, (gameSettings) -> { | ||
return (double) FontManager.instance.fontSize; | ||
}, (gameSettings, value) -> { | ||
FontManager.instance.fontSize = value.floatValue(); | ||
ConfigHelper.setFontSize(value.floatValue()); | ||
}, (gameSettings, sliderPercentageOption) -> { | ||
double d0 = sliderPercentageOption.get(gameSettings); | ||
return "Font Size: " + String.format("%.0f", d0) + "pt"; | ||
}); | ||
|
||
public static final SliderPercentageOption OVER_SAMPLE = new SliderPercentageOption("options.naraechat.oversample", 0.0D, 8.0D, 0.1F, (gameSettings) -> { | ||
return (double) FontManager.instance.overSample; | ||
}, (gameSettings, value) -> { | ||
FontManager.instance.overSample = value.floatValue(); | ||
ConfigHelper.setOversample(value.floatValue()); | ||
}, (gameSettings, sliderPercentageOption) -> { | ||
double d0 = sliderPercentageOption.get(gameSettings); | ||
return "Over Sample : " + String.format("%.1f", d0) + "pt"; | ||
}); | ||
|
||
public static final SliderPercentageOption SHIFT_X = new SliderPercentageOption("options.naraechat.shiftx", -5.0D, 5.0D, 0.1F, (gameSettings) -> { | ||
return (double) FontManager.instance.shiftX; | ||
}, (gameSettings, value) -> { | ||
FontManager.instance.shiftX = value.floatValue(); | ||
ConfigHelper.setShiftX(value.floatValue()); | ||
}, (gameSettings, sliderPercentageOption) -> { | ||
double d0 = sliderPercentageOption.get(gameSettings); | ||
return "ShiftX : " + String.format("%.1f", d0) + "px"; | ||
}); | ||
|
||
public static final SliderPercentageOption SHIFT_Y = new SliderPercentageOption("options.naraechat.shifty", -5.0D, 5.0D, 0.1F, (gameSettings) -> { | ||
return (double) FontManager.instance.shiftY; | ||
}, (gameSettings, value) -> { | ||
FontManager.instance.shiftY = value.floatValue(); | ||
ConfigHelper.setShiftY(value.floatValue()); | ||
}, (gameSettings, sliderPercentageOption) -> { | ||
double d0 = sliderPercentageOption.get(gameSettings); | ||
return "ShiftY : " + String.format("%.1f", d0) + "px"; | ||
}); | ||
} |
111 changes: 111 additions & 0 deletions
111
src/main/java/kr/neko/sokcuri/naraechat/Config/ConfigHelper.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,111 @@ | ||
package kr.neko.sokcuri.naraechat.Config; | ||
|
||
import net.minecraftforge.common.ForgeConfigSpec; | ||
import net.minecraftforge.fml.config.ModConfig; | ||
import org.ini4j.Wini; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
|
||
public final class ConfigHelper { | ||
private static Wini ini; | ||
|
||
static { | ||
try { | ||
File file = new File("naraechat.ini"); | ||
if(!file.exists()) | ||
{ | ||
file.createNewFile(); | ||
setFontFamily("맑은 고딕"); | ||
setFontSize(12.0f); | ||
setOversample(4.0f); | ||
setShiftX(-0.3f); | ||
setShiftY(0.3f); | ||
} | ||
ini = new Wini(file); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public static ModConfig clientConfig; | ||
|
||
public static void bakeClient(final ModConfig config) { | ||
clientConfig = config; | ||
} | ||
|
||
public static String getFontFamily() { | ||
String fontFamily = ini.get("font", "fontfamily", String.class); | ||
return fontFamily; | ||
} | ||
|
||
public static void setFontFamily(final String value) { | ||
ini.put("font", "fontfamily", value); | ||
try { | ||
ini.store(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public static float getFontSize() { | ||
float size = ini.get("font", "fontsize", float.class); | ||
if (size == 0) size = 12.0f; | ||
return size; | ||
} | ||
|
||
public static void setFontSize(final float value) { | ||
ini.put("font", "fontsize", value); | ||
try { | ||
ini.store(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public static float getOversample() { | ||
float oversample = ini.get("font", "oversample", float.class); | ||
if (oversample == 0) oversample = 4.0f; | ||
return oversample; | ||
} | ||
|
||
public static void setOversample(final float value) { | ||
ini.put("font", "oversample", value); | ||
try { | ||
ini.store(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public static float getShiftX() { | ||
return ini.get("font", "shiftx", float.class); | ||
} | ||
|
||
public static void setShiftX(final float value) { | ||
ini.put("font", "shiftx", value); | ||
try { | ||
ini.store(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public static float getShiftY() { | ||
return ini.get("font", "shifty", float.class); | ||
} | ||
|
||
public static void setShiftY(final float value) { | ||
ini.put("font", "shifty", value); | ||
try { | ||
ini.store(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public static void setValueAndSave(final ModConfig modConfig, final String path, final Object newValue) { | ||
modConfig.getConfigData().set(path, newValue); | ||
modConfig.save(); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
src/main/java/kr/neko/sokcuri/naraechat/Config/LanguageScreenOverride.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,50 @@ | ||
package kr.neko.sokcuri.naraechat.Config; | ||
|
||
import kr.neko.sokcuri.naraechat.Fonts.NaraeFontSettings; | ||
import net.minecraft.client.GameSettings; | ||
import net.minecraft.client.gui.screen.LanguageScreen; | ||
import net.minecraft.client.gui.screen.Screen; | ||
import net.minecraft.client.gui.widget.Widget; | ||
import net.minecraft.client.gui.widget.button.Button; | ||
import net.minecraft.client.gui.widget.button.OptionButton; | ||
import net.minecraft.client.resources.I18n; | ||
import net.minecraft.client.resources.LanguageManager; | ||
|
||
public class LanguageScreenOverride extends LanguageScreen { | ||
private final Screen parentScreen; | ||
private final GameSettings game_settings_3; | ||
private final LanguageManager languageManager; | ||
|
||
public LanguageScreenOverride(Screen screen, GameSettings gameSettingsObj, LanguageManager manager) { | ||
super(screen, gameSettingsObj, manager); | ||
|
||
this.parentScreen = screen; | ||
this.game_settings_3 = gameSettingsObj; | ||
this.languageManager = manager; | ||
} | ||
|
||
@Override | ||
protected void init() { | ||
super.init(); | ||
|
||
Widget fontConfBtn = new Button(this.width / 2 - 155, this.height - 38, 150, 20, I18n.format("options.naraechat.font"), (p_213037_1_) -> { | ||
NaraeFontSettings.scrollbarPosition = 0.0f; | ||
this.minecraft.displayGuiScreen(new NaraeFontSettings(this, this.game_settings_3, languageManager)); | ||
}); | ||
|
||
for (Widget button : this.buttons) { | ||
if (button instanceof OptionButton) { | ||
this.buttons.add(this.buttons.indexOf(button), fontConfBtn); | ||
this.children.add(this.children.indexOf(button), fontConfBtn); | ||
this.buttons.remove(button); | ||
this.children.remove(button); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void render(int p_render_1_, int p_render_2_, float p_render_3_) { | ||
super.render(p_render_1_, p_render_2_, p_render_3_); | ||
} | ||
} |
Oops, something went wrong.