From d9dbe3915626e4cb2e40272cde71c5a5d4db2f27 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Wed, 8 Jun 2022 11:59:34 +0900 Subject: [PATCH] TBM 1.18.2: show team color in attack menu button If a Player is in a team that has a specific team color, that Player's name will be displayed with that color in the list of targets when selecting a target to attack in the Battle GUI. --- build.gradle | 2 +- .../burnedkirby/TurnBasedMinecraft/client/BattleGui.java | 4 ++-- .../TurnBasedMinecraft/client/EntitySelectionButton.java | 7 +++++++ .../TurnBasedMinecraft/common/TurnBasedMinecraftMod.java | 2 +- src/main/resources/META-INF/mods.toml | 2 +- src/main/resources/mcmod.info | 2 +- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 0cf856e..f0ed234 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ apply plugin: 'net.minecraftforge.gradle' //apply plugin: 'eclipse' //apply plugin: 'maven-publish' -version = "1.18.1" +version = "1.18.2" group = "com.burnedkirby.TurnBasedMinecraft" archivesBaseName = "TurnBasedMinecraft" diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/BattleGui.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/BattleGui.java index 22d1c87..66fe08e 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/BattleGui.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/BattleGui.java @@ -143,7 +143,7 @@ public class BattleGui extends Screen { for (Map.Entry e : TurnBasedMinecraftMod.proxy.getLocalBattle() .getSideAEntrySet()) { if (e.getValue().entity != null) { - addRenderableWidget(new EntitySelectionButton(width / 4 - 60, y, 120, 20, e.getValue().entity.getName().getString(), e.getKey(), true, (button) -> { + addRenderableWidget(new EntitySelectionButton(width / 4 - 60, y, 120, 20, e.getValue().entity.getDisplayName(), e.getKey(), true, (button) -> { buttonActionEvent(button, ButtonAction.ATTACK_TARGET); })); } else { @@ -161,7 +161,7 @@ public class BattleGui extends Screen { for (Map.Entry e : TurnBasedMinecraftMod.proxy.getLocalBattle() .getSideBEntrySet()) { if (e.getValue().entity != null) { - addRenderableWidget(new EntitySelectionButton(width * 3 / 4 - 60, y, 120, 20, e.getValue().entity.getName().getString(), e.getKey(), false, (button) -> { + addRenderableWidget(new EntitySelectionButton(width * 3 / 4 - 60, y, 120, 20, e.getValue().entity.getDisplayName(), e.getKey(), false, (button) -> { buttonActionEvent(button, ButtonAction.ATTACK_TARGET); })); } else { diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/EntitySelectionButton.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/EntitySelectionButton.java index 59cd729..bb424a5 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/EntitySelectionButton.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/EntitySelectionButton.java @@ -3,6 +3,7 @@ package com.burnedkirby.TurnBasedMinecraft.client; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.Button; +import net.minecraft.network.chat.Component; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.network.chat.TextComponent; @@ -17,6 +18,12 @@ public class EntitySelectionButton extends Button { this.isSideA = isSideA; } + public EntitySelectionButton(int x, int y, int widthIn, int heightIn, Component buttonTextComponent, int entityID, boolean isSideA, Button.OnPress onPress) { + super(x, y, widthIn, heightIn, buttonTextComponent, onPress); + this.entityID = entityID; + this.isSideA = isSideA; + } + public int getID() { return entityID; } diff --git a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/TurnBasedMinecraftMod.java b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/TurnBasedMinecraftMod.java index 0627ecd..e5ca288 100644 --- a/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/TurnBasedMinecraftMod.java +++ b/src/main/java/com/burnedkirby/TurnBasedMinecraft/common/TurnBasedMinecraftMod.java @@ -35,7 +35,7 @@ import org.apache.logging.log4j.Logger; public class TurnBasedMinecraftMod { public static final String MODID = "com_burnedkirby_turnbasedminecraft"; public static final String NAME = "Turn Based Minecraft Mod"; - public static final String VERSION = "1.18.1"; + public static final String VERSION = "1.18.2"; public static final String CONFIG_FILENAME = "TBM_Config.toml"; public static final String DEFAULT_CONFIG_FILENAME = "TBM_Config_DEFAULT.toml"; public static final String CONFIG_DIRECTORY = "config/TurnBasedMinecraft/"; diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 211bdd6..bee0cb9 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -15,7 +15,7 @@ license="MIT" # The modid of the mod modId="com_burnedkirby_turnbasedminecraft" #mandatory # The version number of the mod - there's a few well known ${} variables useable here or just hardcode it -version="1.18.1" #mandatory +version="1.18.2" #mandatory # A display name for the mod displayName="TurnBasedMinecraftMod" #mandatory # A URL to query for updates for this mod. See the JSON update specification diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index da37474..82d7aed 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "com_burnedkirby_turnbasedminecraft", "name": "Turn Based Minecraft", "description": "Changes battles to be turn-based.", - "version": "1.18.1", + "version": "1.18.2", "mcversion": "1.18.2", "url": "", "updateUrl": "",