Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
reobf committed Feb 28, 2024
1 parent 7fbc95e commit ba6de7d
Show file tree
Hide file tree
Showing 28 changed files with 316 additions and 193 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@

[![](https://github.com/reobf/Programmable-Hatches-Mod/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/reobf/Programmable-Hatches-Mod/actions/workflows/build-and-test.yml)


注意:
安装此mod前请先备份你的GregTech.lang
如果发现翻译语言不正确,请在游戏设置中调整语言(仅客户端)或更改/config/programmablehatches.cfg的lang(仅服务端)
然后将备份的GregTech.lang覆盖原先的文件,并重启游戏即可


5 changes: 3 additions & 2 deletions src/main/java/reobf/proghatches/block/ItemBlockIOHub.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import reobf.proghatches.lang.LangManager;

public class ItemBlockIOHub extends ItemBlock{

Expand All @@ -25,14 +26,14 @@ public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p
String k = KeyboardUtil.isShiftKeyDown()?"tile.iohub.tooltip.shift":"tile.iohub.tooltip";


if (StatCollector.translateToLocal(k)
if (LangManager.translateToLocal(k)
.equals(
Integer.valueOf(i)
.toString())) {
break;
}
String key = k + "." + i;
String trans = StatCollector.translateToLocal(key);
String trans = LangManager.translateToLocal(key);

p_77624_3_.add(trans);
i++;
Expand Down
49 changes: 25 additions & 24 deletions src/main/java/reobf/proghatches/gt/cover/SmartArmCover.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import reobf.proghatches.gt.cover.parser.SimpleParser.Context;
import reobf.proghatches.gt.cover.parser.SimpleParser.Expression;
import reobf.proghatches.gt.cover.parser.SimpleParser.Rational;
import reobf.proghatches.lang.LangManager;
import reobf.proghatches.util.ProghatchesUtil;

public class SmartArmCover extends GT_CoverBehaviorBase<SmartArmCover.Data> {
Expand Down Expand Up @@ -283,7 +284,7 @@ protected ModularWindow createWindow(final EntityPlayer player) {
)
.setSize(16, 16)

.addTooltip(StatCollector.translateToLocal("programmable_hatches.cover.smart.probe.move"))
.addTooltip(LangManager.translateToLocal("programmable_hatches.cover.smart.probe.move"))
.setPos(8, 8)

);
Expand Down Expand Up @@ -340,7 +341,7 @@ protected void addUIWidgets(ModularWindow.Builder builder) {
.setBackground(GT_UITextures.BUTTON_STANDARD, PROBE)
.addTooltips(
ImmutableList
.of(StatCollector.translateToLocalFormatted("programmable_hatches.cover.smart.probe")))
.of(LangManager.translateToLocalFormatted("programmable_hatches.cover.smart.probe")))
.setSize(16, 16)
.setPos(startX + spaceX * 6, startY + spaceY * 2));

Expand Down Expand Up @@ -368,8 +369,8 @@ protected void addUIWidgets(ModularWindow.Builder builder) {
return GT_UITextures.OVERLAY_BUTTON_IMPORT;
})

.addTooltip(0, StatCollector.translateToLocal("programmable_hatches.cover.smart.io.false"))
.addTooltip(1, StatCollector.translateToLocal("programmable_hatches.cover.smart.io.true"))
.addTooltip(0, LangManager.translateToLocal("programmable_hatches.cover.smart.io.false"))
.addTooltip(1, LangManager.translateToLocal("programmable_hatches.cover.smart.io.true"))
.setPos(startX, startY)

);
Expand All @@ -378,7 +379,7 @@ protected void addUIWidgets(ModularWindow.Builder builder) {
.setOnClick((s, b) -> { getCoverData().formulaprev = "\0\0\0\0"; })
.setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_SLOT_RECYCLE)

.addTooltip(StatCollector.translateToLocal("programmable_hatches.cover.smart.reset"))
.addTooltip(LangManager.translateToLocal("programmable_hatches.cover.smart.reset"))
.setPos(startX + spaceX * 6, startY)

);
Expand All @@ -397,8 +398,8 @@ protected void addUIWidgets(ModularWindow.Builder builder) {
}

)
.addTooltip(0, StatCollector.translateToLocal("programmable_hatches.cover.smart.mode.0"))
.addTooltip(1, StatCollector.translateToLocal("programmable_hatches.cover.smart.mode.1"))
.addTooltip(0, LangManager.translateToLocal("programmable_hatches.cover.smart.mode.0"))
.addTooltip(1, LangManager.translateToLocal("programmable_hatches.cover.smart.mode.1"))
.setPos(startX, startY + spaceY));

CycleButtonWidget c;
Expand All @@ -420,28 +421,28 @@ protected void addUIWidgets(ModularWindow.Builder builder) {
.dynamicTooltip(
() -> c.getState() == 0
? Arrays.asList(
StatCollector.translateToLocal("programmable_hatches.cover.smart.dyn.0"),
LangManager.translateToLocal("programmable_hatches.cover.smart.dyn.0"),
StatCollector
.translateToLocal("programmable_hatches.cover.smart.dyn.shift.for.detail"))
: Arrays.asList(
StatCollector.translateToLocal("programmable_hatches.cover.smart.dyn.1"),
LangManager.translateToLocal("programmable_hatches.cover.smart.dyn.1"),
StatCollector
.translateToLocal("programmable_hatches.cover.smart.dyn.shift.for.detail"))

)

// .addTooltip(0,StatCollector.translateToLocal("programmable_hatches.cover.smart.dyn.0"))
// .addTooltip(0,StatCollector.translateToLocal("programmable_hatches.cover.smart.dyn.shift.for.detail"))
// .addTooltip(1,StatCollector.translateToLocal("programmable_hatches.cover.smart.dyn.1"))
// .addTooltip(1,StatCollector.translateToLocal("programmable_hatches.cover.smart.dyn.shift.for.detail"))
// .addTooltip(0,LangManager.translateToLocal("programmable_hatches.cover.smart.dyn.0"))
// .addTooltip(0,LangManager.translateToLocal("programmable_hatches.cover.smart.dyn.shift.for.detail"))
// .addTooltip(1,LangManager.translateToLocal("programmable_hatches.cover.smart.dyn.1"))
// .addTooltip(1,LangManager.translateToLocal("programmable_hatches.cover.smart.dyn.shift.for.detail"))
.dynamicTooltipShift(
() -> Arrays.asList(
rangeOf(
Integer.valueOf(
StatCollector.translateToLocal(
LangManager.translateToLocal(
"programmable_hatches.cover.smart.dyn.shift." + c.getState())))
.map(
s -> StatCollector.translateToLocal(
s -> LangManager.translateToLocal(
"programmable_hatches.cover.smart.dyn.shift." + c.getState()
+ "."
+ s))
Expand Down Expand Up @@ -494,8 +495,8 @@ protected void addUIWidgets(ModularWindow.Builder builder) {
* if(i==1) return GT_UITextures.OVERLAY_BUTTON_EXPORT;
* return GT_UITextures.OVERLAY_BUTTON_IMPORT;
* }
* ).addTooltip(0, StatCollector.translateToLocal("programmable_hatches.cover.smart.io.false"))
* .addTooltip(1,StatCollector.translateToLocal("programmable_hatches.cover.smart.io.true"))
* ).addTooltip(0, LangManager.translateToLocal("programmable_hatches.cover.smart.io.false"))
* .addTooltip(1,LangManager.translateToLocal("programmable_hatches.cover.smart.io.true"))
* .setPos(startX , startY );
* }
* );
Expand All @@ -511,8 +512,8 @@ protected void addUIWidgets(ModularWindow.Builder builder) {
* if(i==1) return GT_UITextures.OVERLAY_BUTTON_EXPORT;
* return GT_UITextures.OVERLAY_BUTTON_IMPORT;
* }
* ).addTooltip(0,StatCollector.translateToLocal("programmable_hatches.cover.smart.mode.0"))
* .addTooltip(1,StatCollector.translateToLocal("programmable_hatches.cover.smart.mode.1"))
* ).addTooltip(0,LangManager.translateToLocal("programmable_hatches.cover.smart.mode.0"))
* .addTooltip(1,LangManager.translateToLocal("programmable_hatches.cover.smart.mode.1"))
* .setPos(startX , startY +spaceY);
* }
* );
Expand Down Expand Up @@ -541,8 +542,8 @@ protected void addUIWidgets(ModularWindow.Builder builder) {
UITexture.fullImage(new ResourceLocation("proghatches", "textures/formula" + getCoverData().mode + ".png"))

)
.addTooltip(StatCollector.translateToLocal("programmable_hatches.cover.smart.tips.0"))
.addTooltip(StatCollector.translateToLocal("programmable_hatches.cover.smart.tips.1"))
.addTooltip(LangManager.translateToLocal("programmable_hatches.cover.smart.tips.0"))
.addTooltip(LangManager.translateToLocal("programmable_hatches.cover.smart.tips.1"))

.setPos(startX + spaceX, startY + spaceY)
.setSize(14 * 4, 14))
Expand Down Expand Up @@ -575,11 +576,11 @@ protected void addUIWidgets(ModularWindow.Builder builder) {
/*
* .widget(
* new TextWidget(
* StatCollector.translateToLocal("programmable_hatches.cover.smart.formula")).setDefaultColor(
* LangManager.translateToLocal("programmable_hatches.cover.smart.formula")).setDefaultColor(
* COLOR_TEXT_GRAY.get())
* .setPos(startX + spaceX * 3, 4 + startY + spaceY * 1))
* .widget(
* new TextWidget(StatCollector.translateToLocal("programmable_hatches.cover.smart.formula.desc")).
* new TextWidget(LangManager.translateToLocal("programmable_hatches.cover.smart.formula.desc")).
* setDefaultColor(COLOR_TEXT_GRAY.get())
* .setPos(startX + spaceX * 3, 4 + startY + spaceY * 2));
*/ }
Expand Down Expand Up @@ -935,7 +936,7 @@ private Context addDyn(Context add, Data d, ICoverable aTileEntity) {
}

private static String info(String s) {
return StatCollector.translateToLocal("programmable_hatches.cover.smart.info." + s);
return LangManager.translateToLocal("programmable_hatches.cover.smart.info." + s);

}

Expand Down
35 changes: 18 additions & 17 deletions src/main/java/reobf/proghatches/gt/cover/WirelessControlCover.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import gregtech.common.gui.modularui.widget.CoverCycleButtonWidget;
import io.netty.buffer.ByteBuf;
import reobf.proghatches.gt.cover.SmartArmCover.Data;
import reobf.proghatches.lang.LangManager;
import reobf.proghatches.util.ProghatchesUtil;

@SuppressWarnings("hiding")
Expand Down Expand Up @@ -331,8 +332,8 @@ protected void addUIWidgets(ModularWindow.Builder builder) {
return GT_UITextures.OVERLAY_BUTTON_REDSTONE_ON;
})

.addTooltip(0, StatCollector.translateToLocal("programmable_hatches.cover.wireless.invert.false"))
.addTooltip(1, StatCollector.translateToLocal("programmable_hatches.cover.wireless.invert.true"))
.addTooltip(0, LangManager.translateToLocal("programmable_hatches.cover.wireless.invert.false"))
.addTooltip(1, LangManager.translateToLocal("programmable_hatches.cover.wireless.invert.true"))
.setPos(startX, startY)

);
Expand All @@ -346,8 +347,8 @@ protected void addUIWidgets(ModularWindow.Builder builder) {
return GT_UITextures.OVERLAY_BUTTON_CHECKMARK;
})

.addTooltip(0, StatCollector.translateToLocal("programmable_hatches.cover.wireless.safe.false"))
.addTooltip(1, StatCollector.translateToLocal("programmable_hatches.cover.wireless.safe.true"))
.addTooltip(0, LangManager.translateToLocal("programmable_hatches.cover.wireless.safe.false"))
.addTooltip(1, LangManager.translateToLocal("programmable_hatches.cover.wireless.safe.true"))
.setPos(startX + spaceX, startY)

);
Expand All @@ -361,8 +362,8 @@ protected void addUIWidgets(ModularWindow.Builder builder) {
return ON;
})

.addTooltip(0, StatCollector.translateToLocal("programmable_hatches.cover.wireless.crashed.false"))
.addTooltip(1, StatCollector.translateToLocal("programmable_hatches.cover.wireless.crashed.true"))
.addTooltip(0, LangManager.translateToLocal("programmable_hatches.cover.wireless.crashed.false"))
.addTooltip(1, LangManager.translateToLocal("programmable_hatches.cover.wireless.crashed.true"))
.setPos(startX + spaceX * 2, startY)

);
Expand All @@ -378,10 +379,10 @@ protected void addUIWidgets(ModularWindow.Builder builder) {

.addTooltip(
0,
StatCollector.translateToLocal("programmable_hatches.cover.wireless.uuidsource.false"))
LangManager.translateToLocal("programmable_hatches.cover.wireless.uuidsource.false"))
.addTooltip(
1,
StatCollector.translateToLocal("programmable_hatches.cover.wireless.uuidsource.true"))
LangManager.translateToLocal("programmable_hatches.cover.wireless.uuidsource.true"))
.setPos(startX + spaceX * 3, startY)

);
Expand All @@ -395,8 +396,8 @@ protected void addUIWidgets(ModularWindow.Builder builder) {
return GT_UITextures.OVERLAY_BUTTON_RECIPE_UNLOCKED;
})

.addTooltip(0, StatCollector.translateToLocal("programmable_hatches.cover.wireless.private.false"))
.addTooltip(1, StatCollector.translateToLocal("programmable_hatches.cover.wireless.private.true"))
.addTooltip(0, LangManager.translateToLocal("programmable_hatches.cover.wireless.private.false"))
.addTooltip(1, LangManager.translateToLocal("programmable_hatches.cover.wireless.private.true"))
.setPos(startX + spaceX * 4, startY)

);
Expand All @@ -422,14 +423,14 @@ protected void addUIWidgets(ModularWindow.Builder builder) {
}
})

.addTooltip(0, StatCollector.translateToLocal("programmable_hatches.cover.wireless.gatemode.0"))
.addTooltip(1, StatCollector.translateToLocal("programmable_hatches.cover.wireless.gatemode.1"))
.addTooltip(2, StatCollector.translateToLocal("programmable_hatches.cover.wireless.gatemode.2"))
.addTooltip(3, StatCollector.translateToLocal("programmable_hatches.cover.wireless.gatemode.3"))
// .addTooltip(4, StatCollector.translateToLocal("programmable_hatches.cover.wireless.gatemode.4"))
// .addTooltip(0, StatCollector.translateToLocal("programmable_hatches.cover.wireless.gatemode.0"))
.addTooltip(0, LangManager.translateToLocal("programmable_hatches.cover.wireless.gatemode.0"))
.addTooltip(1, LangManager.translateToLocal("programmable_hatches.cover.wireless.gatemode.1"))
.addTooltip(2, LangManager.translateToLocal("programmable_hatches.cover.wireless.gatemode.2"))
.addTooltip(3, LangManager.translateToLocal("programmable_hatches.cover.wireless.gatemode.3"))
// .addTooltip(4, LangManager.translateToLocal("programmable_hatches.cover.wireless.gatemode.4"))
// .addTooltip(0, LangManager.translateToLocal("programmable_hatches.cover.wireless.gatemode.0"))

// .addTooltip(1,StatCollector.translateToLocal("programmable_hatches.cover.wireless.private.true"))
// .addTooltip(1,LangManager.translateToLocal("programmable_hatches.cover.wireless.private.true"))
.setPos(startX + spaceX * 5, startY)

);
Expand Down
Loading

0 comments on commit ba6de7d

Please sign in to comment.