Compare commits

...

4 commits

Author SHA1 Message Date
5914cad3fe Update Changelog.md, TBMM 1.26.2
All checks were successful
Build TurnBasedMC and create Release / check-release-exists (push) Successful in 1s
Build TurnBasedMC and create Release / build-and-create-release (push) Successful in 25s
2024-10-25 14:02:40 +09:00
c40c7ab570 Bump version to 1.26.2 2024-10-24 20:20:44 +09:00
ea4920a1b5 Update Changelog.md 2024-10-24 20:19:25 +09:00
16346da98c Show entities next to attack buttons in BattleGUI 2024-10-24 20:15:30 +09:00
5 changed files with 37 additions and 3 deletions

View file

@ -1,5 +1,13 @@
# Upcoming changes # Upcoming changes
## Version Forge-1.26.2
Show battling Entities next to their attack button in the BattleGUI.
# Version NeoForge-1.26.2
Show battling Entities next to their attack button in the BattleGUI.
# Version Forge-1.26.1 # Version Forge-1.26.1
Minor fixes/refactorings that should make the mod more robust. Minor fixes/refactorings that should make the mod more robust.

View file

@ -74,7 +74,7 @@ configured for them.)
Simply invoke `./gradlew build` in the mod directory and after some time the Simply invoke `./gradlew build` in the mod directory and after some time the
finished jar will be saved at finished jar will be saved at
`build/libs/TurnBasedMinecraft-NeoForge-1.26.1-all.jar` `build/libs/TurnBasedMinecraft-NeoForge-1.26.2-all.jar`
# Reproducibility # Reproducibility

View file

@ -37,7 +37,7 @@ mod_name=TurnBasedMinecraftMod
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=MIT mod_license=MIT
# The mod version. See https://semver.org/ # The mod version. See https://semver.org/
mod_version=1.26.1 mod_version=1.26.2
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources. # This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html # See https://maven.apache.org/guides/mini/guide-naming-conventions.html

View file

@ -10,7 +10,9 @@ import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.AbstractButton; import net.minecraft.client.gui.components.AbstractButton;
import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.InventoryScreen;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.LivingEntity;
import net.neoforged.neoforge.network.PacketDistributor; import net.neoforged.neoforge.network.PacketDistributor;
import java.util.ConcurrentModificationException; import java.util.ConcurrentModificationException;
@ -29,6 +31,7 @@ public class BattleGui extends Screen {
private boolean stateChanged; private boolean stateChanged;
private String info; private String info;
private Long waitMissingBattleTicks; private Long waitMissingBattleTicks;
private boolean showingEntities;
private enum MenuState { private enum MenuState {
MAIN_MENU(0), ATTACK_TARGET(1), ITEM_ACTION(2), WAITING(3), SWITCH_ITEM(4), USE_ITEM(5); MAIN_MENU(0), ATTACK_TARGET(1), ITEM_ACTION(2), WAITING(3), SWITCH_ITEM(4), USE_ITEM(5);
@ -93,6 +96,7 @@ public class BattleGui extends Screen {
state = MenuState.MAIN_MENU; state = MenuState.MAIN_MENU;
stateChanged = true; stateChanged = true;
waitMissingBattleTicks = null; waitMissingBattleTicks = null;
showingEntities = false;
} }
private void setState(MenuState state) { private void setState(MenuState state) {
@ -127,6 +131,7 @@ public class BattleGui extends Screen {
} }
stateChanged = false; stateChanged = false;
showingEntities = false;
clearWidgets(); clearWidgets();
switch (state) { switch (state) {
case MAIN_MENU: case MAIN_MENU:
@ -147,6 +152,7 @@ public class BattleGui extends Screen {
case ATTACK_TARGET: case ATTACK_TARGET:
info = "Who will you attack?"; info = "Who will you attack?";
int y = 30; int y = 30;
showingEntities = true;
try { try {
for (Map.Entry<Integer, Combatant> e : TurnBasedMinecraftMod.proxy.getLocalBattle() for (Map.Entry<Integer, Combatant> e : TurnBasedMinecraftMod.proxy.getLocalBattle()
.getSideAEntrySet()) { .getSideAEntrySet()) {
@ -263,6 +269,26 @@ public class BattleGui extends Screen {
} }
updateState(); updateState();
if (showingEntities) {
int y = 30;
try {
for (Map.Entry<Integer, Combatant> e : TurnBasedMinecraftMod.proxy.getLocalBattle().getSideAEntrySet()) {
if (e.getValue().entity instanceof LivingEntity lEntity) {
InventoryScreen.renderEntityInInventoryFollowsMouse(guiGraphics, width / 4 - 60 - 20, y, width / 4 - 60, y + 20, 7, 0.0F, mouseX, mouseY, lEntity);
}
y += 20;
}
} catch(ConcurrentModificationException e) {}
y = 30;
try {
for (Map.Entry<Integer, Combatant> e : TurnBasedMinecraftMod.proxy.getLocalBattle().getSideBEntrySet()) {
if (e.getValue().entity instanceof LivingEntity lEntity) {
InventoryScreen.renderEntityInInventoryFollowsMouse(guiGraphics, width * 3 / 4 - 60 + 120, y, width * 3 / 4 - 60 + 140, y + 20, 7, 0.0F, mouseX, mouseY, lEntity);
}
y += 20;
}
} catch(ConcurrentModificationException e) {}
}
super.render(guiGraphics, mouseX, mouseY, partialTicks); super.render(guiGraphics, mouseX, mouseY, partialTicks);

View file

@ -41,7 +41,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.26.1"; public static final String VERSION = "1.26.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/";