minor fixes

This commit is contained in:
Stachelbeere1248 2024-03-10 12:44:21 +01:00
parent 33ee87f506
commit af67a59000
Signed by: Stachelbeere1248
SSH key fingerprint: SHA256:IozEKdw2dB8TZxkpPdMxcWSoWTIMwoLaCcZJ1AJnY2o
4 changed files with 10 additions and 23 deletions

View file

@ -16,12 +16,11 @@ import org.jetbrains.annotations.NotNull;
public class ZombiesUtils {
private static ZombiesUtils instance;
private final Hotkeys hotkeys;
private final Handlers handlers;
private Handlers handlers;
private Logger logger;
public ZombiesUtils() {
hotkeys = new Hotkeys();
handlers = new Handlers();
instance = this;
}
@ -41,6 +40,7 @@ public class ZombiesUtils {
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
handlers = new Handlers();
handlers.registerAll();
CommandRegistry.registerAll();
hotkeys.registerAll();

View file

@ -1,18 +1,4 @@
package com.github.stachelbeere1248.zombiesutils.game.enums;
import org.jetbrains.annotations.NotNull;
public enum Map {
DEAD_END, BAD_BLOOD, ALIEN_ARCADIUM, PRISON;
@Override
public @NotNull String toString() {
switch (this) {
case DEAD_END: return "Dead End";
case BAD_BLOOD: return "Bad Blood";
case ALIEN_ARCADIUM: return "Alien Arcadium";
case PRISON: return "Prison";
default: throw new IllegalStateException("Unexpected Map value:" + this);
}
}
}

View file

@ -18,21 +18,22 @@ public class Waves {
@Contract(pure = true)
public static byte[] get(@NotNull Map map, byte round) {
byte[] ret = new byte[0];
byte[] ret = new byte[]{ 0 };
try {
switch (map) {
case DEAD_END:
ret = deadEndWaveTimes[round - 1];
break;
case BAD_BLOOD:
ret = badBloodWaveTimes[round - 1];
break;
case ALIEN_ARCADIUM:
ret = alienArcadiumWaveTimes[round - 1];
default:
throw new IllegalStateException("Unexpected value: " + map);
break;
}
} catch (ArrayIndexOutOfBoundsException e) {
} catch (ArrayIndexOutOfBoundsException ignored) {
Minecraft.getMinecraft().thePlayer.addChatMessage(
new ChatComponentText("Achievement get: Round " + round + map)
new ChatComponentText("Achievement get: Round " + round + " " + map)
);
}
return ret;

View file

@ -135,7 +135,7 @@ public class RenderGameOverlayHandler {
}
}
public void renderCPS() {
final String cps = String.format("%2.1f", getClicks());
final String cps = String.format("%2d", getClicks());
final ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
final int screenWidth = scaledResolution.getScaledWidth();
final int width = fontRenderer.getStringWidth(cps);
@ -148,7 +148,7 @@ public class RenderGameOverlayHandler {
);
}
public double getClicks() {
public int getClicks() {
int i = 0;
for (boolean tick : clicks) {
if (tick) i++;