Closed sparrowhe closed 2 months ago
附上一个patch以供参考
diff --git a/fabric/src/main/java/ziyue/tjmetro/mod/client/RouteMapGenerator.java b/fabric/src/main/java/ziyue/tjmetro/mod/client/RouteMapGenerator.java
index 71e3bae..fb1aaac 100644
--- a/fabric/src/main/java/ziyue/tjmetro/mod/client/RouteMapGenerator.java
+++ b/fabric/src/main/java/ziyue/tjmetro/mod/client/RouteMapGenerator.java
@@ -30,6 +30,8 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.BiConsumer;
import static org.mtr.mod.client.DynamicTextureCache.LINE_HEIGHT_MULTIPLIER;
+import static org.mtr.mod.generated.lang.TranslationProvider.*;
+import static ziyue.tjmetro.mod.data.ITranslationProviderExtend.*;
/**
* @author ZiYueCommentary
@@ -103,11 +105,11 @@ public class RouteMapGenerator implements IGui
destinationString = destinationString.replace(TEMP_CIRCULAR_MARKER_CLOCKWISE, "").replace(TEMP_CIRCULAR_MARKER_ANTICLOCKWISE, "");
if (!destinationString.isEmpty()) {
if (isClockwise) {
- destinationString = IGui.insertTranslation("gui.mtr.clockwise_via_cjk", "gui.mtr.clockwise_via", 1, destinationString);
+ destinationString = IGui.insertTranslation(GUI_MTR_CLOCKWISE_VIA_CJK, GUI_MTR_CLOCKWISE_VIA, 1, destinationString);
} else if (isAnticlockwise) {
- destinationString = IGui.insertTranslation("gui.mtr.anticlockwise_via_cjk", "gui.mtr.anticlockwise_via", 1, destinationString);
+ destinationString = IGui.insertTranslation(GUI_MTR_ANTICLOCKWISE_VIA_CJK, GUI_MTR_ANTICLOCKWISE_VIA_CJK, 1, destinationString);
} else if (showToString) {
- destinationString = IGui.insertTranslation("gui.mtr.to_cjk", "gui.mtr.to", 1, destinationString);
+ destinationString = IGui.insertTranslation(GUI_MTR_TO_CJK, GUI_MTR_TO, 1, destinationString);
}
}
@@ -239,11 +241,11 @@ public class RouteMapGenerator implements IGui
destinationString = destinationString.replace(TEMP_CIRCULAR_MARKER_CLOCKWISE, "").replace(TEMP_CIRCULAR_MARKER_ANTICLOCKWISE, "");
if (!destinationString.isEmpty()) {
if (isClockwise) {
- destinationString = IGui.insertTranslation("gui.mtr.clockwise_via_cjk", "gui.mtr.clockwise_via", 1, destinationString);
+ destinationString = IGui.insertTranslation(GUI_MTR_CLOCKWISE_VIA_CJK, GUI_MTR_CLOCKWISE_VIA, 1, destinationString);
} else if (isAnticlockwise) {
- destinationString = IGui.insertTranslation("gui.mtr.anticlockwise_via_cjk", "gui.mtr.anticlockwise_via", 1, destinationString);
+ destinationString = IGui.insertTranslation(GUI_MTR_ANTICLOCKWISE_VIA_CJK, GUI_MTR_CLOCKWISE_VIA, 1, destinationString);
} else {
- destinationString = IGui.insertTranslation("gui.tjmetro.bound_for_bmt_cjk", "gui.tjmetro.bound_for", 1, destinationString);
+ destinationString = IGui.insertTranslation(GUI_TJMETRO_BOUND_FOR_BMT_CJK, GUI_TJMETRO_BOUND_FOR, 1, destinationString);
}
}
@@ -559,11 +561,11 @@ public class RouteMapGenerator implements IGui
destinationString = destinationString.replace(TEMP_CIRCULAR_MARKER_CLOCKWISE, "").replace(TEMP_CIRCULAR_MARKER_ANTICLOCKWISE, "");
if (!destinationString.isEmpty()) {
if (isClockwise) {
- destinationString = IGui.insertTranslation("gui.mtr.clockwise_via_cjk", "gui.mtr.clockwise_via", 1, destinationString);
+ destinationString = IGui.insertTranslation(GUI_MTR_CLOCKWISE_VIA_CJK, GUI_MTR_CLOCKWISE_VIA, 1, destinationString);
} else if (isAnticlockwise) {
- destinationString = IGui.insertTranslation("gui.mtr.anticlockwise_via_cjk", "gui.mtr.anticlockwise_via", 1, destinationString);
+ destinationString = IGui.insertTranslation(GUI_MTR_ANTICLOCKWISE_VIA_CJK, GUI_MTR_ANTICLOCKWISE_VIA, 1, destinationString);
} else {
- destinationString = IGui.insertTranslation("gui.tjmetro.bound_for_cjk", "gui.tjmetro.bound_for", 1, destinationString);
+ destinationString = IGui.insertTranslation(GUI_TJMETRO_BOUND_FOR_BMT_CJK, GUI_TJMETRO_BOUND_FOR, 1, destinationString);
}
}
boundFor = DynamicTextureCache.instance.getText(destinationString, width, height, tileSize * 3 / 5, tileSize * 3 / 10, padding, horizontalAlignment, forceMTRFont);
@@ -747,16 +749,16 @@ public class RouteMapGenerator implements IGui
destinationString = destinationString.replace(TEMP_CIRCULAR_MARKER_CLOCKWISE, "").replace(TEMP_CIRCULAR_MARKER_ANTICLOCKWISE, "");
if (!destinationString.isEmpty()) {
if (isClockwise) {
- destinationString = IGui.insertTranslation("gui.mtr.clockwise_via_cjk", "gui.mtr.clockwise_via", 1, destinationString);
+ destinationString = IGui.insertTranslation(GUI_MTR_CLOCKWISE_VIA_CJK, GUI_MTR_CLOCKWISE_VIA, 1, destinationString);
} else if (isAnticlockwise) {
- destinationString = IGui.insertTranslation("gui.mtr.anticlockwise_via_cjk", "gui.mtr.anticlockwise_via", 1, destinationString);
+ destinationString = IGui.insertTranslation(GUI_MTR_ANTICLOCKWISE_VIA_CJK, GUI_MTR_ANTICLOCKWISE_VIA, 1, destinationString);
} else {
- destinationString = IGui.insertTranslation("gui.tjmetro.bound_for_bmt_cjk", "gui.tjmetro.bound_for", 1, destinationString);
+ destinationString = IGui.insertTranslation(GUI_TJMETRO_BOUND_FOR_BMT_CJK, GUI_TJMETRO_BOUND_FOR, 1, destinationString);
}
}
final DynamicTextureCache.Text textDestination = DynamicTextureCache.instance.getText(destinationString, width - tilePadding - padding * 2, (int) (tileSize * LINE_HEIGHT_MULTIPLIER), tileSize, tileSize / 2, tilePadding, (arrowDirection == 2) ? HorizontalAlignment.RIGHT : HorizontalAlignment.LEFT);
- final DynamicTextureCache.Text textNextStations = DynamicTextureCache.instance.getText(IGui.insertTranslation("gui.tjmetro.next_station_bmt_cjk", "gui.tjmetro.next_station_bmt", 1, nextStationString), width - tilePadding - padding * 2, (int) (tileSize * LINE_HEIGHT_MULTIPLIER), fontSizeBig, fontSizeSmall, tilePadding, HorizontalAlignment.CENTER);
+ final DynamicTextureCache.Text textNextStations = DynamicTextureCache.instance.getText(IGui.insertTranslation(GUI_TJMETRO_NEXT_STATION_BMT_CJK, GUI_TJMETRO_NEXT_STATION_BMT, 1, nextStationString), width - tilePadding - padding * 2, (int) (tileSize * LINE_HEIGHT_MULTIPLIER), fontSizeBig, fontSizeSmall, tilePadding, HorizontalAlignment.CENTER);
final DynamicTextureCache.Text textStationName = DynamicTextureCache.instance.getText(getStationName(platformId), width, (int) (tileSize * LINE_HEIGHT_MULTIPLIER), tileSize, tileSize / 2, tilePadding, HorizontalAlignment.CENTER);
int imageWidth = Math.max(width, tilePadding + arrowSizeAndPadding + textDestination.width() + textStationName.width() + textNextStations.width() + tilePadding);
final boolean renderNextStation = (width - tilePadding - arrowSizeAndPadding - textDestination.width() - tilePadding - textStationName.width()) > textNextStations.width() * 2 / 3;
diff --git a/fabric/src/main/java/ziyue/tjmetro/mod/data/ITranslationProviderExtend.java b/fabric/src/main/java/ziyue/tjmetro/mod/data/ITranslationProviderExtend.java
new file mode 100644
index 0000000..cd0a45c
--- /dev/null
+++ b/fabric/src/main/java/ziyue/tjmetro/mod/data/ITranslationProviderExtend.java
@@ -0,0 +1,33 @@
+package ziyue.tjmetro.mod.data;
+
+import org.mtr.mapping.holder.MutableText;
+import org.mtr.mapping.holder.Text;
+import org.mtr.mapping.mapper.GraphicsHolder;
+import org.mtr.mapping.mapper.TextHelper;
+import org.mtr.mod.generated.lang.TranslationProvider;
+import org.mtr.mod.generated.lang.TranslationProvider.TranslationHolder;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+
+public interface ITranslationProviderExtend {
+ TranslationHolder GUI_TJMETRO_STATION_PINYIN = TranslationHolderFactory.createTranslationHolder("gui.tjmetro.station_pinyin");
+ TranslationHolder GUI_TJMETRO_BOUND_FOR_BMT_CJK = TranslationHolderFactory.createTranslationHolder("gui.tjmetro.bound_for_bmt_cjk");
+ TranslationHolder GUI_TJMETRO_BOUND_FOR = TranslationHolderFactory.createTranslationHolder("gui.tjmetro.bound_for");
+ TranslationHolder GUI_TJMETRO_NEXT_STATION_BMT_CJK = TranslationHolderFactory.createTranslationHolder("gui.tjmetro.next_station_bmt_cjk");
+ TranslationHolder GUI_TJMETRO_NEXT_STATION_BMT = TranslationHolderFactory.createTranslationHolder("gui.tjmetro.next_station_bmt");
+
+ public class TranslationHolderFactory {
+ public static TranslationHolder createTranslationHolder(String key) {
+ Constructor<TranslationHolder> constructor = null;
+ try {
+ constructor = TranslationHolder.class.getDeclaredConstructor(String.class);
+ constructor.setAccessible(true);
+ return constructor.newInstance(key);
+ } catch (Exception _) {
+ }
+ return null;
+ }
+ }
+}
diff --git a/fabric/src/main/java/ziyue/tjmetro/mod/mixin/RenderRailwaySignMixin.java b/fabric/src/main/java/ziyue/tjmetro/mod/mixin/RenderRailwaySignMixin.java
index 7f36890..77a7912 100644
--- a/fabric/src/main/java/ziyue/tjmetro/mod/mixin/RenderRailwaySignMixin.java
+++ b/fabric/src/main/java/ziyue/tjmetro/mod/mixin/RenderRailwaySignMixin.java
@@ -37,6 +37,8 @@ import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
+import static org.mtr.mod.generated.lang.TranslationProvider.GUI_MTR_STATION;
+import static org.mtr.mod.generated.lang.TranslationProvider.GUI_MTR_STATION_CJK;
import static org.mtr.mod.render.RenderRailwaySign.getSign;
/**
@@ -206,7 +208,7 @@ public abstract class RenderRailwaySignMixin<T extends BlockRailwaySign.BlockEnt
signText = IGui.mergeStations(selectedIds.longStream()
.filter(MinecraftClientData.getInstance().stationIdMap::containsKey)
.sorted()
- .mapToObj(stationId -> IGui.insertTranslation("gui.mtr.station_cjk", "gui.mtr.station", 1, MinecraftClientData.getInstance().stationIdMap.get(stationId).getName()))
+ .mapToObj(stationId -> IGui.insertTranslation(GUI_MTR_STATION_CJK, GUI_MTR_STATION, 1, MinecraftClientData.getInstance().stationIdMap.get(stationId).getName()))
.collect(Collectors.toList())
);
} else {
diff --git a/fabric/src/main/java/ziyue/tjmetro/mod/render/RenderRailwaySignTianjin.java b/fabric/src/main/java/ziyue/tjmetro/mod/render/RenderRailwaySignTianjin.java
index 1e1b0f3..197faaf 100644
--- a/fabric/src/main/java/ziyue/tjmetro/mod/render/RenderRailwaySignTianjin.java
+++ b/fabric/src/main/java/ziyue/tjmetro/mod/render/RenderRailwaySignTianjin.java
@@ -36,6 +36,8 @@ import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
+import static org.mtr.mod.generated.lang.TranslationProvider.GUI_MTR_STATION;
+import static org.mtr.mod.generated.lang.TranslationProvider.GUI_MTR_STATION_CJK;
import static org.mtr.mod.render.RenderRailwaySign.getMaxWidth;
import static org.mtr.mod.render.RenderRailwaySign.getSign;
@@ -271,7 +273,7 @@ public class RenderRailwaySignTianjin<T extends BlockRailwaySignBase.BlockEntity
signText = IGui.mergeStations(selectedIds.longStream()
.filter(MinecraftClientData.getInstance().stationIdMap::containsKey)
.sorted()
- .mapToObj(stationId -> IGui.insertTranslation("gui.mtr.station_cjk", "gui.mtr.station", 1, MinecraftClientData.getInstance().stationIdMap.get(stationId).getName()))
+ .mapToObj(stationId -> IGui.insertTranslation(GUI_MTR_STATION_CJK, GUI_MTR_STATION, 1, MinecraftClientData.getInstance().stationIdMap.get(stationId).getName()))
.collect(Collectors.toList())
);
} else {
diff --git a/fabric/src/main/java/ziyue/tjmetro/mod/render/RenderRailwaySignTianjinBMT.java b/fabric/src/main/java/ziyue/tjmetro/mod/render/RenderRailwaySignTianjinBMT.java
index 2a9ad15..d216a0e 100644
--- a/fabric/src/main/java/ziyue/tjmetro/mod/render/RenderRailwaySignTianjinBMT.java
+++ b/fabric/src/main/java/ziyue/tjmetro/mod/render/RenderRailwaySignTianjinBMT.java
@@ -36,6 +36,8 @@ import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
+import static org.mtr.mod.generated.lang.TranslationProvider.GUI_MTR_STATION;
+import static org.mtr.mod.generated.lang.TranslationProvider.GUI_MTR_STATION_CJK;
import static org.mtr.mod.render.RenderRailwaySign.getMaxWidth;
import static org.mtr.mod.render.RenderRailwaySign.getSign;
@@ -259,7 +261,7 @@ public class RenderRailwaySignTianjinBMT<T extends BlockRailwaySignBase.BlockEnt
signText = IGui.mergeStations(selectedIds.longStream()
.filter(MinecraftClientData.getInstance().stationIdMap::containsKey)
.sorted()
- .mapToObj(stationId -> IGui.insertTranslation("gui.mtr.station_cjk", "gui.mtr.station", 1, MinecraftClientData.getInstance().stationIdMap.get(stationId).getName()))
+ .mapToObj(stationId -> IGui.insertTranslation(GUI_MTR_STATION_CJK, GUI_MTR_STATION, 1, MinecraftClientData.getInstance().stationIdMap.get(stationId).getName()))
.collect(Collectors.toList())
);
} else {
diff --git a/fabric/src/main/java/ziyue/tjmetro/mod/render/RenderRailwaySignWallDouble.java b/fabric/src/main/java/ziyue/tjmetro/mod/render/RenderRailwaySignWallDouble.java
index 6ac588a..7bc3a65 100644
--- a/fabric/src/main/java/ziyue/tjmetro/mod/render/RenderRailwaySignWallDouble.java
+++ b/fabric/src/main/java/ziyue/tjmetro/mod/render/RenderRailwaySignWallDouble.java
@@ -37,6 +37,8 @@ import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
+import static org.mtr.mod.generated.lang.TranslationProvider.GUI_MTR_STATION;
+import static org.mtr.mod.generated.lang.TranslationProvider.GUI_MTR_STATION_CJK;
import static org.mtr.mod.render.RenderRailwaySign.getMaxWidth;
import static org.mtr.mod.render.RenderRailwaySign.getSign;
@@ -277,7 +279,7 @@ public class RenderRailwaySignWallDouble<T extends BlockRailwaySignWallDouble.Bl
signText = IGui.mergeStations(selectedIds.longStream()
.filter(MinecraftClientData.getInstance().stationIdMap::containsKey)
.sorted()
- .mapToObj(stationId -> IGui.insertTranslation("gui.mtr.station_cjk", "gui.mtr.station", 1, MinecraftClientData.getInstance().stationIdMap.get(stationId).getName()))
+ .mapToObj(stationId -> IGui.insertTranslation(GUI_MTR_STATION_CJK, GUI_MTR_STATION, 1, MinecraftClientData.getInstance().stationIdMap.get(stationId).getName()))
.collect(Collectors.toList())
);
} else {
diff --git a/fabric/src/main/java/ziyue/tjmetro/mod/render/RenderStationNameEntranceTianjin.java b/fabric/src/main/java/ziyue/tjmetro/mod/render/RenderStationNameEntranceTianjin.java
index d658df8..0db11c8 100644
--- a/fabric/src/main/java/ziyue/tjmetro/mod/render/RenderStationNameEntranceTianjin.java
+++ b/fabric/src/main/java/ziyue/tjmetro/mod/render/RenderStationNameEntranceTianjin.java
@@ -18,6 +18,9 @@ import ziyue.tjmetro.mod.client.DynamicTextureCache;
import javax.annotation.Nullable;
+import static org.mtr.mod.generated.lang.TranslationProvider.*;
+import static ziyue.tjmetro.mod.data.ITranslationProviderExtend.*;
+
/**
* @author ZiYueCommentary
* @see BlockStationNameEntranceTianjin
@@ -71,9 +74,9 @@ public class RenderStationNameEntranceTianjin<T extends BlockStationNameEntrance
default:
style = propagateProperty;
}
- resource = DynamicTextureCache.instance.getStationNameEntrance(-1, -1, style, IGui.insertTranslation("gui.mtr.station_cjk", "gui.mtr.station", 1, TextHelper.translatable("gui.mtr.untitled").getString()), block.isBMT, totalLength / logoSize);
+ resource = DynamicTextureCache.instance.getStationNameEntrance(-1, -1, style, IGui.insertTranslation(GUI_MTR_STATION_CJK, GUI_MTR_STATION, 1, TextHelper.translatable("gui.mtr.untitled").getString()), block.isBMT, totalLength / logoSize);
} else {
- resource = DynamicTextureCache.instance.getStationNameEntrance(station.getId(), entity.getSelectedId(), propagateProperty, IGui.insertTranslation("gui.mtr.station_cjk", block.pinyin ? "gui.tjmetro.station_pinyin" : "gui.mtr.station", 1, station.getName()), block.isBMT, totalLength / logoSize);
+ resource = DynamicTextureCache.instance.getStationNameEntrance(station.getId(), entity.getSelectedId(), propagateProperty, IGui.insertTranslation(GUI_MTR_STATION_CJK, block.pinyin ? GUI_TJMETRO_STATION_PINYIN : GUI_MTR_STATION, 1, station.getName()), block.isBMT, totalLength / logoSize);
}
MainRenderer.scheduleRender(resource.identifier, false, QueuedRenderLayer.EXTERIOR, (graphicsHolderNew, offset) -> {
storedMatrixTransformations.transform(graphicsHolderNew, offset);
diff --git a/fabric/src/main/java/ziyue/tjmetro/mod/screen/RailwaySignDoubleScreen.java b/fabric/src/main/java/ziyue/tjmetro/mod/screen/RailwaySignDoubleScreen.java
index 0b0fd62..c2952b6 100644
--- a/fabric/src/main/java/ziyue/tjmetro/mod/screen/RailwaySignDoubleScreen.java
+++ b/fabric/src/main/java/ziyue/tjmetro/mod/screen/RailwaySignDoubleScreen.java
@@ -15,10 +15,7 @@ import org.mtr.mod.client.MinecraftClientData;
import org.mtr.mod.data.IGui;
import org.mtr.mod.render.RenderRailwaySign;
import org.mtr.mod.resource.SignResource;
-import org.mtr.mod.screen.DashboardListItem;
-import org.mtr.mod.screen.DashboardListSelectorScreen;
-import org.mtr.mod.screen.EditStationScreen;
-import org.mtr.mod.screen.PIDSConfigScreen;
+import org.mtr.mod.screen.*;
import ziyue.tjmetro.mod.RegistryClient;
import ziyue.tjmetro.mod.block.BlockRailwaySignWallDouble;
import ziyue.tjmetro.mod.block.base.BlockRailwaySignBase;
@@ -147,8 +144,8 @@ public class RailwaySignDoubleScreen extends ScreenExtension implements IGui
buttonClear = new ButtonWidgetExtension(0, 0, 0, SQUARE_SIZE, TextHelper.translatable("gui.mtr.reset_sign"), button -> setNewSignId(null));
- buttonPrevPage = new TexturedButtonWidgetExtension(0, 0, 0, SQUARE_SIZE, new Identifier("textures/gui/sprites/mtr/icon_left.png"), new Identifier("textures/gui/sprites/mtr/icon_left_highlighted.png"), button -> setPage(page - 1));
- buttonNextPage = new TexturedButtonWidgetExtension(0, 0, 0, SQUARE_SIZE, new Identifier("textures/gui/sprites/mtr/icon_right.png"), new Identifier("textures/gui/sprites/mtr/icon_right_highlighted.png"), button -> setPage(page + 1));
+ buttonPrevPage = TexturedButtonWidgetHelper.create(0, 0, 0, SQUARE_SIZE, new Identifier("textures/gui/sprites/mtr/icon_left.png"), new Identifier("textures/gui/sprites/mtr/icon_left_highlighted.png"), button -> setPage(page - 1));
+ buttonNextPage = TexturedButtonWidgetHelper.create(0, 0, 0, SQUARE_SIZE, new Identifier("textures/gui/sprites/mtr/icon_right.png"), new Identifier("textures/gui/sprites/mtr/icon_right_highlighted.png"), button -> setPage(page + 1));
}
@Override
diff --git a/fabric/src/main/java/ziyue/tjmetro/mod/screen/RailwaySignScreen.java b/fabric/src/main/java/ziyue/tjmetro/mod/screen/RailwaySignScreen.java
index 51d4765..c9d515e 100644
--- a/fabric/src/main/java/ziyue/tjmetro/mod/screen/RailwaySignScreen.java
+++ b/fabric/src/main/java/ziyue/tjmetro/mod/screen/RailwaySignScreen.java
@@ -15,10 +15,7 @@ import org.mtr.mod.client.MinecraftClientData;
import org.mtr.mod.data.IGui;
import org.mtr.mod.render.RenderRailwaySign;
import org.mtr.mod.resource.SignResource;
-import org.mtr.mod.screen.DashboardListItem;
-import org.mtr.mod.screen.DashboardListSelectorScreen;
-import org.mtr.mod.screen.EditStationScreen;
-import org.mtr.mod.screen.PIDSConfigScreen;
+import org.mtr.mod.screen.*;
import ziyue.tjmetro.mod.RegistryClient;
import ziyue.tjmetro.mod.block.BlockStationNameEntranceTianjin;
import ziyue.tjmetro.mod.block.BlockStationNamePlate;
@@ -148,8 +145,8 @@ public class RailwaySignScreen extends ScreenExtension implements IGui
}
buttonClear = new ButtonWidgetExtension(0, 0, 0, SQUARE_SIZE, TextHelper.translatable("gui.mtr.reset_sign"), button -> setNewSignId(null));
- buttonPrevPage = new TexturedButtonWidgetExtension(0, 0, 0, SQUARE_SIZE, new Identifier("textures/gui/sprites/mtr/icon_left.png"), new Identifier("textures/gui/sprites/mtr/icon_left_highlighted.png"), button -> setPage(page - 1));
- buttonNextPage = new TexturedButtonWidgetExtension(0, 0, 0, SQUARE_SIZE, new Identifier("textures/gui/sprites/mtr/icon_right.png"), new Identifier("textures/gui/sprites/mtr/icon_right_highlighted.png"), button -> setPage(page + 1));
+ buttonPrevPage = TexturedButtonWidgetHelper.create(0, 0, 0, SQUARE_SIZE, new Identifier("textures/gui/sprites/mtr/icon_left.png"), new Identifier("textures/gui/sprites/mtr/icon_left_highlighted.png"), button -> setPage(page - 1));
+ buttonNextPage = TexturedButtonWidgetHelper.create(0, 0, 0, SQUARE_SIZE, new Identifier("textures/gui/sprites/mtr/icon_right.png"), new Identifier("textures/gui/sprites/mtr/icon_right_highlighted.png"), button -> setPage(page + 1));
}
@Override
Delayed to the related changes become a part of official MTR builds.
下载最新的构建,实测有效。
Fixed in 57ba7e6
Before reporting, I have confirmed that
Describe the Bug
Task 1 翻译问题
在 MTR https://github.com/Minecraft-Transit-Railway/Minecraft-Transit-Railway/commit/9f094158e00657f7925e65d9c739173acc5c47ea 这个提交之后,IGui.insertTranslation 接收的翻译 key 从 String 变为了
TranslationProvider.TranslationHolder
在该 commit 之后的 MTR 与 TJMetro 一并使用时会出现类似如上错误。
TJMetro 中包含了与
IGui.insertTranslation
一并使用的翻译键,且Translation.TranslationHolder
中的构建方法为 private,临时解决方案如下(未经测试):Task 2 TexturedButtonWidgetExtension
TexturedButtonWidgetExtension
在 https://github.com/Minecraft-Transit-Railway/Minecraft-Mappings/commit/2d63e6681b05047a1ef14f24ae500b9d1bdeb927 这个 commit 后支持了 disabledTexture,并修改了函数签名,构建时会报如下错误解决方法:
使用
TexturedButtonWidgetHelper.create
替代new TexturedButtonWidgetExtension
参见:https://github.com/Minecraft-Transit-Railway/Minecraft-Transit-Railway/commit/65391824c4710e6b059d6c7d40d301e154204c4f
Reproduction Steps
1. 2. 3.
In-game Log and Crash Report
See above
Mod Loader
Fabric
Minecraft Version
1.20.4
Minecraft Transit Railway Version
https://github.com/Minecraft-Transit-Railway/Minecraft-Transit-Railway/commit/6c679943d1a4eb88c97c3fc496aa96ff4c828622 action build
Tianjin Metro Version
1.0.0-beta-1
Operating System
6.10.7-arch1-1
List of Mods or Modpack You Were Using
No related
Extra Information
No response