v1.3: config, prison, other changes

This commit is contained in:
Stachelbeere1248 2024-06-21 03:33:29 +02:00
parent 328f07d6f6
commit 541e6e1ae6
Signed by: Stachelbeere1248
SSH key fingerprint: SHA256:IozEKdw2dB8TZxkpPdMxcWSoWTIMwoLaCcZJ1AJnY2o
17 changed files with 82 additions and 42 deletions

View file

@ -3,4 +3,4 @@ org.gradle.jvmargs=-Xmx2g
baseGroup = com.github.stachelbeere1248.zombiesutils baseGroup = com.github.stachelbeere1248.zombiesutils
mcVersion = 1.8.9 mcVersion = 1.8.9
modid = zombiesutils modid = zombiesutils
version = 1.3 version = 1.3.0-PREVIEW_3

View file

@ -7,6 +7,7 @@ import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender; import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException; import net.minecraft.command.WrongUsageException;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.io.File; import java.io.File;
@ -41,6 +42,7 @@ public class CategoryCommand implements ICommand {
if (cat.contains(File.separator)) 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"); 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); Category.setSelectedCategory(cat);
sender.addChatMessage(new ChatComponentText("§eSet category to §c" + cat));
Timer.getInstance().ifPresent(timer -> timer.setCategory(new Category())); Timer.getInstance().ifPresent(timer -> timer.setCategory(new Category()));
} }
} }

View file

@ -27,6 +27,7 @@ public class ZombiesUtilsConfig {
private Property copyDelta; private Property copyDelta;
private Property cpsCounter; private Property cpsCounter;
private Property announcePB; private Property announcePB;
private Property playerVis;
public ZombiesUtilsConfig(Configuration config) { public ZombiesUtilsConfig(Configuration config) {
this.config = config; this.config = config;
@ -120,6 +121,12 @@ public class ZombiesUtilsConfig {
"T", "T",
"The Text to be sent when pressing the chat-macro hotkey" "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( cpsCounter = config.get(
Configuration.CATEGORY_GENERAL, Configuration.CATEGORY_GENERAL,
"cps", "cps",
@ -154,11 +161,12 @@ public class ZombiesUtilsConfig {
List<IConfigElement> getRootElements() { List<IConfigElement> getRootElements() {
return Arrays.asList( return Arrays.asList(
new DummyConfigElement.DummyCategoryElement("Timer", "", getSpawntimeElements()),
new DummyConfigElement.DummyCategoryElement("SST", "", getSpawntimeElements()),
new DummyConfigElement.DummyCategoryElement("SLA", "", getSpawntimeElements()),
new CustomConfigElement("Language", language), 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("Macro message", chatMacro),
new CustomConfigElement("Player visibility", playerVis),
new CustomConfigElement("CPS counter", cpsCounter) new CustomConfigElement("CPS counter", cpsCounter)
); );
@ -211,6 +219,9 @@ public class ZombiesUtilsConfig {
public boolean getAnnouncePB() { public boolean getAnnouncePB() {
return announcePB.getBoolean(); return announcePB.getBoolean();
} }
public boolean getPlayerVis() {
return playerVis.getBoolean();
}
@SubscribeEvent @SubscribeEvent
public void onConfigChange(ConfigChangedEvent.@NotNull OnConfigChangedEvent event) { public void onConfigChange(ConfigChangedEvent.@NotNull OnConfigChangedEvent event) {

View file

@ -30,6 +30,7 @@ public class GameMode {
switch (map) { switch (map) {
case DEAD_END: case DEAD_END:
case BAD_BLOOD: case BAD_BLOOD:
case PRISON:
this.difficulty = difficulty; this.difficulty = difficulty;
break; break;
case ALIEN_ARCADIUM: case ALIEN_ARCADIUM:

View file

@ -6,6 +6,7 @@ import com.github.stachelbeere1248.zombiesutils.game.windows.Room;
import com.github.stachelbeere1248.zombiesutils.game.windows.Window; import com.github.stachelbeere1248.zombiesutils.game.windows.Window;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.util.ChatComponentText;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.Arrays; import java.util.Arrays;
@ -28,6 +29,10 @@ public class SLA {
case ALIEN_ARCADIUM: case ALIEN_ARCADIUM:
this.rooms = Room.getAA(); this.rooms = Room.getAA();
break; 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: default:
throw new IllegalStateException("Unexpected value: " + map); 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); 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 EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
final double[] playerCoords = { final double[] playerCoords = {
(player.posX - offset[0]), (player.posX - offset[0]),
@ -95,7 +100,8 @@ public class SLA {
} }
public Room[] getRooms() { public Room[] getRooms() {
return rooms; this.refreshActives();
return this.rooms;
} }
public void resetOffset() { public void resetOffset() {

View file

@ -27,6 +27,7 @@ public class WaveTiming {
public static void onTick() { public static void onTick() {
if (Scoreboard.isNotZombies()) return; if (Scoreboard.isNotZombies()) return;
//TODO: Assert correct server number!
Timer.getInstance().ifPresent(timer -> { Timer.getInstance().ifPresent(timer -> {
byte[] waves = getWaves(timer); byte[] waves = getWaves(timer);
final int roundTime = timer.roundTime(); final int roundTime = timer.roundTime();

View file

@ -8,13 +8,11 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings("DuplicatedCode") @SuppressWarnings("DuplicatedCode")
public class Waves { 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}}, 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}}; 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}, 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}};
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};
@Contract(pure = true) @Contract(pure = true)
public static byte[] get(@NotNull Map map, byte round) { public static byte[] get(@NotNull Map map, byte round) {
@ -30,6 +28,9 @@ public class Waves {
case ALIEN_ARCADIUM: case ALIEN_ARCADIUM:
ret = alienArcadiumWaveTimes[round - 1]; ret = alienArcadiumWaveTimes[round - 1];
break; break;
case PRISON:
ret = prisonWaveTimes[round - 1];
break;
} }
} catch (ArrayIndexOutOfBoundsException ignored) { } catch (ArrayIndexOutOfBoundsException ignored) {
Minecraft.getMinecraft().thePlayer.addChatMessage( Minecraft.getMinecraft().thePlayer.addChatMessage(
@ -39,24 +40,6 @@ public class Waves {
return ret; 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) { public static byte getLastWave(@NotNull Map map, byte round) {
byte[] aByte = get(map, round); byte[] aByte = get(map, round);
return aByte[aByte.length - 1]; return aByte[aByte.length - 1];

View file

@ -16,6 +16,7 @@ public class Handlers {
MinecraftForge.EVENT_BUS.register(new TickHandler()); MinecraftForge.EVENT_BUS.register(new TickHandler());
MinecraftForge.EVENT_BUS.register(new ChatHandler()); MinecraftForge.EVENT_BUS.register(new ChatHandler());
MinecraftForge.EVENT_BUS.register(new KeyInputHandler()); MinecraftForge.EVENT_BUS.register(new KeyInputHandler());
MinecraftForge.EVENT_BUS.register(new RenderPlayerHandler());
} }
public RenderGameOverlayHandler getRenderer() { public RenderGameOverlayHandler getRenderer() {

View file

@ -15,6 +15,7 @@ public class KeyInputHandler {
public void onKeyInput(InputEvent event) { public void onKeyInput(InputEvent event) {
if (Minecraft.getMinecraft().currentScreen != null) return; if (Minecraft.getMinecraft().currentScreen != null) return;
if (event instanceof InputEvent.KeyInputEvent) { if (event instanceof InputEvent.KeyInputEvent) {
if (Keyboard.getEventKey() == '\0') return;
if (Keyboard.getEventKeyState()) { if (Keyboard.getEventKeyState()) {
Hotkeys hotkeys = ZombiesUtils.getInstance().getHotkeys(); Hotkeys hotkeys = ZombiesUtils.getInstance().getHotkeys();
if (Keyboard.getEventKey() == hotkeys.getChatMacro().getKeyCode()) { if (Keyboard.getEventKey() == hotkeys.getChatMacro().getKeyCode()) {

View file

@ -59,10 +59,7 @@ public class RenderGameOverlayHandler {
); );
}); });
SLA.getInstance().ifPresent(sla -> { SLA.getInstance().ifPresent(sla -> renderSla(sla.getRooms()));
sla.refreshActives();
renderSla(sla.getRooms());
});
if (ZombiesUtils.getInstance().getConfig().getCpsToggle()) renderCPS(); if (ZombiesUtils.getInstance().getConfig().getCpsToggle()) renderCPS();
} }

View file

@ -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;
}
}

View file

@ -81,6 +81,7 @@ public class MixinNetHandlerPlayClient {
switch (timer.getGameMode().getMap()) { switch (timer.getGameMode().getMap()) {
case DEAD_END: case DEAD_END:
case BAD_BLOOD: case BAD_BLOOD:
case PRISON:
timer.split((byte) 30); timer.split((byte) 30);
Timer.dropInstances(); Timer.dropInstances();
break; break;

View file

@ -12,7 +12,7 @@ import java.io.File;
public class Category { public class Category {
private static String selectedCategory = ZombiesUtils.getInstance().getConfig().getDefaultCategory(); 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; private final String name;
public Category() { public Category() {
@ -28,6 +28,11 @@ public class Category {
categoryFiles[5] = new CategoryFile(category, new GameMode(Map.BAD_BLOOD, Difficulty.RIP)); categoryFiles[5] = new CategoryFile(category, new GameMode(Map.BAD_BLOOD, Difficulty.RIP));
categoryFiles[6] = new CategoryFile(category, new GameMode(Map.ALIEN_ARCADIUM)); 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; this.name = Category.selectedCategory;
} }
@ -45,15 +50,21 @@ public class Category {
} }
public CategoryFile getByGameMode(@NotNull GameMode gameMode) { 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.HARD)) return categoryFiles[1];
else if (gameMode.is(Map.DEAD_END, Difficulty.RIP)) return categoryFiles[2]; 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.HARD)) return categoryFiles[4];
else if (gameMode.is(Map.BAD_BLOOD, Difficulty.RIP)) return categoryFiles[5]; 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); else throw new IllegalStateException("Unexpected value: " + gameMode);
} }

View file

@ -19,6 +19,7 @@ public class CategoryData implements ISplitsData {
break; break;
case DEAD_END: case DEAD_END:
case BAD_BLOOD: case BAD_BLOOD:
case PRISON:
bestSegments = new short[30]; bestSegments = new short[30];
personalBests = new int[30]; personalBests = new int[30];
break; break;

View file

@ -17,6 +17,7 @@ public class GameData implements ISplitsData {
break; break;
case DEAD_END: case DEAD_END:
case BAD_BLOOD: case BAD_BLOOD:
case PRISON:
segments = new short[30]; segments = new short[30];
break; break;
default: default:

View file

@ -68,11 +68,11 @@ public class LanguageSupport {
public static @NotNull Pattern mapPattern(@NotNull String language) { public static @NotNull Pattern mapPattern(@NotNull String language) {
switch (language) { switch (language) {
case "EN": 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": 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": case "DE":
return Pattern.compile("Karte:.*(Dead End|Bad Blood|Alien Arcadium)"); return Pattern.compile("Karte:.*(Dead End|Bad Blood|Alien Arcadium|Prison)");
default: default:
throw new IllegalStateException("Unexpected value: " + language); throw new IllegalStateException("Unexpected value: " + language);
} }

View file

@ -96,7 +96,7 @@ public class Scoreboard {
public static Optional<Map> getMap() { public static Optional<Map> getMap() {
String line; String line;
try { try {
line = lines.get(12); line = lines.get(12); //TODO: This was changed!
} catch (Exception couldBePregame) { } catch (Exception couldBePregame) {
try { try {
line = lines.get(2); line = lines.get(2);
@ -113,6 +113,8 @@ public class Scoreboard {
return Optional.of(Map.BAD_BLOOD); return Optional.of(Map.BAD_BLOOD);
case "Alien Arcadium": case "Alien Arcadium":
return Optional.of(Map.ALIEN_ARCADIUM); return Optional.of(Map.ALIEN_ARCADIUM);
case "Prison":
return Optional.of(Map.PRISON);
default: default:
return Optional.empty(); return Optional.empty();
} }