Skip to content

Commit

Permalink
[Gui] Added more info to InfoHud
Browse files Browse the repository at this point in the history
- Changed DesyncMonitor values from relative to absolute
- Added hash to build
- Added version to hud
  • Loading branch information
ScribbleTAS committed Jul 26, 2024
1 parent b54196a commit cc86838
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 42 deletions.
12 changes: 7 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ plugins {
id 'fabric-loom' version "${loom_version}"
// legacy looming (loom plugin improvements)
id 'legacy-looming' version "${loom_version}"
id 'com.palantir.git-version' version '3.1.0'
}


// set basic properties
version = project.version
def hash = ""
if(project.release=="false") {
hash = "_"+versionDetails().gitHash.substring(0,7)
}
version = project.version+hash
group = project.group

// compile for java 8
Expand All @@ -18,7 +23,6 @@ loom {
accessWidenerPath = file('src/main/resources/tasmod.accesswidener')
// add log4jconfig
log4jConfigs.from(file('src/main/resources/log4j.xml'))

}

// dependency repositories
Expand Down Expand Up @@ -52,8 +56,6 @@ dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0'
}



// task for downloading KillTheRng
//task downloadKTRNG(type: Copy) {
//group 'tasmod'
Expand All @@ -70,7 +72,7 @@ compileJava{
processResources {
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft_version

filesMatching("fabric.mod.json") {
expand 'mod_url': project.mod_url, 'name': project.mod_name, 'mod_version': project.version, 'mod_description': project.mod_description, 'mod_sources': project.mod_sources, 'mod_email': project.mod_email
}
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ [email protected]
group=com.minecrafttas
artifact=TASmod-1.12.2
version=Beta1.0-SNAPSHOT
release=false
13 changes: 11 additions & 2 deletions src/main/java/com/minecrafttas/tasmod/TASmod.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import com.minecrafttas.tasmod.util.Scheduler;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.impl.FabricLoaderImpl;
import net.minecraft.server.MinecraftServer;

Expand All @@ -48,10 +49,12 @@
*/
public class TASmod implements ModInitializer, EventServerInit, EventServerStop {

private static MinecraftServer serverInstance;

public static final Logger LOGGER = LogManager.getLogger("TASmod");

public static String version = "dev";

private static MinecraftServer serverInstance;

public static PlaybackControllerServer playbackControllerServer = new PlaybackControllerServer();;

public static SavestateHandlerServer savestateHandlerServer;
Expand Down Expand Up @@ -82,6 +85,12 @@ public void onInitialize() {

LOGGER.info("Initializing TASmod");

String modVersion = FabricLoader.getInstance().getModContainer("tasmod").get().getMetadata().getVersion().getFriendlyString();

if (!"${mod_version}".equals(modVersion)) {
version = modVersion;
}

// Start ticksync
ticksyncServer = new TickSyncServer();

Expand Down
25 changes: 14 additions & 11 deletions src/main/java/com/minecrafttas/tasmod/gui/InfoHud.java
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ public void onDrawHotbar() {
}
ScaledResolution scaled = new ScaledResolution(Minecraft.getMinecraft());
drawCenteredString(Minecraft.getMinecraft().fontRenderer, "TASmod is still in development! Major issues may arise!", scaled.getScaledWidth() / 2, scaled.getScaledHeight() - 50, 0xFF8400);
drawString(Minecraft.getMinecraft().fontRenderer, TASmod.version, scaled.getScaledWidth() - Minecraft.getMinecraft().fontRenderer.getStringWidth(TASmod.version) - 2, scaled.getScaledHeight() - 10, 0xFFFFFF);
// drawCenteredString(Minecraft.getMinecraft().fontRenderer, Float.toString(TASmod.tickratechanger.ticksPerSecond), scaled.getScaledWidth() / 2, scaled.getScaledHeight() - 36, 0xFFFFFF);
}

Expand All @@ -523,27 +524,29 @@ private void drawRectWithText(String text, int x, int y, boolean rect) {
}

private String keystrokes() {
if (Display.isActive()) {
String out1 = "" + ChatFormatting.WHITE;
for (String mouse : TASmodClient.virtual.getCurrentMousePresses()) {
out1 = out1.concat(mouse + " ");
}

String out1 = "" + ChatFormatting.WHITE;
for (String mouse : TASmodClient.virtual.getCurrentMousePresses()) {
out1 = out1.concat(mouse + " ");
}
if (Display.isActive() || TASmodClient.controller.isPlayingback()) {
out1 = out1.concat("" + ChatFormatting.GREEN);
for (String mouse : TASmodClient.virtual.getNextMousePresses()) {
out1 = out1.concat(mouse + " ");
}
}

String out2 = "" + ChatFormatting.WHITE;
for (String key : TASmodClient.virtual.getCurrentKeyboardPresses()) {
out2 = out2.concat(key + " ");
}
String out2 = "" + ChatFormatting.WHITE;
for (String key : TASmodClient.virtual.getCurrentKeyboardPresses()) {
out2 = out2.concat(key + " ");
}
if (Display.isActive() || TASmodClient.controller.isPlayingback()) {
out2 = out2.concat("" + ChatFormatting.GREEN);
for (String key : TASmodClient.virtual.getNextKeyboardPresses()) {
out2 = out2.concat(key + " ");
}
return out1 + out2;
}
return "";
return out1 + out2;
}

private Pair<Integer, Integer> getScreenOffset(int x, int y, InfoLabel label) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,13 @@ public String getStatus(EntityPlayerSP player) {

public String getPos() {
if (currentValues != null && !TASmodClient.controller.isNothingPlaying()) {
EntityPlayerSP player = Minecraft.getMinecraft().player;
// EntityPlayerSP player = Minecraft.getMinecraft().player;
String[] values = new String[3];
values[0] = getFormattedString(player.posX - currentValues.values[0]);
values[1] = getFormattedString(player.posY - currentValues.values[1]);
values[2] = getFormattedString(player.posZ - currentValues.values[2]);

String out = "";
for (String val : values) {
if (val != null) {
out += val + " ";
}
}
lastPos = out;
values[0] = getFormattedString(/*player.posX - */currentValues.values[0]);
values[1] = getFormattedString(/*player.posY - */currentValues.values[1]);
values[2] = getFormattedString(/*player.posZ - */currentValues.values[2]);

lastPos = String.join(" ", values);
}
return lastPos;
}
Expand All @@ -194,19 +188,13 @@ public String getPos() {

public String getMotion() {
if (currentValues != null && !TASmodClient.controller.isNothingPlaying()) {
EntityPlayerSP player = Minecraft.getMinecraft().player;
// EntityPlayerSP player = Minecraft.getMinecraft().player;
String[] values = new String[3];
values[0] = getFormattedString(player.motionX - currentValues.values[3]);
values[1] = getFormattedString(player.motionY - currentValues.values[4]);
values[2] = getFormattedString(player.motionZ - currentValues.values[5]);

String out = "";
for (String val : values) {
if (val != null) {
out += val + " ";
}
}
lastMotion = out;
values[0] = getFormattedString(/*player.motionX - */currentValues.values[3]);
values[1] = getFormattedString(/*player.motionY - */currentValues.values[4]);
values[2] = getFormattedString(/*player.motionZ - */currentValues.values[5]);

lastMotion = String.join(" ", values);
}
return lastMotion;
}
Expand Down

0 comments on commit cc86838

Please sign in to comment.