diff --git a/src/main/java/org/teacon/signin/client/GuideMapScreen.java b/src/main/java/org/teacon/signin/client/GuideMapScreen.java index 8b4160b..598ae90 100644 --- a/src/main/java/org/teacon/signin/client/GuideMapScreen.java +++ b/src/main/java/org/teacon/signin/client/GuideMapScreen.java @@ -16,6 +16,7 @@ import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3i; import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TranslationTextComponent; import org.teacon.signin.SignMeUp; import org.teacon.signin.data.GuideMap; @@ -52,6 +53,7 @@ public final class GuideMapScreen extends Screen { private final List waypointIds; private ImageButton leftFlip, rightFlip; + private ImageButton mapTriggerPrev, mapTriggerNext; private final List mapTriggers = Lists.newArrayList(); private final ListMultimap waypointTriggers = ArrayListMultimap.create(); @@ -73,6 +75,10 @@ protected void init() { this.leftFlip = this.addButton(new ImageButton(x1 + 7, y0 + 20, 10, 54, 155, 163, 0, GUIDE_MAP_RIGHT, new FlipHandler(1))); this.rightFlip = this.addButton(new ImageButton(x1 + 93, y0 + 20, 10, 54, 167, 163, 0, GUIDE_MAP_RIGHT, new FlipHandler(-1))); + // Prev and next page for map triggers + this.mapTriggerPrev = this.addButton(new ImageButton(x0 + 6, y0 + 138, 33, 17, 66, 163, 19, GUIDE_MAP_LEFT, (btn) -> --this.mapTriggerPage)); + this.mapTriggerNext = this.addButton(new ImageButton(x0 + 39, y0 + 138, 33, 17, 99, 163, 19, GUIDE_MAP_LEFT, (btn) -> ++this.mapTriggerPage)); + // Setup trigger buttons from GuideMap List mapTriggerIds = this.map.getTriggerIds(); for (int i = 0, mapTriggerIdSize = mapTriggerIds.size(); i < mapTriggerIdSize; ++i) { @@ -105,7 +111,7 @@ protected void init() { double distance = Math.sqrt(wp.getActualLocation().distanceSq(this.playerLocation, true)); this.renderTooltip(transform, Arrays.asList( wp.getTitle().func_241878_f(), - new TranslationTextComponent("sign_me_in.waypoint.distance", + new TranslationTextComponent("sign_up.waypoint.distance", Math.round(distance * 10.0) / 10.0).func_241878_f() ), mouseX, mouseY); }, wp.getTitle())); @@ -125,6 +131,8 @@ protected void init() { @Override public void tick() { + this.mapTriggerPrev.visible = this.mapTriggerPage >= 1; + this.mapTriggerNext.visible = this.mapTriggerPage < this.mapTriggerPageSize - 1; Waypoint wp = this.selectedWaypoint == null ? null : SignMeUp.MANAGER.findWaypoint(this.selectedWaypoint); this.leftFlip.visible = this.rightFlip.visible = wp != null && !wp.isDisabled() && wp.hasMoreThanOneImage(); for (Map.Entry entry : this.waypointTriggers.entries()) { @@ -152,6 +160,12 @@ public void render(MatrixStack transforms, int mouseX, int mouseY, float partial } private void renderTextCollection(FontRenderer font, MatrixStack transforms, int x0, int y0, int x1) { + // Display labels for prev and next page buttons + final int prevColor = this.mapTriggerPrev.visible ? 0x404040 : 0xFFFFFF; + final int nextColor = this.mapTriggerNext.visible ? 0x404040 : 0xFFFFFF; + ITextComponent prevPage = new StringTextComponent("<"), nextPage = new StringTextComponent(">"); + font.drawText(transforms, prevPage, x0 + 23F - font.getStringPropertyWidth(prevPage) / 2F, y0 + 143F, prevColor); + font.drawText(transforms, nextPage, x0 + 56F - font.getStringPropertyWidth(nextPage) / 2F, y0 + 143F, nextColor); // Display the subtitle/desc of the map if no waypoint is selected ITextComponent title = this.map.getTitle(), subtitle = this.map.getSubtitle(), desc = this.map.getDesc(); if (this.selectedWaypoint != null) { @@ -206,6 +220,7 @@ private void renderBackgroundTexture(Minecraft mc, MatrixStack transforms, int x RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); mc.textureManager.bindTexture(GUIDE_MAP_LEFT); blit(transforms, x0, y0, 0, 0, 211, 161); + blit(transforms, x0 + 6, y0 + 138, 66, 201, 66, 17); mc.textureManager.bindTexture(GUIDE_MAP_RIGHT); blit(transforms, x1 + 5, y0, 5, 0, 174, 161); } diff --git a/src/main/java/org/teacon/signin/data/GuideMap.java b/src/main/java/org/teacon/signin/data/GuideMap.java index 71e62d7..72b7220 100644 --- a/src/main/java/org/teacon/signin/data/GuideMap.java +++ b/src/main/java/org/teacon/signin/data/GuideMap.java @@ -43,7 +43,7 @@ public final class GuideMap { List triggerIds = Collections.emptyList(); public ITextComponent getTitle() { - return this.title != null ? this.title : new TranslationTextComponent("sign_me_in.map.unnamed"); + return this.title != null ? this.title : new TranslationTextComponent("sign_up.map.unnamed"); } public ITextComponent getSubtitle() { diff --git a/src/main/java/org/teacon/signin/data/Trigger.java b/src/main/java/org/teacon/signin/data/Trigger.java index adc3a9f..516e69d 100644 --- a/src/main/java/org/teacon/signin/data/Trigger.java +++ b/src/main/java/org/teacon/signin/data/Trigger.java @@ -33,7 +33,7 @@ public final class Trigger implements PlayerTracker { transient Set visiblePlayers = Collections.newSetFromMap(new WeakHashMap<>()); public ITextComponent getTitle() { - return this.title == null ? new TranslationTextComponent("sign_me_in.trigger.unnamed") : this.title; + return this.title == null ? new TranslationTextComponent("sign_up.trigger.unnamed") : this.title; } public ITextComponent getDesc() { diff --git a/src/main/java/org/teacon/signin/data/Waypoint.java b/src/main/java/org/teacon/signin/data/Waypoint.java index 528e577..6da6baa 100644 --- a/src/main/java/org/teacon/signin/data/Waypoint.java +++ b/src/main/java/org/teacon/signin/data/Waypoint.java @@ -105,7 +105,7 @@ public JsonElement serialize(Location src, Type typeOfSrc, JsonSerializationCont transient Set visiblePlayers = Collections.newSetFromMap(new WeakHashMap<>()); public ITextComponent getTitle() { - return title == null ? new TranslationTextComponent("sign_me_in.waypoint.unnamed") : this.title; + return title == null ? new TranslationTextComponent("sign_up.waypoint.unnamed") : this.title; } public ITextComponent getDesc() { diff --git a/src/main/resources/assets/sign_up/lang/en_us.json b/src/main/resources/assets/sign_up/lang/en_us.json index adf07c4..80d5143 100644 --- a/src/main/resources/assets/sign_up/lang/en_us.json +++ b/src/main/resources/assets/sign_up/lang/en_us.json @@ -2,10 +2,10 @@ "sign_up.keybinding": "Sign me Up", "sign_up.keybinding.open_map": "Open guide map", - "sign_me_in.map.unnamed": "New Guide Map", - "sign_me_in.waypoint.unnamed": "New Waypoint", - "sign_me_in.waypoint.distance": "%1$s block(s) away from you", - "sign_me_in.trigger.unnamed": "New Trigger", + "sign_up.map.unnamed": "New Guide Map", + "sign_up.waypoint.unnamed": "New Waypoint", + "sign_up.waypoint.distance": "%1$s block(s) away from you", + "sign_up.trigger.unnamed": "New Trigger", "sign_up.status.no_map_available": "No maps currently available :( or you might be outside of map range", diff --git a/src/main/resources/assets/sign_up/lang/zh_cn.json b/src/main/resources/assets/sign_up/lang/zh_cn.json index aa44a78..f94694a 100644 --- a/src/main/resources/assets/sign_up/lang/zh_cn.json +++ b/src/main/resources/assets/sign_up/lang/zh_cn.json @@ -2,10 +2,10 @@ "sign_up.keybinding": "签到", "sign_up.keybinding.open_map": "打开导引图", - "sign_me_in.map.unnamed": "新的导引图", - "sign_me_in.waypoint.unnamed": "新的导引点", - "sign_me_in.waypoint.distance": "这个点距离你的直线距离为 %1$s 方块", - "sign_me_in.trigger.unnamed": "新的触发器", + "sign_up.map.unnamed": "新的导引图", + "sign_up.waypoint.unnamed": "新的导引点", + "sign_up.waypoint.distance": "这个点距离你的直线距离为 %1$s 方块", + "sign_up.trigger.unnamed": "新的触发器", "sign_up.status.no_map_available": "没有可供查看的导引图 :( 或者您可能在导引图范围之外",