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.
This commit is contained in:
Stephen Seo 2022-06-08 11:59:34 +09:00
parent c46828c58a
commit d9dbe39156
6 changed files with 13 additions and 6 deletions

View file

@ -14,7 +14,7 @@ apply plugin: 'net.minecraftforge.gradle'
//apply plugin: 'eclipse' //apply plugin: 'eclipse'
//apply plugin: 'maven-publish' //apply plugin: 'maven-publish'
version = "1.18.1" version = "1.18.2"
group = "com.burnedkirby.TurnBasedMinecraft" group = "com.burnedkirby.TurnBasedMinecraft"
archivesBaseName = "TurnBasedMinecraft" archivesBaseName = "TurnBasedMinecraft"

View file

@ -143,7 +143,7 @@ public class BattleGui extends Screen {
for (Map.Entry<Integer, Combatant> e : TurnBasedMinecraftMod.proxy.getLocalBattle() for (Map.Entry<Integer, Combatant> e : TurnBasedMinecraftMod.proxy.getLocalBattle()
.getSideAEntrySet()) { .getSideAEntrySet()) {
if (e.getValue().entity != null) { 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); buttonActionEvent(button, ButtonAction.ATTACK_TARGET);
})); }));
} else { } else {
@ -161,7 +161,7 @@ public class BattleGui extends Screen {
for (Map.Entry<Integer, Combatant> e : TurnBasedMinecraftMod.proxy.getLocalBattle() for (Map.Entry<Integer, Combatant> e : TurnBasedMinecraftMod.proxy.getLocalBattle()
.getSideBEntrySet()) { .getSideBEntrySet()) {
if (e.getValue().entity != null) { 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); buttonActionEvent(button, ButtonAction.ATTACK_TARGET);
})); }));
} else { } else {

View file

@ -3,6 +3,7 @@ package com.burnedkirby.TurnBasedMinecraft.client;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.Button;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TextComponent;
@ -17,6 +18,12 @@ public class EntitySelectionButton extends Button {
this.isSideA = isSideA; 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() { public int getID() {
return entityID; return entityID;
} }

View file

@ -35,7 +35,7 @@ import org.apache.logging.log4j.Logger;
public class TurnBasedMinecraftMod { public class TurnBasedMinecraftMod {
public static final String MODID = "com_burnedkirby_turnbasedminecraft"; public static final String MODID = "com_burnedkirby_turnbasedminecraft";
public static final String NAME = "Turn Based Minecraft Mod"; 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 CONFIG_FILENAME = "TBM_Config.toml";
public static final String DEFAULT_CONFIG_FILENAME = "TBM_Config_DEFAULT.toml"; public static final String DEFAULT_CONFIG_FILENAME = "TBM_Config_DEFAULT.toml";
public static final String CONFIG_DIRECTORY = "config/TurnBasedMinecraft/"; public static final String CONFIG_DIRECTORY = "config/TurnBasedMinecraft/";

View file

@ -15,7 +15,7 @@ license="MIT"
# The modid of the mod # The modid of the mod
modId="com_burnedkirby_turnbasedminecraft" #mandatory modId="com_burnedkirby_turnbasedminecraft" #mandatory
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it # 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 # A display name for the mod
displayName="TurnBasedMinecraftMod" #mandatory displayName="TurnBasedMinecraftMod" #mandatory
# A URL to query for updates for this mod. See the JSON update specification <here> # A URL to query for updates for this mod. See the JSON update specification <here>

View file

@ -3,7 +3,7 @@
"modid": "com_burnedkirby_turnbasedminecraft", "modid": "com_burnedkirby_turnbasedminecraft",
"name": "Turn Based Minecraft", "name": "Turn Based Minecraft",
"description": "Changes battles to be turn-based.", "description": "Changes battles to be turn-based.",
"version": "1.18.1", "version": "1.18.2",
"mcversion": "1.18.2", "mcversion": "1.18.2",
"url": "", "url": "",
"updateUrl": "", "updateUrl": "",