sla integration
This commit is contained in:
parent
b5cdf74aa9
commit
4772bd4bd9
12 changed files with 404 additions and 27 deletions
|
@ -3,4 +3,4 @@ org.gradle.jvmargs=-Xmx2g
|
|||
baseGroup = com.github.stachelbeere1248.zombiesutils
|
||||
mcVersion = 1.8.9
|
||||
modid = zombiesutils
|
||||
version = 1.0.1
|
||||
version = 1.0.2
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package com.github.stachelbeere1248.zombiesutils;
|
||||
|
||||
import com.github.stachelbeere1248.zombiesutils.commands.CategoryCommand;
|
||||
import com.github.stachelbeere1248.zombiesutils.commands.SlaCommand;
|
||||
import com.github.stachelbeere1248.zombiesutils.handlers.ChatHandler;
|
||||
import com.github.stachelbeere1248.zombiesutils.handlers.TickHandler;
|
||||
import com.github.stachelbeere1248.zombiesutils.render.TimeRenderer;
|
||||
import com.github.stachelbeere1248.zombiesutils.render.RenderGameOverlayHandler;
|
||||
import net.minecraftforge.client.ClientCommandHandler;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
@ -32,10 +33,11 @@ public class ZombiesUtils {
|
|||
}
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
MinecraftForge.EVENT_BUS.register(new TimeRenderer());
|
||||
MinecraftForge.EVENT_BUS.register(new RenderGameOverlayHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new TickHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new ChatHandler());
|
||||
ClientCommandHandler.instance.registerCommand(new CategoryCommand());
|
||||
ClientCommandHandler.instance.registerCommand(new SlaCommand());
|
||||
}
|
||||
public Configuration getConfig() {
|
||||
return config;
|
||||
|
|
|
@ -6,7 +6,6 @@ import net.minecraft.command.CommandBase;
|
|||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
@ -27,10 +26,8 @@ public class CategoryCommand extends CommandBase {
|
|||
|
||||
@Override
|
||||
public void processCommand(ICommandSender sender, String[] args) {
|
||||
if (args.length == 0) {
|
||||
IChatComponent error = new ChatComponentText("Please input the name for the category");
|
||||
sender.addChatMessage(error);
|
||||
} else {
|
||||
if (args.length == 0) sender.addChatMessage(new ChatComponentText(getCommandUsage(sender)));
|
||||
else {
|
||||
Category.setSelectedCategory(args[0]);
|
||||
Timer.getInstance().ifPresent(timer -> timer.setCategory(new Category()));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
package com.github.stachelbeere1248.zombiesutils.commands;
|
||||
|
||||
import com.github.stachelbeere1248.zombiesutils.game.Map;
|
||||
import com.github.stachelbeere1248.zombiesutils.game.windows.Sla;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class SlaCommand extends CommandBase {
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "sla";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender sender) {
|
||||
return "/sla toggle\n/sla offset [x] [x] [x]\n/sla set <de|bb|aa>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender sender, String @NotNull [] args) throws CommandException {
|
||||
if (args.length == 0) sender.addChatMessage(new ChatComponentText(getCommandUsage(sender)));
|
||||
else {
|
||||
switch (args[0]) {
|
||||
case "toggle":
|
||||
Sla.toggle();
|
||||
sender.addChatMessage(new ChatComponentText("SLA active: " + Sla.isEnabled()));
|
||||
break;
|
||||
case "offset":
|
||||
if (args.length == 1) Sla.getInstance().ifPresent(Sla::resetOffset);
|
||||
else if (args.length != 4) sender.addChatMessage(new ChatComponentText("/sla offset [x] [x] [x]"));
|
||||
else {
|
||||
try {
|
||||
double x = Double.parseDouble(args[1]);
|
||||
double y = Double.parseDouble(args[2]);
|
||||
double z = Double.parseDouble(args[3]);
|
||||
Sla.getInstance().ifPresent(sla -> sla.setOffset(new double[]{x, y, z}));
|
||||
sender.addChatMessage(new ChatComponentText(String.format("Offset set to %s %s %s", x, y, z)));
|
||||
} catch (NumberFormatException ignored) {
|
||||
sender.addChatMessage(new ChatComponentText("Please input valid numbers"));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "set":
|
||||
switch (args[1]) {
|
||||
case "de":
|
||||
new Sla(Map.DEAD_END);
|
||||
break;
|
||||
case "bb":
|
||||
new Sla(Map.BAD_BLOOD);
|
||||
break;
|
||||
case "aa":
|
||||
new Sla(Map.ALIEN_ARCADIUM);
|
||||
break;
|
||||
default:
|
||||
sender.addChatMessage(new ChatComponentText("/sla set <de|bb|aa>"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
sender.addChatMessage(new ChatComponentText(getCommandUsage(sender)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public List<String> addTabCompletionOptions(ICommandSender sender, String @NotNull [] args, BlockPos blockPos) {
|
||||
List<String> options = new ArrayList<String>();
|
||||
if (args.length == 1) options.addAll(Arrays.asList("toggle","offset","set"));
|
||||
else if ("offset".equals(args[0]) && (args.length == 2 || args.length == 3 || args.length == 4))
|
||||
options.add("0");
|
||||
else if ("set".equals(args[0])) options.addAll(Arrays.asList("de", "bb", "aa"));
|
||||
return options;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCommandSenderUseCommand(ICommandSender sender) {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,161 @@
|
|||
package com.github.stachelbeere1248.zombiesutils.game.windows;
|
||||
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class Room {
|
||||
private final Window[] windows;
|
||||
private final String alias;
|
||||
private int activeWindowCount;
|
||||
public Room(String alias, Window[] windows) {
|
||||
this.windows = windows;
|
||||
this.alias = alias;
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return alias;
|
||||
}
|
||||
public Window[] getWindows() {
|
||||
return windows;
|
||||
}
|
||||
|
||||
@Contract(" -> new")
|
||||
public static Room @NotNull [] getDE() {
|
||||
return new Room[]{
|
||||
new Room("Alley", new Window[]{
|
||||
new Window(1,13,138,63),
|
||||
new Window(2,9,138,87),
|
||||
new Window(3,79,140,17),
|
||||
new Window(4,85,140,59),
|
||||
}),
|
||||
new Room("Office", new Window[]{
|
||||
new Window(1,85,152,53),
|
||||
new Window(2,105,152,63),
|
||||
new Window(3,115,152,129),
|
||||
}),
|
||||
new Room("Hotel", new Window[]{
|
||||
new Window(1,1,136,93),
|
||||
new Window(2,-19,136,29),
|
||||
new Window(3,51,138,-7),
|
||||
new Window(4,53,138,7),
|
||||
new Window(5,-7,152,-43),
|
||||
new Window(6,51,152,-11),
|
||||
}),
|
||||
new Room("Apartments", new Window[]{
|
||||
new Window(1,39,152,19),
|
||||
new Window(2,-31,152,31),
|
||||
new Window(3,-27,152,103),
|
||||
new Window(4,-9,152,125),
|
||||
}),
|
||||
new Room("Power Station", new Window[]{
|
||||
new Window(1,7,166,125),
|
||||
new Window(2,-5,166,65),
|
||||
new Window(3,-11,136,133),
|
||||
}),
|
||||
new Room("Rooftop", new Window[]{
|
||||
new Window(1,-31,166,129),
|
||||
new Window(2,-27,166,61),
|
||||
new Window(3,-99,166,77),
|
||||
new Window(4,-75,166,51),
|
||||
}),
|
||||
new Room("Gallery", new Window[]{
|
||||
new Window(1,45,152,155),
|
||||
new Window(2,61,152,109),
|
||||
new Window(3,31,152,131),
|
||||
}),
|
||||
new Room("Garden", new Window[]{
|
||||
new Window(1,1,136,-33),
|
||||
new Window(2,49,136,-67),
|
||||
new Window(3,69,136,-33),
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
@Contract(" -> new")
|
||||
public static Room @NotNull [] getBB() {
|
||||
return new Room[]{
|
||||
new Room("Courtyard", new Window[]{
|
||||
new Window(1,49,138,-37),
|
||||
new Window(2,61,138,21),
|
||||
new Window(3,39,138,41),
|
||||
new Window(4,25,138,-35),
|
||||
}),
|
||||
new Room("Mansion", new Window[]{
|
||||
new Window(1,1,148,-35),
|
||||
new Window(2,1,148,37),
|
||||
new Window(3,-25,146,57),
|
||||
}),
|
||||
new Room("Library", new Window[]{
|
||||
new Window(1,3,148,-89),
|
||||
new Window(2,-41,148,-59),
|
||||
new Window(3,-81,148,-61),
|
||||
new Window(4,-79,148,-115),
|
||||
new Window(5,-109,148,-93),
|
||||
new Window(6,-107,148,-67),
|
||||
}),
|
||||
new Room("Dungeon", new Window[]{
|
||||
new Window(1,-57,136,-69),
|
||||
new Window(2,-73,136,-23),
|
||||
new Window(3,-19,136,-37),
|
||||
new Window(4,-19,136,-45),
|
||||
new Window(5,-21,136,-99),
|
||||
}),
|
||||
new Room("Crypts", new Window[]{
|
||||
new Window(1,-7,136,-5),
|
||||
new Window(2,-31,136,1),
|
||||
new Window(3,-57,136,41),
|
||||
}),
|
||||
new Room("Graveyard", new Window[]{
|
||||
new Window(1,-13,136,67),
|
||||
new Window(2,-71,136,63),
|
||||
new Window(3,-33,136,101),
|
||||
}),
|
||||
new Room("Balcony", new Window[]{
|
||||
new Window(1,-83,136,55),
|
||||
new Window(2,-107,144,25),
|
||||
new Window(3,-113,148,5),
|
||||
new Window(4,-65,148,-37),
|
||||
}),
|
||||
new Room("Great Hall", new Window[]{
|
||||
new Window(1,-39,148,-27),
|
||||
new Window(2,-63,152,31),
|
||||
new Window(3,-55,148,31),
|
||||
})
|
||||
|
||||
};
|
||||
}
|
||||
@Contract(" -> new")
|
||||
public static Room @NotNull [] getAA() {
|
||||
return new Room[]{
|
||||
new Room("Park Entrance", new Window[]{
|
||||
new Window(1,13,144,63),
|
||||
new Window(2,-21,144,-11),
|
||||
new Window(3,-43,144,21),
|
||||
new Window(4,-45,144,31),
|
||||
new Window(5,45,144,27),
|
||||
}),
|
||||
new Room("Roller Coaster", new Window[]{
|
||||
new Window(1,-57,144,55),
|
||||
new Window(2,-25,144,79),
|
||||
}),
|
||||
new Room("Ferris Wheel", new Window[]{
|
||||
new Window(1,35,144,89),
|
||||
new Window(2,55,144,63),
|
||||
}),
|
||||
new Room("Bumper Cars", new Window[]{
|
||||
new Window(1,67,146,-3),
|
||||
new Window(2,45,146,-27),
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
public void increaseActiveWindowCount() {
|
||||
this.activeWindowCount++;
|
||||
}
|
||||
public void resetActiveWindowCount() {
|
||||
this.activeWindowCount = 0;
|
||||
}
|
||||
public int getActiveWindowCount() {
|
||||
return activeWindowCount;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package com.github.stachelbeere1248.zombiesutils.game.windows;
|
||||
|
||||
import com.github.stachelbeere1248.zombiesutils.game.Map;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
|
||||
public class Sla {
|
||||
private static Sla instance = null;
|
||||
private static boolean enabled = false;
|
||||
private final double[] offset = new double[3];
|
||||
private final Room[] rooms;
|
||||
|
||||
|
||||
public Sla(@NotNull Map map) {
|
||||
switch (map) {
|
||||
case DEAD_END: this.rooms = Room.getDE(); break;
|
||||
case BAD_BLOOD: this.rooms = Room.getBB(); break;
|
||||
case ALIEN_ARCADIUM: this.rooms = Room.getAA(); break;
|
||||
default: throw new IllegalStateException("Unexpected value: " + map);
|
||||
}
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public void refreshActives() {
|
||||
final EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
|
||||
final double[] playerCoords = {
|
||||
player.posX + offset[0],
|
||||
player.posY + offset[1],
|
||||
player.posZ + offset[2]
|
||||
};
|
||||
for (Room room: rooms
|
||||
) {
|
||||
room.resetActiveWindowCount();
|
||||
for (Window window: room.getWindows()
|
||||
) {
|
||||
double distanceDoubledThenSquared = 0;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
distanceDoubledThenSquared += ((playerCoords[i]*2 - window.getXYZ()[i]) * (playerCoords[i]*2 - window.getXYZ()[i]));
|
||||
}
|
||||
|
||||
// (2x)² + (2y)² + (2z)² = 4 (x²+y²+z²)
|
||||
if (distanceDoubledThenSquared < 10000) {
|
||||
window.setActive(true);
|
||||
room.increaseActiveWindowCount();
|
||||
} else window.setActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Optional<Sla> getInstance() {
|
||||
return Optional.ofNullable(instance);
|
||||
}
|
||||
public static void drop() {
|
||||
instance = null;
|
||||
}
|
||||
public Room[] getRooms() {
|
||||
return rooms;
|
||||
}
|
||||
public static boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
public static void toggle() {
|
||||
Sla.enabled = !Sla.enabled;
|
||||
}
|
||||
public void resetOffset() {
|
||||
Arrays.fill(this.offset, 0);
|
||||
}
|
||||
public void setOffset(double[] offset) {
|
||||
System.arraycopy(offset, 0, this.offset, 0, 3);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.github.stachelbeere1248.zombiesutils.game.windows;
|
||||
|
||||
public class Window {
|
||||
private final short[] xyz = new short[3];
|
||||
private final int alias;
|
||||
private boolean isActive;
|
||||
|
||||
public Window(int alias, int x, int y, int z) {
|
||||
this.alias = alias;
|
||||
xyz[0] = (short) x; xyz[1] = (short) y; xyz[2] = (short) z;
|
||||
}
|
||||
|
||||
public int getAlias() {
|
||||
return alias;
|
||||
}
|
||||
public short[] getXYZ() {
|
||||
return xyz;
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return isActive;
|
||||
}
|
||||
public void setActive(boolean active) {
|
||||
isActive = active;
|
||||
}
|
||||
}
|
|
@ -67,18 +67,18 @@ public class MixinNetHandlerPlayClient {
|
|||
case DEAD_END: case BAD_BLOOD:
|
||||
Timer.getInstance().ifPresent(timer -> {
|
||||
timer.split((byte) 30);
|
||||
Timer.dropInstance();
|
||||
Timer.dropInstances();
|
||||
});
|
||||
break;
|
||||
case ALIEN_ARCADIUM:
|
||||
Timer.getInstance().ifPresent(timer -> {
|
||||
timer.split((byte) 105);
|
||||
Timer.dropInstance();
|
||||
Timer.dropInstances();
|
||||
});
|
||||
break;
|
||||
}
|
||||
} else if (message.equals("\u00a7cGame Over!")) {
|
||||
Timer.dropInstance();
|
||||
Timer.dropInstances();
|
||||
} else {
|
||||
ZombiesUtils.getInstance().getLogger().debug(message);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.github.stachelbeere1248.zombiesutils.render;
|
||||
|
||||
import com.github.stachelbeere1248.zombiesutils.game.windows.Room;
|
||||
import com.github.stachelbeere1248.zombiesutils.game.windows.Sla;
|
||||
import com.github.stachelbeere1248.zombiesutils.timer.Timer;
|
||||
import com.github.stachelbeere1248.zombiesutils.utils.Scoreboard;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -7,23 +9,30 @@ import net.minecraft.client.gui.FontRenderer;
|
|||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class TimeRenderer {
|
||||
public class RenderGameOverlayHandler {
|
||||
private final FontRenderer fontRenderer;
|
||||
|
||||
public TimeRenderer() {
|
||||
public RenderGameOverlayHandler() {
|
||||
this.fontRenderer = Objects.requireNonNull(Minecraft.getMinecraft().fontRendererObj, "FontRenderer must not be null!");
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRenderGameOverlay(RenderGameOverlayEvent.Post event) {
|
||||
if (!Scoreboard.isZombies()) return;
|
||||
if (event.type != RenderGameOverlayEvent.ElementType.ALL) return;
|
||||
if (!Timer.getInstance().isPresent()) return;
|
||||
if (event.type != RenderGameOverlayEvent.ElementType.TEXT) return;
|
||||
Timer.getInstance().ifPresent(timer -> renderTime(timer.roundTime()));
|
||||
if (Sla.isEnabled()) Sla.getInstance().ifPresent(sla -> {
|
||||
sla.refreshActives();
|
||||
renderSla(sla.getRooms());
|
||||
});
|
||||
|
||||
long timerTicks = Timer.getInstance().get().roundTime();
|
||||
}
|
||||
|
||||
private void renderTime(long timerTicks) {
|
||||
long minutesPart = (timerTicks*50) / 60000;
|
||||
long secondsPart = ((timerTicks*50) % 60000) / 1000;
|
||||
long tenthSecondsPart = ((timerTicks*50) % 1000) / 100;
|
||||
|
@ -32,7 +41,17 @@ public class TimeRenderer {
|
|||
ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
|
||||
int screenWidth = scaledResolution.getScaledWidth();
|
||||
int screenHeight = scaledResolution.getScaledHeight();
|
||||
int color = 0xFFFFFF;
|
||||
final int color = 0xFFFFFF;
|
||||
fontRenderer.drawStringWithShadow(time, screenWidth - width, screenHeight - fontRenderer.FONT_HEIGHT, color);
|
||||
}
|
||||
private void renderSla(Room @NotNull [] rooms) {
|
||||
int y = 0;
|
||||
for (Room room: rooms) {
|
||||
int actives = room.getActiveWindowCount();
|
||||
if (actives == 0) continue;
|
||||
String roomString = String.format("%s: %x",room.getAlias(), actives);
|
||||
fontRenderer.drawStringWithShadow(roomString,1,1+y*fontRenderer.FONT_HEIGHT,0xFFFFFF);
|
||||
y++;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@ public class RecordManager {
|
|||
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
|
||||
"\u00a7l\u00a7e Category: " + category.getName() + " - ***" + "\u00a7l\u00a76 NEW BEST SEGMENT! " + "\u00a7l\u00a7e***"
|
||||
));
|
||||
final String timeString = getTimeString(roundTime);
|
||||
final String timeString = formattedTime(roundTime);
|
||||
final String message = "\u00a7cRound " + round + "\u00a7e took \u00a7a" + timeString + "\u00a7e!";
|
||||
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(message));
|
||||
|
||||
|
@ -29,8 +29,8 @@ public class RecordManager {
|
|||
));
|
||||
timesFile.setBestSegment(round, roundTime);
|
||||
}
|
||||
final String timeString = getTimeString(roundTime);
|
||||
final String message = "\u00a7cRound " + round + "\u00a7e took \u00a7a" + timeString + " \u00a79\u0394" + (double) (roundTime-bestSegment)/20;
|
||||
final String timeString = formattedTime(roundTime);
|
||||
final String message = "\u00a7cRound " + round + "\u00a7e took \u00a7a" + timeString + " \u00a79" + formattedDelta(roundTime,bestSegment);
|
||||
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(message));
|
||||
}
|
||||
sendBar();
|
||||
|
@ -46,7 +46,7 @@ public class RecordManager {
|
|||
"\u00a7l\u00a7e Category: " + category.getName() + " - ***" + "\u00a7l\u00a76 NEW PERSONAL BEST! " + "\u00a7l\u00a7e***"
|
||||
));
|
||||
|
||||
final String timeString = getTimeString(gameTime);
|
||||
final String timeString = formattedTime(gameTime);
|
||||
final String message = "\u00a7cRound " + round + "\u00a7e finished at \u00a7a" + timeString + "\u00a7e!";
|
||||
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(message));
|
||||
|
||||
|
@ -58,20 +58,26 @@ public class RecordManager {
|
|||
timesFile.setPersonalBest(round, gameTime);
|
||||
}
|
||||
|
||||
final String timeString = getTimeString(gameTime);
|
||||
final String message = "\u00a7cRound " + round + "\u00a7e finished at \u00a7a" + timeString + " \u00a79\u0394" + (double) (gameTime-personalBest)/20;
|
||||
final String timeString = formattedTime(gameTime);
|
||||
final String message = "\u00a7cRound " + round + "\u00a7e finished at \u00a7a" + timeString + " \u00a79" + formattedDelta(gameTime, personalBest);
|
||||
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(message));
|
||||
|
||||
}
|
||||
sendBar();
|
||||
}
|
||||
private static String getTimeString(int gameTime) {
|
||||
private static String formattedTime(int gameTime) {
|
||||
return String.format("%d:%02d.%d",
|
||||
(gameTime *50) / 60000,
|
||||
((gameTime *50) % 60000) / 1000,
|
||||
((gameTime *50) % 1000) / 100
|
||||
);
|
||||
}
|
||||
private static String formattedDelta(int newTime, int prevTime) {
|
||||
double delta = (double) (newTime - prevTime) / 20;
|
||||
if (delta<0) {
|
||||
return String.valueOf(delta);
|
||||
} else return ("+" + delta);
|
||||
}
|
||||
private static void sendBar() {
|
||||
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
|
||||
"\u00a7l\u00a7a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬"
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package com.github.stachelbeere1248.zombiesutils.timer;
|
||||
|
||||
import com.github.stachelbeere1248.zombiesutils.ZombiesUtils;
|
||||
import com.github.stachelbeere1248.zombiesutils.game.Map;
|
||||
import com.github.stachelbeere1248.zombiesutils.game.GameMode;
|
||||
import com.github.stachelbeere1248.zombiesutils.game.Map;
|
||||
import com.github.stachelbeere1248.zombiesutils.game.windows.Sla;
|
||||
import com.github.stachelbeere1248.zombiesutils.timer.recorder.Category;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -33,6 +34,7 @@ public class Timer {
|
|||
|
||||
this.category = new Category();
|
||||
GameMode.create(map);
|
||||
new Sla(map);
|
||||
}
|
||||
|
||||
|
||||
|
@ -85,8 +87,9 @@ public class Timer {
|
|||
/**
|
||||
* Call to invalidate {@link #instance} to trigger the garbage collector
|
||||
*/
|
||||
public static void dropInstance() {
|
||||
public static void dropInstances() {
|
||||
instance = null;
|
||||
GameMode.drop();
|
||||
Sla.drop();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import java.util.stream.Collectors;
|
|||
public class Scoreboard {
|
||||
private static final Pattern SIDEBAR_EMOJI_PATTERN = Pattern.compile("[\uD83D\uDD2B\uD83C\uDF6B\uD83D\uDCA3\uD83D\uDC7D\uD83D\uDD2E\uD83D\uDC0D\uD83D\uDC7E\uD83C\uDF20\uD83C\uDF6D\u26BD\uD83C\uDFC0\uD83D\uDC79\uD83C\uDF81\uD83C\uDF89\uD83C\uDF82]+");
|
||||
private static final Pattern STRIP_COLOR_PATTERN = Pattern.compile("§[0-9A-FK-ORZ]", Pattern.CASE_INSENSITIVE);
|
||||
private static final Pattern ROUND_LINE_PATTERN = Pattern.compile("(Round )([0-9]{1,3})"); //TODO: Chinese pattern ??
|
||||
private static final Pattern ROUND_LINE_PATTERN = Pattern.compile("(Round )([0-9]{1,3})");
|
||||
private static final Pattern SERVER_NUMBER_PATTERN = Pattern.compile(".*([mLM][0-9A-Z]+)");
|
||||
private static final Pattern MAP_PATTERN = Pattern.compile("Map:.*(Dead End|Bad Blood|Alien Arcadium)");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue