diff --git a/gradle.properties b/gradle.properties index ea5dff2..5d84190 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,4 +3,4 @@ org.gradle.jvmargs=-Xmx2g baseGroup = com.github.stachelbeere1248.zombiesutils mcVersion = 1.8.9 modid = zombiesutils -version = 1.3 +version = 1.3.0-PREVIEW_3 \ No newline at end of file diff --git a/src/main/java/com/github/stachelbeere1248/zombiesutils/commands/CategoryCommand.java b/src/main/java/com/github/stachelbeere1248/zombiesutils/commands/CategoryCommand.java index aa8a09f..707f4cf 100644 --- a/src/main/java/com/github/stachelbeere1248/zombiesutils/commands/CategoryCommand.java +++ b/src/main/java/com/github/stachelbeere1248/zombiesutils/commands/CategoryCommand.java @@ -7,6 +7,7 @@ import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; import org.jetbrains.annotations.NotNull; import java.io.File; @@ -41,6 +42,7 @@ public class CategoryCommand implements ICommand { if (cat.contains(File.separator)) throw new WrongUsageException("Your name must not contain '" + File.separator + "' as this is the systems separator character for folder" + File.separator + "sub-folder"); Category.setSelectedCategory(cat); + sender.addChatMessage(new ChatComponentText("§eSet category to §c" + cat)); Timer.getInstance().ifPresent(timer -> timer.setCategory(new Category())); } } diff --git a/src/main/java/com/github/stachelbeere1248/zombiesutils/config/ZombiesUtilsConfig.java b/src/main/java/com/github/stachelbeere1248/zombiesutils/config/ZombiesUtilsConfig.java index f2a83e4..58f4a38 100644 --- a/src/main/java/com/github/stachelbeere1248/zombiesutils/config/ZombiesUtilsConfig.java +++ b/src/main/java/com/github/stachelbeere1248/zombiesutils/config/ZombiesUtilsConfig.java @@ -27,6 +27,7 @@ public class ZombiesUtilsConfig { private Property copyDelta; private Property cpsCounter; private Property announcePB; + private Property playerVis; public ZombiesUtilsConfig(Configuration config) { this.config = config; @@ -120,6 +121,12 @@ public class ZombiesUtilsConfig { "T", "The Text to be sent when pressing the chat-macro hotkey" ); + playerVis = config.get( + Configuration.CATEGORY_GENERAL, + "playervis", + false, + "If players should always be visible" + ); cpsCounter = config.get( Configuration.CATEGORY_GENERAL, "cps", @@ -154,11 +161,12 @@ public class ZombiesUtilsConfig { List getRootElements() { return Arrays.asList( - new DummyConfigElement.DummyCategoryElement("Timer", "", getSpawntimeElements()), - new DummyConfigElement.DummyCategoryElement("SST", "", getSpawntimeElements()), - new DummyConfigElement.DummyCategoryElement("SLA", "", getSpawntimeElements()), new CustomConfigElement("Language", language), + new DummyConfigElement.DummyCategoryElement("Timer", "", getTimerElements()), + new DummyConfigElement.DummyCategoryElement("SST", "", getSpawntimeElements()), + new DummyConfigElement.DummyCategoryElement("SLA", "", getSlaElements()), new CustomConfigElement("Macro message", chatMacro), + new CustomConfigElement("Player visibility", playerVis), new CustomConfigElement("CPS counter", cpsCounter) ); @@ -211,6 +219,9 @@ public class ZombiesUtilsConfig { public boolean getAnnouncePB() { return announcePB.getBoolean(); } + public boolean getPlayerVis() { + return playerVis.getBoolean(); + } @SubscribeEvent public void onConfigChange(ConfigChangedEvent.@NotNull OnConfigChangedEvent event) { diff --git a/src/main/java/com/github/stachelbeere1248/zombiesutils/game/GameMode.java b/src/main/java/com/github/stachelbeere1248/zombiesutils/game/GameMode.java index b7686a5..284b56c 100644 --- a/src/main/java/com/github/stachelbeere1248/zombiesutils/game/GameMode.java +++ b/src/main/java/com/github/stachelbeere1248/zombiesutils/game/GameMode.java @@ -30,6 +30,7 @@ public class GameMode { switch (map) { case DEAD_END: case BAD_BLOOD: + case PRISON: this.difficulty = difficulty; break; case ALIEN_ARCADIUM: diff --git a/src/main/java/com/github/stachelbeere1248/zombiesutils/game/SLA.java b/src/main/java/com/github/stachelbeere1248/zombiesutils/game/SLA.java index 246714b..73b549d 100644 --- a/src/main/java/com/github/stachelbeere1248/zombiesutils/game/SLA.java +++ b/src/main/java/com/github/stachelbeere1248/zombiesutils/game/SLA.java @@ -6,6 +6,7 @@ import com.github.stachelbeere1248.zombiesutils.game.windows.Room; import com.github.stachelbeere1248.zombiesutils.game.windows.Window; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.util.ChatComponentText; import org.jetbrains.annotations.NotNull; import java.util.Arrays; @@ -28,6 +29,10 @@ public class SLA { case ALIEN_ARCADIUM: this.rooms = Room.getAA(); break; + case PRISON: + this.rooms = new Room[0]; + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("$cThis map has no SLA database yet. Contribute by dming Stachelbeere1248 coordinates for windows on Discord.")); + break; default: throw new IllegalStateException("Unexpected value: " + map); } @@ -68,7 +73,7 @@ public class SLA { ZombiesUtils.getInstance().getLogger().info("Window \"0\" is now at %s %s %s" + (double) win0[0] / 2 + (double) win0[1] / 2 + (double) win0[2] / 2); } - public void refreshActives() { + private void refreshActives() { final EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; final double[] playerCoords = { (player.posX - offset[0]), @@ -95,7 +100,8 @@ public class SLA { } public Room[] getRooms() { - return rooms; + this.refreshActives(); + return this.rooms; } public void resetOffset() { diff --git a/src/main/java/com/github/stachelbeere1248/zombiesutils/game/waves/WaveTiming.java b/src/main/java/com/github/stachelbeere1248/zombiesutils/game/waves/WaveTiming.java index bcc2f85..6021a80 100644 --- a/src/main/java/com/github/stachelbeere1248/zombiesutils/game/waves/WaveTiming.java +++ b/src/main/java/com/github/stachelbeere1248/zombiesutils/game/waves/WaveTiming.java @@ -27,6 +27,7 @@ public class WaveTiming { public static void onTick() { if (Scoreboard.isNotZombies()) return; + //TODO: Assert correct server number! Timer.getInstance().ifPresent(timer -> { byte[] waves = getWaves(timer); final int roundTime = timer.roundTime(); diff --git a/src/main/java/com/github/stachelbeere1248/zombiesutils/game/waves/Waves.java b/src/main/java/com/github/stachelbeere1248/zombiesutils/game/waves/Waves.java index 2595ecf..c2d497e 100644 --- a/src/main/java/com/github/stachelbeere1248/zombiesutils/game/waves/Waves.java +++ b/src/main/java/com/github/stachelbeere1248/zombiesutils/game/waves/Waves.java @@ -8,13 +8,11 @@ import org.jetbrains.annotations.NotNull; @SuppressWarnings("DuplicatedCode") public class Waves { - private static final byte[][] deadEndWaveTimes = {{10, 20}, {10, 20}, {10, 20, 35}, {10, 20, 35}, {10, 22, 37}, {10, 22, 44}, {10, 25, 47}, {10, 25, 50}, {10, 22, 38}, {10, 24, 45}, {10, 25, 48}, {10, 25, 50}, {10, 25, 50}, {10, 25, 45}, {10, 25, 46}, {10, 24, 47}, {10, 24, 47}, {10, 24, 47}, {10, 24, 47}, {10, 24, 49}, {10, 23, 44}, {10, 23, 45}, {10, 23, 42}, {10, 23, 43}, {10, 23, 43}, {10, 23, 36}, {10, 24, 44}, {10, 24, 42}, {10, 24, 42}, {10, 24, 45}}, + private static final byte[][] + deadEndWaveTimes = {{10, 20}, {10, 20}, {10, 20, 35}, {10, 20, 35}, {10, 22, 37}, {10, 22, 44}, {10, 25, 47}, {10, 25, 50}, {10, 22, 38}, {10, 24, 45}, {10, 25, 48}, {10, 25, 50}, {10, 25, 50}, {10, 25, 45}, {10, 25, 46}, {10, 24, 47}, {10, 24, 47}, {10, 24, 47}, {10, 24, 47}, {10, 24, 49}, {10, 23, 44}, {10, 23, 45}, {10, 23, 42}, {10, 23, 43}, {10, 23, 43}, {10, 23, 36}, {10, 24, 44}, {10, 24, 42}, {10, 24, 42}, {10, 24, 45}}, badBloodWaveTimes = {{10, 22}, {10, 22}, {10, 22}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34}, {10, 24, 38}, {10, 24, 38}, {10, 22, 34}, {10, 24, 38}, {10, 22, 34}}, - alienArcadiumWaveTimes = {{10, 13, 16, 19}, {10, 14, 18, 22}, {10, 13, 16, 19}, {10, 14, 17, 21, 25, 28}, {10, 14, 18, 22, 26, 30}, {10, 14, 19, 23, 28, 32}, {10, 15, 19, 23, 27, 31}, {10, 15, 20, 25, 30, 35}, {10, 14, 19, 23, 28, 32}, {10, 16, 22, 27, 33, 38}, {10, 16, 21, 27, 32, 38}, {10, 16, 22, 28, 34, 40}, {10, 16, 22, 28, 34, 40}, {10, 16, 21, 26, 31, 36}, {10, 17, 24, 31, 38, 46}, {10, 16, 22, 27, 33, 38}, {10, 14, 19, 23, 28, 32}, {10, 14, 19, 23, 28, 32}, {10, 14, 18, 22, 26, 30}, {10, 15, 21, 26, 31, 36}, {10, 14, 19, 23, 28, 32}, {10, 14, 19, 23, 28, 34}, {10, 14, 18, 22, 26, 30}, {10, 14, 19, 23, 28, 32}, {10}, {10, 23, 36}, {10, 22, 34}, {10, 20, 30}, {10, 24, 38}, {10, 22, 34}, {10, 22, 34}, {10, 21, 32}, {10, 22, 34}, {10, 22, 34}, {10}, {10, 22, 34}, {10, 20, 31}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34, 37, 45}, {10, 21, 32}, {10, 22, 34}, {10, 13, 22, 25, 34, 37}, {10, 22, 34}, {10, 22, 34, 35}, {10, 21, 32, 35}, {10, 20, 30}, {10, 20, 30, 33}, {10, 21, 32}, {10, 22, 34, 37}, {10, 20, 30, 33}, {10, 22, 34, 37}, {10, 22, 34, 37}, {10, 20, 32, 35, 39}, {10, 16, 22, 28, 34, 40}, {10, 14, 18}, {10, 14, 18}, {10, 22, 34, 37, 38}, {10, 14, 18, 22, 26, 30}, {10, 20, 30, 33}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 27, 32}, {10, 14, 18, 22, 27, 32}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {5}, {5}, {5}, {5}, {5}}; - private static final short[] deadEndRoundTimesSum = {0, 20, 40, 75, 110, 147, 191, 238, 288, 326, 371, 419, 469, 519, 564, 610, 657, 704, 751, 798, 847, 891, 936, 978, 1021, 1064, 1100, 1144, 1186, 1228, 1273}, - badBloodRoundTimesSum = {0, 22, 44, 66, 100, 134, 168, 202, 236, 270, 304, 338, 372, 406, 440, 474, 508, 542, 576, 610, 644, 678, 712, 746, 780, 814, 852, 890, 924, 962, 996}, - alienArcadiumRoundTimesSum = {0, 19, 41, 60, 88, 118, 150, 181, 216, 248, 286, 324, 364, 404, 440, 486, 524, 556, 588, 618, 654, 686, 720, 750, 782, 792, 828, 862, 892, 930, 964, 998, 1030, 1064, 1098, 1108, 1142, 1173, 1207, 1241, 1286, 1318, 1352, 1389, 1423, 1458, 1493, 1523, 1556, 1588, 1625, 1658, 1695, 1732, 1771, 1811, 1829, 1847, 1885, 1915, 1948, 1978, 2008, 2038, 2068, 2098, 2128, 2158, 2188, 2218, 2248, 2278, 2308, 2338, 2368, 2400, 2432, 2462, 2492, 2522, 2552, 2582, 2612, 2642, 2672, 2702, 2732, 2762, 2792, 2822, 2852, 2882, 2912, 2942, 2972, 3002, 3032, 3062, 3092, 3122, 3152, 3157, 3162, 3167, 3172, 3177}; - + alienArcadiumWaveTimes = {{10, 13, 16, 19}, {10, 14, 18, 22}, {10, 13, 16, 19}, {10, 14, 17, 21, 25, 28}, {10, 14, 18, 22, 26, 30}, {10, 14, 19, 23, 28, 32}, {10, 15, 19, 23, 27, 31}, {10, 15, 20, 25, 30, 35}, {10, 14, 19, 23, 28, 32}, {10, 16, 22, 27, 33, 38}, {10, 16, 21, 27, 32, 38}, {10, 16, 22, 28, 34, 40}, {10, 16, 22, 28, 34, 40}, {10, 16, 21, 26, 31, 36}, {10, 17, 24, 31, 38, 46}, {10, 16, 22, 27, 33, 38}, {10, 14, 19, 23, 28, 32}, {10, 14, 19, 23, 28, 32}, {10, 14, 18, 22, 26, 30}, {10, 15, 21, 26, 31, 36}, {10, 14, 19, 23, 28, 32}, {10, 14, 19, 23, 28, 34}, {10, 14, 18, 22, 26, 30}, {10, 14, 19, 23, 28, 32}, {10}, {10, 23, 36}, {10, 22, 34}, {10, 20, 30}, {10, 24, 38}, {10, 22, 34}, {10, 22, 34}, {10, 21, 32}, {10, 22, 34}, {10, 22, 34}, {10}, {10, 22, 34}, {10, 20, 31}, {10, 22, 34}, {10, 22, 34}, {10, 22, 34, 37, 45}, {10, 21, 32}, {10, 22, 34}, {10, 13, 22, 25, 34, 37}, {10, 22, 34}, {10, 22, 34, 35}, {10, 21, 32, 35}, {10, 20, 30}, {10, 20, 30, 33}, {10, 21, 32}, {10, 22, 34, 37}, {10, 20, 30, 33}, {10, 22, 34, 37}, {10, 22, 34, 37}, {10, 20, 32, 35, 39}, {10, 16, 22, 28, 34, 40}, {10, 14, 18}, {10, 14, 18}, {10, 22, 34, 37, 38}, {10, 14, 18, 22, 26, 30}, {10, 20, 30, 33}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 27, 32}, {10, 14, 18, 22, 27, 32}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {10, 14, 18, 22, 26, 30}, {5}, {5}, {5}, {5}, {5}}, + prisonWaveTimes = {{10, 20}, {10, 20, 30}, {10, 17, 24, 31}, {10, 17, 24, 31}, {10, 20, 30}, {10, 20, 30}, {10, 20, 30}, {10, 25, 40}, {10, 25, 35}, {10, 25, 45}, {10, 25, 40}, {10, 25, 37}, {10, 22, 34}, {10, 25, 37}, {10, 25, 40}, {10, 22, 37}, {10, 22, 42}, {10, 25, 45}, {10, 25, 45}, {10, 25, 40}, {10, 20, 35, 55, 75}, {10, 25, 40}, {10, 30, 50}, {10, 30, 50}, {10, 25, 45}, {10, 30, 50}, {10, 25, 45}, {10, 30, 50}, {10, 30, 55}, {10}}; @Contract(pure = true) public static byte[] get(@NotNull Map map, byte round) { @@ -30,6 +28,9 @@ public class Waves { case ALIEN_ARCADIUM: ret = alienArcadiumWaveTimes[round - 1]; break; + case PRISON: + ret = prisonWaveTimes[round - 1]; + break; } } catch (ArrayIndexOutOfBoundsException ignored) { Minecraft.getMinecraft().thePlayer.addChatMessage( @@ -39,24 +40,6 @@ public class Waves { return ret; } - public static short getSum(@NotNull Map map, byte round) { - short sum; - switch (map) { - case DEAD_END: - sum = deadEndRoundTimesSum[round - 1]; - break; - case BAD_BLOOD: - sum = badBloodRoundTimesSum[round - 1]; - break; - case ALIEN_ARCADIUM: - sum = alienArcadiumRoundTimesSum[round - 1]; - break; - default: - throw new IllegalStateException("Unexpected value: " + map); - } - return sum; - } - public static byte getLastWave(@NotNull Map map, byte round) { byte[] aByte = get(map, round); return aByte[aByte.length - 1]; diff --git a/src/main/java/com/github/stachelbeere1248/zombiesutils/handlers/Handlers.java b/src/main/java/com/github/stachelbeere1248/zombiesutils/handlers/Handlers.java index 2e61f87..0533db2 100644 --- a/src/main/java/com/github/stachelbeere1248/zombiesutils/handlers/Handlers.java +++ b/src/main/java/com/github/stachelbeere1248/zombiesutils/handlers/Handlers.java @@ -16,6 +16,7 @@ public class Handlers { MinecraftForge.EVENT_BUS.register(new TickHandler()); MinecraftForge.EVENT_BUS.register(new ChatHandler()); MinecraftForge.EVENT_BUS.register(new KeyInputHandler()); + MinecraftForge.EVENT_BUS.register(new RenderPlayerHandler()); } public RenderGameOverlayHandler getRenderer() { diff --git a/src/main/java/com/github/stachelbeere1248/zombiesutils/handlers/KeyInputHandler.java b/src/main/java/com/github/stachelbeere1248/zombiesutils/handlers/KeyInputHandler.java index 2986423..597a2f2 100644 --- a/src/main/java/com/github/stachelbeere1248/zombiesutils/handlers/KeyInputHandler.java +++ b/src/main/java/com/github/stachelbeere1248/zombiesutils/handlers/KeyInputHandler.java @@ -15,6 +15,7 @@ public class KeyInputHandler { public void onKeyInput(InputEvent event) { if (Minecraft.getMinecraft().currentScreen != null) return; if (event instanceof InputEvent.KeyInputEvent) { + if (Keyboard.getEventKey() == '\0') return; if (Keyboard.getEventKeyState()) { Hotkeys hotkeys = ZombiesUtils.getInstance().getHotkeys(); if (Keyboard.getEventKey() == hotkeys.getChatMacro().getKeyCode()) { diff --git a/src/main/java/com/github/stachelbeere1248/zombiesutils/handlers/RenderGameOverlayHandler.java b/src/main/java/com/github/stachelbeere1248/zombiesutils/handlers/RenderGameOverlayHandler.java index 6eec298..bc9cfec 100644 --- a/src/main/java/com/github/stachelbeere1248/zombiesutils/handlers/RenderGameOverlayHandler.java +++ b/src/main/java/com/github/stachelbeere1248/zombiesutils/handlers/RenderGameOverlayHandler.java @@ -59,10 +59,7 @@ public class RenderGameOverlayHandler { ); }); - SLA.getInstance().ifPresent(sla -> { - sla.refreshActives(); - renderSla(sla.getRooms()); - }); + SLA.getInstance().ifPresent(sla -> renderSla(sla.getRooms())); if (ZombiesUtils.getInstance().getConfig().getCpsToggle()) renderCPS(); } diff --git a/src/main/java/com/github/stachelbeere1248/zombiesutils/handlers/RenderPlayerHandler.java b/src/main/java/com/github/stachelbeere1248/zombiesutils/handlers/RenderPlayerHandler.java new file mode 100644 index 0000000..77d15c4 --- /dev/null +++ b/src/main/java/com/github/stachelbeere1248/zombiesutils/handlers/RenderPlayerHandler.java @@ -0,0 +1,21 @@ +package com.github.stachelbeere1248.zombiesutils.handlers; + +import com.github.stachelbeere1248.zombiesutils.ZombiesUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.util.Vec3; +import net.minecraftforge.client.event.RenderPlayerEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.jetbrains.annotations.NotNull; + +public class RenderPlayerHandler { + @SubscribeEvent + public void onRender(RenderPlayerEvent.@NotNull Pre event) { + if (inRange(event.entityPlayer.getPositionVector())) { + event.setCanceled(!ZombiesUtils.getInstance().getConfig().getPlayerVis()); + } + } + + private boolean inRange(Vec3 playerOther) { + return playerOther.squareDistanceTo(Minecraft.getMinecraft().thePlayer.getPositionVector()) <= 16; + } +} diff --git a/src/main/java/com/github/stachelbeere1248/zombiesutils/mixin/MixinNetHandlerPlayClient.java b/src/main/java/com/github/stachelbeere1248/zombiesutils/mixin/MixinNetHandlerPlayClient.java index 381c113..59b9bc5 100644 --- a/src/main/java/com/github/stachelbeere1248/zombiesutils/mixin/MixinNetHandlerPlayClient.java +++ b/src/main/java/com/github/stachelbeere1248/zombiesutils/mixin/MixinNetHandlerPlayClient.java @@ -81,6 +81,7 @@ public class MixinNetHandlerPlayClient { switch (timer.getGameMode().getMap()) { case DEAD_END: case BAD_BLOOD: + case PRISON: timer.split((byte) 30); Timer.dropInstances(); break; diff --git a/src/main/java/com/github/stachelbeere1248/zombiesutils/timer/recorder/Category.java b/src/main/java/com/github/stachelbeere1248/zombiesutils/timer/recorder/Category.java index 6867f57..7a884fd 100644 --- a/src/main/java/com/github/stachelbeere1248/zombiesutils/timer/recorder/Category.java +++ b/src/main/java/com/github/stachelbeere1248/zombiesutils/timer/recorder/Category.java @@ -12,7 +12,7 @@ import java.io.File; public class Category { private static String selectedCategory = ZombiesUtils.getInstance().getConfig().getDefaultCategory(); - public final CategoryFile[] categoryFiles = new CategoryFile[7]; + public final CategoryFile[] categoryFiles = new CategoryFile[10]; private final String name; public Category() { @@ -28,6 +28,11 @@ public class Category { categoryFiles[5] = new CategoryFile(category, new GameMode(Map.BAD_BLOOD, Difficulty.RIP)); categoryFiles[6] = new CategoryFile(category, new GameMode(Map.ALIEN_ARCADIUM)); + + categoryFiles[7] = new CategoryFile(category, new GameMode(Map.PRISON)); + categoryFiles[8] = new CategoryFile(category, new GameMode(Map.PRISON, Difficulty.HARD)); + categoryFiles[9] = new CategoryFile(category, new GameMode(Map.PRISON, Difficulty.RIP)); + this.name = Category.selectedCategory; } @@ -45,15 +50,21 @@ public class Category { } public CategoryFile getByGameMode(@NotNull GameMode gameMode) { - if (gameMode.is(Map.DEAD_END, Difficulty.NORMAL)) return categoryFiles[0]; - else if (gameMode.is(Map.BAD_BLOOD, Difficulty.NORMAL)) return categoryFiles[3]; - else if (gameMode.is(Map.ALIEN_ARCADIUM, Difficulty.NORMAL)) return categoryFiles[6]; + + if (gameMode.is(Map.DEAD_END, Difficulty.NORMAL)) return categoryFiles[0]; else if (gameMode.is(Map.DEAD_END, Difficulty.HARD)) return categoryFiles[1]; else if (gameMode.is(Map.DEAD_END, Difficulty.RIP)) return categoryFiles[2]; + else if (gameMode.is(Map.BAD_BLOOD, Difficulty.NORMAL)) return categoryFiles[3]; else if (gameMode.is(Map.BAD_BLOOD, Difficulty.HARD)) return categoryFiles[4]; else if (gameMode.is(Map.BAD_BLOOD, Difficulty.RIP)) return categoryFiles[5]; + + else if (gameMode.is(Map.ALIEN_ARCADIUM, Difficulty.NORMAL)) return categoryFiles[6]; + + else if (gameMode.is(Map.PRISON, Difficulty.NORMAL)) return categoryFiles[7]; + else if (gameMode.is(Map.PRISON, Difficulty.HARD)) return categoryFiles[8]; + else if (gameMode.is(Map.PRISON, Difficulty.RIP)) return categoryFiles[9]; else throw new IllegalStateException("Unexpected value: " + gameMode); } diff --git a/src/main/java/com/github/stachelbeere1248/zombiesutils/timer/recorder/data/CategoryData.java b/src/main/java/com/github/stachelbeere1248/zombiesutils/timer/recorder/data/CategoryData.java index c7c5c5f..0a0b691 100644 --- a/src/main/java/com/github/stachelbeere1248/zombiesutils/timer/recorder/data/CategoryData.java +++ b/src/main/java/com/github/stachelbeere1248/zombiesutils/timer/recorder/data/CategoryData.java @@ -19,6 +19,7 @@ public class CategoryData implements ISplitsData { break; case DEAD_END: case BAD_BLOOD: + case PRISON: bestSegments = new short[30]; personalBests = new int[30]; break; diff --git a/src/main/java/com/github/stachelbeere1248/zombiesutils/timer/recorder/data/GameData.java b/src/main/java/com/github/stachelbeere1248/zombiesutils/timer/recorder/data/GameData.java index 561ca4e..80ece81 100644 --- a/src/main/java/com/github/stachelbeere1248/zombiesutils/timer/recorder/data/GameData.java +++ b/src/main/java/com/github/stachelbeere1248/zombiesutils/timer/recorder/data/GameData.java @@ -17,6 +17,7 @@ public class GameData implements ISplitsData { break; case DEAD_END: case BAD_BLOOD: + case PRISON: segments = new short[30]; break; default: diff --git a/src/main/java/com/github/stachelbeere1248/zombiesutils/utils/LanguageSupport.java b/src/main/java/com/github/stachelbeere1248/zombiesutils/utils/LanguageSupport.java index 3441e76..8e618d7 100644 --- a/src/main/java/com/github/stachelbeere1248/zombiesutils/utils/LanguageSupport.java +++ b/src/main/java/com/github/stachelbeere1248/zombiesutils/utils/LanguageSupport.java @@ -68,11 +68,11 @@ public class LanguageSupport { public static @NotNull Pattern mapPattern(@NotNull String language) { switch (language) { case "EN": - return Pattern.compile("Map:.*(Dead End|Bad Blood|Alien Arcadium)"); + return Pattern.compile("Map:.*(Dead End|Bad Blood|Alien Arcadium|Prison)"); case "FR": - return Pattern.compile("Carte:.*(Dead End|Bad Blood|Alien Arcadium)"); + return Pattern.compile("Carte:.*(Dead End|Bad Blood|Alien Arcadium|Prison)"); case "DE": - return Pattern.compile("Karte:.*(Dead End|Bad Blood|Alien Arcadium)"); + return Pattern.compile("Karte:.*(Dead End|Bad Blood|Alien Arcadium|Prison)"); default: throw new IllegalStateException("Unexpected value: " + language); } diff --git a/src/main/java/com/github/stachelbeere1248/zombiesutils/utils/Scoreboard.java b/src/main/java/com/github/stachelbeere1248/zombiesutils/utils/Scoreboard.java index 0f0e885..1c17f26 100644 --- a/src/main/java/com/github/stachelbeere1248/zombiesutils/utils/Scoreboard.java +++ b/src/main/java/com/github/stachelbeere1248/zombiesutils/utils/Scoreboard.java @@ -96,7 +96,7 @@ public class Scoreboard { public static Optional getMap() { String line; try { - line = lines.get(12); + line = lines.get(12); //TODO: This was changed! } catch (Exception couldBePregame) { try { line = lines.get(2); @@ -113,6 +113,8 @@ public class Scoreboard { return Optional.of(Map.BAD_BLOOD); case "Alien Arcadium": return Optional.of(Map.ALIEN_ARCADIUM); + case "Prison": + return Optional.of(Map.PRISON); default: return Optional.empty(); }