Compare commits

..

No commits in common. "master" and "v1.3.6" have entirely different histories.

68 changed files with 246 additions and 538 deletions

View file

@ -1,38 +0,0 @@
on:
push:
tags:
- '*'
jobs:
build:
runs-on: docker
steps:
- name: checkout repository
uses: actions/checkout@v3
- name: make gradle wrapper executable
run: chmod +x ./gradlew
- name: set up jdk
run: |
INSTALL_DIR="/opt/java"
mkdir -p "$INSTALL_DIR"
JDK8_URL="https://cdn.azul.com/zulu/bin/zulu8.84.0.15-ca-jdk8.0.442-linux_x64.tar.gz"
JRE17_URL="https://cdn.azul.com/zulu/bin/zulu17.56.15-ca-jre17.0.14-linux_x64.tar.gz"
echo "Downloading JDK8 from $JDK8_URL"
curl -L "$JDK8_URL" | tar -xz -C "$INSTALL_DIR"
echo "Downloading JRE17 from $JRE17_URL"
curl -L "$JRE17_URL" | tar -xz -C "$INSTALL_DIR"
- name: build
run: JDK8=/opt/java/zulu8.84.0.15-ca-jdk8.0.442-linux_x64 JAVA_HOME=/opt/java/zulu17.56.15-ca-jre17.0.14-linux_x64 ./gradlew build
- name: capture build artifacts
uses: https://code.forgejo.org/forgejo/upload-artifact@v3
with:
name: Artifacts
path: 'build/libs'

4
.gitattributes vendored
View file

@ -1,4 +0,0 @@
gradlew* linguist-vendored
gradle/wrapper/* linguist-vendored
*.bat text eol=crlf

22
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,22 @@
name: Run Gradle Build
on: [push, pull_request]
jobs:
gradle:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- uses: actions/setup-java@v3
name: Setup Java
with:
distribution: temurin
java-version: 17
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Execute Gradle build
run: ./gradlew build
- uses: actions/upload-artifact@v3
name: Upload built mod JAR
with:
name: latest-autobuild
path: build/libs/*.jar

View file

@ -0,0 +1,10 @@
name: "Validate Gradle Wrapper"
on: [push, pull_request]
jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1

3
.gitignore vendored
View file

@ -1,3 +1,6 @@
.idea/
.vscode/
run/ run/
build/ build/
.gradle/ .gradle/

View file

@ -1,51 +1,34 @@
# zombies-utils # zombies-utils
##### Download the latest release [here](https://github.com/Stachelbeere1248/zombies-utils/releases/latest) ##### Download the latest release [here](https://github.com/Stachelbeere1248/zombies-utils/releases/latest)
Hello, I am currently working on this mod. More features will come. For now it has: Hello, I am currently working on this mod. More features will come. For now it has:
- An accurate timer + Automatic splitting - An accurate timer + Automatic splitting
- Tracking of splits & segment PBs (with custom categories) - Tracking of splits & segment PBs (with custom categories)
- SLA hud - SLA hud
- A chat macro - A chat macro
- Spawn-times HUD: visual, auditory, RL-mode - Spawn-times HUD: visual, auditory, RL-mode
- Player Visibility - Player Visibility
#### Disclaimers #### Disclaimers
- If you are using a Hypixel language other than the selected one the mod may not work entirely. Check config. - If you are using a Hypixel language other than the selected one the mod may not work entirely. Check config.
## For Users ## For Users
The timer automatically splits every round. The PB/Segment recorder automatically distinguishes maps and difficulties, but not player count.
The timer automatically splits every round. The PB/Segment recorder automatically distinguishes maps and difficulties,
but not player count.
### Config ### Config
- Language: The selected Hypixel language. Currently supports EN,FR,DE.
- `Language`: The selected Hypixel language. Currently supports EN,FR,DE. - Timer:
- ###### Timer: - Default Category: The record-category to be selected when starting the game.
- `Default Category`: The record-category to be selected when starting the game. - PB Announcements: Whether to show **\*\*\*NEW PERSONAL BEST\*\*\*** on PB in summaries.
- `PB Announcements`: Whether to show **\*\*\*NEW PERSONAL BEST\*\*\*** on PB in summaries. - SST:
- ###### SST: - Enabled: Enables / disables this feature.
- `Enabled`: Enables / disables this feature. - Auditory: A List of tick offsets that a sound should be played. Default (-40, -20, 0) means 2s and 1s in advance, as well as on spawn.
- `Auditory`: A List of tick offsets that a sound should be played. Default (-40, -20, 0) means 2s and 1s in - RL pre-timing: During RL mode, how much SST times sohuld be offsetted. Defaults to 1.4s earlier. Affects HUD as well as auditory.
advance, as well as on spawn. - Truncate: Whether to show passed rounds in the HUD.
- `RL pre-timing`: During RL mode, how much SST times sohuld be offsetted. Defaults to 1.4s earlier. Affects HUD as - SLA:
well as auditory. - Enabled: Whether the SLA HUD should automatically be shown when starting a game.
- `Truncate`: Whether to show passed rounds in the HUD. - Truncate: Whether inactive windows and rooms should be shown.
- ###### SLA: - Macro Message: The Message to be sent when pressing the Chat Macro Key. Do NOT use "§" as symbol.
- `Enabled`: Whether the SLA HUD should automatically be shown when starting a game. - Player Visibility: Whether to enable PlayerVisibility by default.
- `Truncate`: Whether inactive windows and rooms should be shown. - CPS Counter: A simple CPS Counter which shows the amount of clicks within the last 20 gameticks.
- ###### Player Visibility:
- `Enabled`: Whether to enable PlayerVisibility by default.
- `Range`: The range within which players are hidden while enabled.
- `Macro Message`: The Message to be sent when pressing the Chat Macro Key. Do NOT use "§" as symbol.
- `CPS Counter`: A simple CPS Counter which shows the amount of clicks within the last 20 gameticks.
### Commands ### Commands
- /category \<name> - Switches to the category called name. All recorded times are bound to its category. Tabcomplete suggests already existing categories, but you can insert a new (clean) one as well.
- /category \<name> - Switches to the category called name. All recorded times are bound to its category. Tabcomplete
suggests already existing categories, but you can insert a new (clean) one as well.
- Examples: - Examples:
- /category pistol_only - /category pistol_only
- /category no_doors_solo - /category no_doors_solo
@ -54,27 +37,17 @@ but not player count.
- /sla off - Disables the SLA hud - /sla off - Disables the SLA hud
- /sla map \<de|bb|aa|p> - forcefully set the map - /sla map \<de|bb|aa|p> - forcefully set the map
- /sla quick \<mogi_a|ghxula|ghxula-garden> - /sla quick \<mogi_a|ghxula|ghxula-garden>
- useless for most players:
- /sla rotate - rotates all windows around the axis (0,y,0) - /sla rotate - rotates all windows around the axis (0,y,0)
- /sla mirror \<x|z> - mirrors all windows along the plane (0,y,z) or (x,y,0) - /sla mirror \<x|z> - mirrors all windows along the plane (0,y,z) or (x,y,0)
- /sla offset \<x> \<y> \<z> - set an offset, allowing you to use sla on map-recreations, such as housings - /sla offset \<x> \<y> \<z> - set an offset, allowing you to use sla on map-recreations, such as housings
- /zombiesutils \<timer> - /zombiesutils \<timer>
- /zombiesutils timer \<kill|split> - /zombiesutils timer \<kill|split>
- /zombiesutils timer kill - Stops the running timer completely - /zombiesutils timer kill - Stops the running timer completely
- /zombiesutils timer split \<round> - Splits as if \<round> was passed, not recommended to use as it might - /zombiesutils timer split \<round> - Splits as if \<round> was passed, not recommended to use as it might create impossible PBs.
create impossible PBs.
- /qz \<de|bb|aa|p> - sends you to a new game of Dead End, Bad Blood, Alien Arcadium or Prison - /qz \<de|bb|aa|p> - sends you to a new game of Dead End, Bad Blood, Alien Arcadium or Prison
### Hotkeys ### Hotkeys
- Chat Macro: Sends the message specified in the config. - Chat Macro: Sends the message specified in the config.
- RL Mode: Toggles usage of the rocket launcher mode spawn-time offset. - RL Mode: Toggles usage of the rocket launcher mode spawn-time offset.
- Player Visibility: Toggles whether to show players that are within a 4 block radius. - Player Visibility: Toggles whether to show players that are within a 4 block radius.
### Extra ### Extra
- Managing split-categories: In your game directory is a folder called "zombies" which contains the folder "splits". You can simply rename or delete the folders inside "splits". You can also edit your splits, the data is stored as a list of ticks inside the MAP_DIFFICULTY.times files, a simple text editor (such as Notepad on Windows) should be able to edit it (UTF-16 encoded text). The other subfolder, runs, logs all the splits for every run you play.
- Managing split-categories: In your game directory (aka `.minecraft`) is a folder called `zombies` which contains the
folder `splits`. You can simply rename or delete the folders inside `splits`, they represent your categories. You can
also edit your splits, the data is stored as a list of ticks inside the `MAP_DIFFICULTY.times` files, a simple text
editor (such as Notepad on Windows) should be able to edit it (UTF-16 encoded text). The other subfolder, runs, logs
all the splits for every run you play.

1
TODO.md Normal file
View file

@ -0,0 +1 @@
- Distinguishing Escape

View file

@ -1,5 +1,3 @@
import org.apache.commons.lang3.SystemUtils
plugins { plugins {
idea idea
java java
@ -10,12 +8,11 @@ plugins {
//Constants: //Constants:
val baseGroup: String by project val baseGroup = "com.github.stachelbeere1248.zombiesutils"
val mcVersion: String by project val mcVersion: String by project
val version: String by project val version: String by project
val mixinGroup = "$baseGroup.mixin" val mixinGroup = "$baseGroup.mixin"
val modid: String by project val modid: String by project
val transformerFile = file("src/main/resources/accesstransformer.cfg")
// Toolchains: // Toolchains:
java { java {
@ -29,26 +26,14 @@ loom {
"client" { "client" {
// If you don't want mixins, remove these lines // If you don't want mixins, remove these lines
property("mixin.debug", "true") property("mixin.debug", "true")
property("asmhelper.verbose", "true")
arg("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker") arg("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker")
} }
} }
runConfigs {
"client" {
if (SystemUtils.IS_OS_MAC_OSX) {
// This argument causes a crash on macOS
vmArgs.remove("-XstartOnFirstThread")
}
}
remove(getByName("server"))
}
forge { forge {
pack200Provider.set(dev.architectury.pack200.java.Pack200Adapter()) pack200Provider.set(dev.architectury.pack200.java.Pack200Adapter())
// If you don't want mixins, remove this lines // If you don't want mixins, remove this lines
mixinConfig("mixins.$modid.json") mixinConfig("mixins.$modid.json")
if (transformerFile.exists()) {
println("Installing access transformer")
accessTransformer(transformerFile)
}
} }
// If you don't want mixins, remove these lines // If you don't want mixins, remove these lines
mixin { mixin {
@ -65,6 +50,8 @@ sourceSets.main {
repositories { repositories {
mavenCentral() mavenCentral()
maven("https://repo.spongepowered.org/maven/") maven("https://repo.spongepowered.org/maven/")
// If you don't want to log in with your real minecraft account, remove this line
maven("https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1")
} }
val shadowImpl: Configuration by configurations.creating { val shadowImpl: Configuration by configurations.creating {
@ -81,6 +68,10 @@ dependencies {
isTransitive = false isTransitive = false
} }
annotationProcessor("org.spongepowered:mixin:0.8.5-SNAPSHOT") annotationProcessor("org.spongepowered:mixin:0.8.5-SNAPSHOT")
// If you don't want to log in with your real minecraft account, remove this line
runtimeOnly("me.djtheredstoner:DevAuth-forge-legacy:1.1.2")
} }
// Tasks: // Tasks:
@ -89,7 +80,7 @@ tasks.withType(JavaCompile::class) {
options.encoding = "UTF-8" options.encoding = "UTF-8"
} }
tasks.withType(org.gradle.jvm.tasks.Jar::class) { tasks.withType(Jar::class) {
archiveBaseName.set(modid) archiveBaseName.set(modid)
manifest.attributes.run { manifest.attributes.run {
this["FMLCorePluginContainsFMLMod"] = "true" this["FMLCorePluginContainsFMLMod"] = "true"
@ -98,8 +89,6 @@ tasks.withType(org.gradle.jvm.tasks.Jar::class) {
// If you don't want mixins, remove these lines // If you don't want mixins, remove these lines
this["TweakClass"] = "org.spongepowered.asm.launch.MixinTweaker" this["TweakClass"] = "org.spongepowered.asm.launch.MixinTweaker"
this["MixinConfigs"] = "mixins.$modid.json" this["MixinConfigs"] = "mixins.$modid.json"
if (transformerFile.exists())
this["FMLAT"] = "${modid}_at.cfg"
} }
} }
@ -107,13 +96,13 @@ tasks.processResources {
inputs.property("version", project.version) inputs.property("version", project.version)
inputs.property("mcversion", mcVersion) inputs.property("mcversion", mcVersion)
inputs.property("modid", modid) inputs.property("modid", modid)
inputs.property("basePackage", baseGroup) inputs.property("mixinGroup", mixinGroup)
filesMatching(listOf("mcmod.info", "mixins.$modid.json")) { filesMatching(listOf("mcmod.info", "mixins.$modid.json")) {
expand(inputs.properties) expand(inputs.properties)
} }
rename("accesstransformer.cfg", "META-INF/${modid}_at.cfg") rename("(.+_at.cfg)", "META-INF/$1")
} }
@ -125,16 +114,16 @@ val remapJar by tasks.named<net.fabricmc.loom.task.RemapJarTask>("remapJar") {
tasks.jar { tasks.jar {
archiveClassifier.set("without-deps") archiveClassifier.set("without-deps")
destinationDirectory.set(layout.buildDirectory.dir("intermediates")) destinationDirectory.set(layout.buildDirectory.dir("badjars"))
} }
tasks.shadowJar { tasks.shadowJar {
destinationDirectory.set(layout.buildDirectory.dir("intermediates")) destinationDirectory.set(layout.buildDirectory.dir("badjars"))
archiveClassifier.set("non-obfuscated-with-deps") archiveClassifier.set("all-dev")
configurations = listOf(shadowImpl) configurations = listOf(shadowImpl)
doLast { doLast {
configurations.forEach { configurations.forEach {
println("Copying dependencies into mod: ${it.files}") println("Copying jars into mod: ${it.files}")
} }
} }

View file

@ -1,7 +1,6 @@
loom.platform=forge loom.platform=forge
org.gradle.jvmargs=-Xmx2g org.gradle.jvmargs=-Xmx2g
baseGroup = xyz.stachel.zombiesutils baseGroup = com.github.stachelbeere1248.zombiesutils
mcVersion = 1.8.9 mcVersion = 1.8.9
modid = zombiesutils modid = zombiesutils
version = 1.4.0 version = 1.3.6
org.gradle.java.installations.fromEnv=JDK8,JRE17

Binary file not shown.

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

19
gradlew vendored
View file

@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@ -83,8 +83,7 @@ done
# This is normally unused # This is normally unused
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@ -145,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045 # shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
@ -153,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045 # shellcheck disable=SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@ -202,11 +201,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command: # Collect all arguments for the java command;
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# and any embedded shellness will be escaped. # shell script including quotes and variable substitutions, so put them in
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # double quotes to make sure that they get re-expanded; and
# treated as '${Hostname}' itself on the command line. # * put everything else in single quotes, so that it's not re-expanded.
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \

20
gradlew.bat vendored
View file

@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2 echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo. 1>&2 echo.
echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. 1>&2 echo location of your Java installation.
goto fail goto fail
@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. 1>&2 echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo. 1>&2 echo.
echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. 1>&2 echo location of your Java installation.
goto fail goto fail

View file

@ -7,7 +7,7 @@ pluginManagement {
maven("https://maven.fabricmc.net") maven("https://maven.fabricmc.net")
maven("https://maven.minecraftforge.net/") maven("https://maven.minecraftforge.net/")
maven("https://repo.spongepowered.org/maven/") maven("https://repo.spongepowered.org/maven/")
maven("https://repo.essential.gg/repository/maven-releases/") maven("https://repo.sk1er.club/repository/maven-releases/")
} }
resolutionStrategy { resolutionStrategy {
eachPlugin { eachPlugin {

View file

@ -1,8 +1,8 @@
package com.github.stachelbeere1248.zombiesutils.commands; package com.github.stachelbeere1248.zombiesutils.commands;
import com.github.stachelbeere1248.zombiesutils.game.windows.SLA;
import com.github.stachelbeere1248.zombiesutils.game.enums.Map; import com.github.stachelbeere1248.zombiesutils.game.enums.Map;
import com.github.stachelbeere1248.zombiesutils.game.sla.QuickSLA; import com.github.stachelbeere1248.zombiesutils.game.sla.QuickSLA;
import com.github.stachelbeere1248.zombiesutils.game.windows.SLA;
import net.minecraft.command.*; import net.minecraft.command.*;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentText;

View file

@ -68,7 +68,8 @@ public class ZombiesUtilsCommand extends CommandBase {
default: default:
return Collections.emptyList(); return Collections.emptyList();
} }
} else if (args.length == 3) { }
else if (args.length == 3) {
switch (args[0]) { switch (args[0]) {
case "timer": case "timer":
switch (args[1]) { switch (args[1]) {

View file

@ -41,7 +41,6 @@ public class Hotkeys {
public KeyBinding getRlSpawn() { public KeyBinding getRlSpawn() {
return rlSpawn; return rlSpawn;
} }
public KeyBinding getPlayerVisiblity() { public KeyBinding getPlayerVisiblity() {
return playerVisiblity; return playerVisiblity;
} }

View file

@ -1,5 +1,6 @@
package com.github.stachelbeere1248.zombiesutils.config; package com.github.stachelbeere1248.zombiesutils.config;
import com.github.stachelbeere1248.zombiesutils.ZombiesUtils;
import com.github.stachelbeere1248.zombiesutils.utils.LanguageSupport; import com.github.stachelbeere1248.zombiesutils.utils.LanguageSupport;
import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property; import net.minecraftforge.common.config.Property;
@ -26,7 +27,6 @@ public class ZombiesUtilsConfig {
private Property cpsCounter; private Property cpsCounter;
private Property announcePB; private Property announcePB;
private Property playerVis; private Property playerVis;
private Property playerVisRange;
public ZombiesUtilsConfig(Configuration config) { public ZombiesUtilsConfig(Configuration config) {
this.config = config; this.config = config;
@ -34,7 +34,9 @@ public class ZombiesUtilsConfig {
} }
private void read() { private void read() {
ZombiesUtils.getInstance().getLogger().debug("Loading config...");
config.load(); config.load();
ZombiesUtils.getInstance().getLogger().debug("Config loaded.");
//SST //SST
sstHud = config.get( sstHud = config.get(
@ -97,22 +99,6 @@ public class ZombiesUtilsConfig {
"Whether to announce PBs." "Whether to announce PBs."
); );
//Player Visibility
playerVis = config.get(
"PlayerVis",
"default",
false,
"If players should always be visible"
);
playerVisRange = config.get(
"PlayerVis",
"range",
4,
"The range within which players are hidden",
0,
50
);
//ROOT //ROOT
language = config.get( language = config.get(
@ -128,6 +114,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",
@ -159,21 +151,14 @@ public class ZombiesUtilsConfig {
); );
} }
private List<IConfigElement> getPlayerVisElements() {
return Arrays.asList(
new CustomConfigElement("Enabled", playerVis),
new CustomConfigElement("Range", playerVisRange)
);
}
List<IConfigElement> getRootElements() { List<IConfigElement> getRootElements() {
return Arrays.asList( return Arrays.asList(
new CustomConfigElement("Language", language), new CustomConfigElement("Language", language),
new DummyConfigElement.DummyCategoryElement("Timer", "", getTimerElements()), new DummyConfigElement.DummyCategoryElement("Timer", "", getTimerElements()),
new DummyConfigElement.DummyCategoryElement("SST", "", getSpawntimeElements()), new DummyConfigElement.DummyCategoryElement("SST", "", getSpawntimeElements()),
new DummyConfigElement.DummyCategoryElement("SLA", "", getSlaElements()), new DummyConfigElement.DummyCategoryElement("SLA", "", getSlaElements()),
new DummyConfigElement.DummyCategoryElement("Player Visibility", "", getPlayerVisElements()),
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)
); );
@ -219,19 +204,13 @@ public class ZombiesUtilsConfig {
public boolean getCpsToggle() { public boolean getCpsToggle() {
return cpsCounter.getBoolean(); return cpsCounter.getBoolean();
} }
public boolean getAnnouncePB() { public boolean getAnnouncePB() {
return announcePB.getBoolean(); return announcePB.getBoolean();
} }
public boolean getPlayerVis() { public boolean getPlayerVis() {
return playerVis.getBoolean(); return playerVis.getBoolean();
} }
public int getPlayerVisRange() {
return playerVisRange.getInt();
}
@SubscribeEvent @SubscribeEvent
public void onConfigChange(ConfigChangedEvent.@NotNull OnConfigChangedEvent event) { public void onConfigChange(ConfigChangedEvent.@NotNull OnConfigChangedEvent event) {
if (event.modID.equals("zombiesutils") && event.configID == null) { if (event.modID.equals("zombiesutils") && event.configID == null) {

View file

@ -8,7 +8,6 @@ import org.jetbrains.annotations.NotNull;
public class GameData { public class GameData {
private final Round[][] roundData; private final Round[][] roundData;
public GameData() { public GameData() {
roundData = new Round[10][]; roundData = new Round[10][];
roundData[0] = readFromFile("data/rounds/DEAD_END_NORMAL.json"); roundData[0] = readFromFile("data/rounds/DEAD_END_NORMAL.json");
@ -24,27 +23,28 @@ public class GameData {
} }
public Round getRound(@NotNull GameMode gameMode, int round) { public Round getRound(@NotNull GameMode gameMode, int round) {
final Round[] selected;
switch (gameMode) { switch (gameMode) {
case DEAD_END: case DEAD_END:
return roundData[0][round - 1]; return roundData[0][round-1];
case DEAD_END_HARD: case DEAD_END_HARD:
return roundData[1][round - 1]; return roundData[1][round-1];
case DEAD_END_RIP: case DEAD_END_RIP:
return roundData[2][round - 1]; return roundData[2][round-1];
case BAD_BLOOD: case BAD_BLOOD:
return roundData[3][round - 1]; return roundData[3][round-1];
case BAD_BLOOD_HARD: case BAD_BLOOD_HARD:
return roundData[4][round - 1]; return roundData[4][round-1];
case BAD_BLOOD_RIP: case BAD_BLOOD_RIP:
return roundData[5][round - 1]; return roundData[5][round-1];
case ALIEN_ARCADIUM: case ALIEN_ARCADIUM:
return roundData[6][round - 1]; return roundData[6][round-1];
case PRISON: case PRISON:
return roundData[7][round - 1]; return roundData[7][round-1];
case PRISON_HARD: case PRISON_HARD:
return roundData[8][round - 1]; return roundData[8][round-1];
case PRISON_RIP: case PRISON_RIP:
return roundData[9][round - 1]; return roundData[9][round-1];
default: default:
throw new IllegalStateException("Invalid GameMode: " + gameMode); throw new IllegalStateException("Invalid GameMode: " + gameMode);
} }

View file

@ -12,28 +12,11 @@ public enum GameMode {
PRISON(Map.PRISON, Difficulty.NORMAL), PRISON_HARD(Map.PRISON, Difficulty.HARD), PRISON_RIP(Map.PRISON, Difficulty.RIP); PRISON(Map.PRISON, Difficulty.NORMAL), PRISON_HARD(Map.PRISON, Difficulty.HARD), PRISON_RIP(Map.PRISON, Difficulty.RIP);
private final Map map; private final Map map;
private final Difficulty difficulty; private final Difficulty difficulty;
GameMode(final @NotNull Map map, final @NotNull Difficulty difficulty) { GameMode(final @NotNull Map map, final @NotNull Difficulty difficulty) {
this.map = map; this.map = map;
this.difficulty = difficulty; this.difficulty = difficulty;
} }
@Contract(pure = true)
public static GameMode getNormalForMap(final @NotNull Map map) {
switch (map) {
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 value: " + map);
}
}
public Map getMap() { public Map getMap() {
return this.map; return this.map;
} }
@ -41,7 +24,6 @@ public enum GameMode {
public Difficulty getDifficulty() { public Difficulty getDifficulty() {
return this.difficulty; return this.difficulty;
} }
public GameMode appliedDifficulty(final Difficulty difficulty) { public GameMode appliedDifficulty(final Difficulty difficulty) {
switch (this.map) { switch (this.map) {
case DEAD_END: case DEAD_END:
@ -77,8 +59,23 @@ public enum GameMode {
throw new IllegalStateException("Invalid Map: " + this.map); throw new IllegalStateException("Invalid Map: " + this.map);
} }
} }
public boolean isMap(Map map) { public boolean isMap(Map map) {
return this.getMap() == map; return this.getMap() == map;
} }
@Contract(pure = true)
public static GameMode getNormalForMap(final @NotNull Map map) {
switch (map) {
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 value: " + map);
}
}
} }

View file

@ -14,7 +14,7 @@ public enum Map {
public static Optional<Map> getMap() { public static Optional<Map> getMap() {
World world = Minecraft.getMinecraft().theWorld; World world = Minecraft.getMinecraft().theWorld;
BlockPos pos = new BlockPos(44, 71, 0); BlockPos pos = new BlockPos(44,71,0);
if (!world.isBlockLoaded(pos) || Scoreboard.isNotZombies()) return Optional.empty(); if (!world.isBlockLoaded(pos) || Scoreboard.isNotZombies()) return Optional.empty();
Block block = world.getBlockState(pos).getBlock(); Block block = world.getBlockState(pos).getBlock();

View file

@ -1,7 +1,7 @@
package com.github.stachelbeere1248.zombiesutils.game.sla; package com.github.stachelbeere1248.zombiesutils.game.sla;
import com.github.stachelbeere1248.zombiesutils.game.enums.Map;
import com.github.stachelbeere1248.zombiesutils.game.windows.SLA; import com.github.stachelbeere1248.zombiesutils.game.windows.SLA;
import com.github.stachelbeere1248.zombiesutils.game.enums.Map;
@SuppressWarnings("SpellCheckingInspection") @SuppressWarnings("SpellCheckingInspection")
public class QuickSLA { public class QuickSLA {

View file

@ -0,0 +1,39 @@
package com.github.stachelbeere1248.zombiesutils.game.waves;
import java.util.stream.IntStream;
public enum Prefix {
BOSS(0xCC5555, "B"),
BLAZES(0xEFB61F, "BL"),
SLIME(0x88FF88,"S"),
HBM(0x2A415F, "HBM"),
WITHER_SKELETON(0x888888, "WS"),
OLD_ONE(0x55AA55, "O1"),
GIANT(0x00FFFF,"G"),
POLICE(0x16537E,"P"),
CELL(0xFF8234,"C"),
WINDOW(0xAAAAAA,"W");
private final int color;
private final String prefix;
Prefix(final int color, final String prefix) {
this.color = color;
this.prefix = prefix;
}
public int getColor() {
return color;
}
public String getPrefix() {
return prefix;
}
public int getFadedColor(final int fact, final int div) {
final int normalColor = this.getColor();
final int B = normalColor % 0xFF;
final int G = (normalColor - B) % (0xFF * 0xFF);
final int R = (normalColor - (B + G));
return IntStream.of(R, G, B).map(i -> (i * fact) / div).sum();
}
}

View file

@ -1,5 +1,8 @@
package com.github.stachelbeere1248.zombiesutils.game.waves; package com.github.stachelbeere1248.zombiesutils.game.waves;
import java.util.Arrays;
import java.util.stream.Collectors;
public class Round { public class Round {
private final Wave[] waves; private final Wave[] waves;

View file

@ -9,10 +9,9 @@ public class Wave {
this.ticks = ticks; this.ticks = ticks;
this.prefixes = prefixes; this.prefixes = prefixes;
} }
public Wave(final short ticks) { public Wave(final short ticks) {
this.ticks = ticks; this.ticks = ticks;
this.prefixes = new Prefix[]{ Prefix.WINDOW }; this.prefixes = new Prefix[]{Prefix.WINDOW};
} }
public short getTime() { public short getTime() {

View file

@ -8,7 +8,6 @@ import java.util.Arrays;
public class WaveTiming { public class WaveTiming {
public static int rl = 0; public static int rl = 0;
public static void onTick() { public static void onTick() {
if (Scoreboard.isNotZombies()) return; if (Scoreboard.isNotZombies()) return;
ZombiesUtils.getInstance().getGameManager().getGame().ifPresent( ZombiesUtils.getInstance().getGameManager().getGame().ifPresent(

View file

@ -17,19 +17,18 @@ public class ChatHandler {
@SubscribeEvent @SubscribeEvent
public void difficultyChange(@NotNull final ClientChatReceivedEvent event) { public void difficultyChange(@NotNull final ClientChatReceivedEvent event) {
if (event.message.getUnformattedText().contains(":")) return;
final String message = STRIP_COLOR_PATTERN.matcher(event.message.getUnformattedText()).replaceAll("").trim();
if (LanguageSupport.containsHard(message)) {
ZombiesUtils.getInstance().getGameManager().setDifficulty(Difficulty.HARD);
} else if (LanguageSupport.containsRIP(message)) {
ZombiesUtils.getInstance().getGameManager().setDifficulty(Difficulty.RIP);
} else {
ZombiesUtils.getInstance().getGameManager().getGame().ifPresent( ZombiesUtils.getInstance().getGameManager().getGame().ifPresent(
game -> { game -> {
if (LanguageSupport.isHelicopterIncoming(message)) game.helicopter(); String message = STRIP_COLOR_PATTERN.matcher(event.message.getUnformattedText()).replaceAll("").trim();
if (message.contains(":")) return;
if (LanguageSupport.containsHard(message)) {
game.changeDifficulty(Difficulty.HARD);
} else if (LanguageSupport.containsRIP(message)) {
game.changeDifficulty(Difficulty.RIP);
} else if (LanguageSupport.isHelicopterIncoming(message)) {
game.helicopter();
}
} }
); );
} }
}
} }

View file

@ -2,9 +2,10 @@ package com.github.stachelbeere1248.zombiesutils.handlers;
import com.github.stachelbeere1248.zombiesutils.ZombiesUtils; import com.github.stachelbeere1248.zombiesutils.ZombiesUtils;
import com.github.stachelbeere1248.zombiesutils.game.waves.Prefix; import com.github.stachelbeere1248.zombiesutils.game.waves.Prefix;
import com.github.stachelbeere1248.zombiesutils.game.waves.Round;
import com.github.stachelbeere1248.zombiesutils.game.waves.Wave; import com.github.stachelbeere1248.zombiesutils.game.waves.Wave;
import com.github.stachelbeere1248.zombiesutils.game.windows.Room;
import com.github.stachelbeere1248.zombiesutils.game.windows.SLA; import com.github.stachelbeere1248.zombiesutils.game.windows.SLA;
import com.github.stachelbeere1248.zombiesutils.game.windows.Room;
import com.github.stachelbeere1248.zombiesutils.timer.Game; import com.github.stachelbeere1248.zombiesutils.timer.Game;
import com.github.stachelbeere1248.zombiesutils.utils.Scoreboard; import com.github.stachelbeere1248.zombiesutils.utils.Scoreboard;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -51,8 +52,7 @@ public class RenderGameOverlayHandler {
} }
); );
if (!Minecraft.getMinecraft().gameSettings.showDebugInfo) if (!Minecraft.getMinecraft().gameSettings.showDebugInfo) SLA.getInstance().ifPresent(sla -> renderSla(sla.getRooms()));
SLA.getInstance().ifPresent(sla -> renderSla(sla.getRooms()));
if (ZombiesUtils.getInstance().getConfig().getCpsToggle()) renderCPS(); if (ZombiesUtils.getInstance().getConfig().getCpsToggle()) renderCPS();
} }
@ -87,7 +87,6 @@ public class RenderGameOverlayHandler {
y++; y++;
} }
} }
private void renderSpawnTime(final Game game) { private void renderSpawnTime(final Game game) {
if (!ZombiesUtils.getInstance().getConfig().getSST() || Scoreboard.isNotZombies()) return; if (!ZombiesUtils.getInstance().getConfig().getSST() || Scoreboard.isNotZombies()) return;
final ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); final ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
@ -124,7 +123,7 @@ public class RenderGameOverlayHandler {
prefixString, prefixString,
screenWidth - width, screenWidth - width,
screenHeight - fontRenderer.FONT_HEIGHT * (length - heightIndex), screenHeight - fontRenderer.FONT_HEIGHT * (length - heightIndex),
faded ? prefix.getFadedColor() : prefix.getColor() faded ? prefix.getFadedColor(3,5) : prefix.getColor()
); );
} }
if (!faded) color = 0xAAAAAA; if (!faded) color = 0xAAAAAA;

View file

@ -24,10 +24,8 @@ public class RenderPlayerHandler {
} }
private boolean inRange(@NotNull Vec3 playerOther) { private boolean inRange(@NotNull Vec3 playerOther) {
final int range = ZombiesUtils.getInstance().getConfig().getPlayerVisRange(); return playerOther.squareDistanceTo(Minecraft.getMinecraft().thePlayer.getPositionVector()) <= 16;
return playerOther.squareDistanceTo(Minecraft.getMinecraft().thePlayer.getPositionVector()) <= range * range;
} }
public void togglePlayerVisibility() { public void togglePlayerVisibility() {
this.visible = !this.visible; this.visible = !this.visible;
final String s; final String s;

View file

@ -60,7 +60,7 @@ public class MixinNetHandlerPlayClient {
final String message = packet.getMessage().getUnformattedText().trim(); final String message = packet.getMessage().getUnformattedText().trim();
String serverNumber; String serverNumber;
serverNumber = Scoreboard.getServerNumber().orElse(""); serverNumber = Scoreboard.getServerNumber().orElse("");
if (LanguageSupport.isWin(message)) ZombiesUtils.getInstance().getGameManager().endGame(serverNumber, true); if (LanguageSupport.isWin(message)) ZombiesUtils.getInstance().getGameManager().endGame(serverNumber,true);
if (LanguageSupport.isLoss(message)) ZombiesUtils.getInstance().getGameManager().endGame(serverNumber, false); if (LanguageSupport.isLoss(message)) ZombiesUtils.getInstance().getGameManager().endGame(serverNumber, false);
} }

View file

@ -3,8 +3,8 @@ package com.github.stachelbeere1248.zombiesutils.timer;
import com.github.stachelbeere1248.zombiesutils.ZombiesUtils; import com.github.stachelbeere1248.zombiesutils.ZombiesUtils;
import com.github.stachelbeere1248.zombiesutils.game.GameMode; import com.github.stachelbeere1248.zombiesutils.game.GameMode;
import com.github.stachelbeere1248.zombiesutils.game.enums.Difficulty; import com.github.stachelbeere1248.zombiesutils.game.enums.Difficulty;
import com.github.stachelbeere1248.zombiesutils.game.enums.Map;
import com.github.stachelbeere1248.zombiesutils.game.windows.SLA; import com.github.stachelbeere1248.zombiesutils.game.windows.SLA;
import com.github.stachelbeere1248.zombiesutils.game.enums.Map;
import com.github.stachelbeere1248.zombiesutils.handlers.Round1Correction; import com.github.stachelbeere1248.zombiesutils.handlers.Round1Correction;
import com.github.stachelbeere1248.zombiesutils.timer.recorder.Category; import com.github.stachelbeere1248.zombiesutils.timer.recorder.Category;
import com.github.stachelbeere1248.zombiesutils.timer.recorder.files.CategoryFile; import com.github.stachelbeere1248.zombiesutils.timer.recorder.files.CategoryFile;
@ -35,7 +35,6 @@ public class Game {
MinecraftForge.EVENT_BUS.register(new Round1Correction(this.timer, serverNumber)); MinecraftForge.EVENT_BUS.register(new Round1Correction(this.timer, serverNumber));
if (ZombiesUtils.getInstance().getConfig().isSlaToggled()) SLA.instance = new SLA(map); if (ZombiesUtils.getInstance().getConfig().isSlaToggled()) SLA.instance = new SLA(map);
} }
public Game(@NotNull final Map map, final String serverNumber, final int round) { public Game(@NotNull final Map map, final String serverNumber, final int round) {
this.gameMode = GameMode.getNormalForMap(map); this.gameMode = GameMode.getNormalForMap(map);
this.timer = new Timer(); this.timer = new Timer();
@ -52,19 +51,15 @@ public class Game {
public Timer getTimer() { public Timer getTimer() {
return this.timer; return this.timer;
} }
public void setCategory(Category category) { public void setCategory(Category category) {
this.category = category; this.category = category;
} }
public void changeDifficulty(final Difficulty difficulty) { public void changeDifficulty(final Difficulty difficulty) {
this.gameMode = this.gameMode.appliedDifficulty(difficulty); this.gameMode = this.gameMode.appliedDifficulty(difficulty);
} }
public int getRound() { public int getRound() {
return round; return round;
} }
public GameMode getGameMode() { public GameMode getGameMode() {
return gameMode; return gameMode;
} }
@ -83,7 +78,6 @@ public class Game {
this.timer.split(); this.timer.split();
this.round = round + 1; this.round = round + 1;
} }
public void helicopter() { public void helicopter() {
if (!gameMode.isMap(Map.PRISON)) { if (!gameMode.isMap(Map.PRISON)) {
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§cEscaping without playing prison???")); Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§cEscaping without playing prison???"));

View file

@ -1,20 +1,17 @@
package com.github.stachelbeere1248.zombiesutils.timer; package com.github.stachelbeere1248.zombiesutils.timer;
import com.github.stachelbeere1248.zombiesutils.game.enums.Difficulty;
import com.github.stachelbeere1248.zombiesutils.game.enums.Map; import com.github.stachelbeere1248.zombiesutils.game.enums.Map;
import com.github.stachelbeere1248.zombiesutils.utils.InvalidMapException; import com.github.stachelbeere1248.zombiesutils.utils.InvalidMapException;
import com.github.stachelbeere1248.zombiesutils.utils.ScoardboardException; import com.github.stachelbeere1248.zombiesutils.utils.ScoardboardException;
import com.github.stachelbeere1248.zombiesutils.utils.Scoreboard; import com.github.stachelbeere1248.zombiesutils.utils.Scoreboard;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
public class GameManager { public class GameManager {
private final HashMap<String, Game> GAMES; private final HashMap<String, Game> GAMES;
private Optional<Difficulty> queuedDifficulty = Optional.empty();
private String queuedDifficultyServer = "INVALID";
public GameManager() { public GameManager() {
GAMES = new HashMap<>(); GAMES = new HashMap<>();
@ -46,25 +43,11 @@ public class GameManager {
public void splitOrNew(int round) throws ScoardboardException, InvalidMapException { public void splitOrNew(int round) throws ScoardboardException, InvalidMapException {
final String serverNumber = Scoreboard.getServerNumber().orElseThrow(ScoardboardException::new); final String serverNumber = Scoreboard.getServerNumber().orElseThrow(ScoardboardException::new);
if (GAMES.containsKey(serverNumber)) { if (GAMES.containsKey(serverNumber)) {
if (round == 0) newGame(serverNumber); if (round == 0) GAMES.put(serverNumber, new Game(Map.getMap().orElseThrow(InvalidMapException::new), serverNumber));
else GAMES.get(serverNumber).pass(round); else GAMES.get(serverNumber).pass(round);
} else newGame(serverNumber); } else {
GAMES.put(serverNumber, new Game(Map.getMap().orElseThrow(InvalidMapException::new), serverNumber, round + 1));
} }
private void newGame(@NotNull String serverNumber) throws InvalidMapException {
final Game game = new Game(Map.getMap().orElseThrow(InvalidMapException::new), serverNumber);
if (serverNumber.equals(queuedDifficultyServer)) {
this.queuedDifficulty.ifPresent(game::changeDifficulty);
}
this.queuedDifficulty = Optional.empty();
this.GAMES.put(serverNumber, game);
}
public void setDifficulty(@NotNull Difficulty difficulty) {
this.queuedDifficultyServer = Scoreboard.getServerNumber().orElse("INVALID");
if (this.GAMES.containsKey(this.queuedDifficultyServer)) {
this.GAMES.get(this.queuedDifficultyServer).changeDifficulty(difficulty);
} else this.queuedDifficulty = Optional.of(difficulty);
} }
public Set<String> getGames() { public Set<String> getGames() {

View file

@ -15,7 +15,6 @@ public class RecordMessageSender {
private final String deltaString; private final String deltaString;
private final String timeString; private final String timeString;
private String copyString; private String copyString;
public RecordMessageSender(final String categoryName, final int round, final int newTime, final int oldTime) { public RecordMessageSender(final String categoryName, final int round, final int newTime, final int oldTime) {
this.recordMessage = new StringBuilder( this.recordMessage = new StringBuilder(
"§l§a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n§e Category: §d" + categoryName "§l§a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n§e Category: §d" + categoryName
@ -70,7 +69,6 @@ public class RecordMessageSender {
String.format("Round %d took %s!", round, timeString) : String.format("Round %d took %s!", round, timeString) :
String.format("Round %d took %s (%s)!", round, timeString, deltaString); String.format("Round %d took %s (%s)!", round, timeString, deltaString);
} }
public void helicopterSplit() { public void helicopterSplit() {
final String announcement = newTime < oldTime && ZombiesUtils.getInstance().getConfig().getAnnouncePB() ? final String announcement = newTime < oldTime && ZombiesUtils.getInstance().getConfig().getAnnouncePB() ?
"\n§e§l***§6§l NEW PERSONAL BEST! §e§l***" : ""; "\n§e§l***§6§l NEW PERSONAL BEST! §e§l***" : "";
@ -84,7 +82,6 @@ public class RecordMessageSender {
String.format("Helicopter called at %s!", timeString) : String.format("Helicopter called at %s!", timeString) :
String.format("Helicopter called at %s (%s)!", timeString, deltaString); String.format("Helicopter called at %s (%s)!", timeString, deltaString);
} }
@Contract(pure = true) @Contract(pure = true)
private String formattedTime(int time) { private String formattedTime(int time) {
time *= 50; time *= 50;
@ -95,7 +92,6 @@ public class RecordMessageSender {
(time % 100) / 10 (time % 100) / 10
); );
} }
@Contract(pure = true) @Contract(pure = true)
private String formattedDelta(int newTime, int oldTime) { private String formattedDelta(int newTime, int oldTime) {
final double delta = (double) (newTime - oldTime) / 20; final double delta = (double) (newTime - oldTime) / 20;

View file

@ -14,11 +14,9 @@ public class Timer {
public void correctStartTick() { public void correctStartTick() {
this.startTick = this.getCurrentTick() - 200; this.startTick = this.getCurrentTick() - 200;
} }
void split() { void split() {
this.roundStart = this.getGameTime(); this.roundStart = this.getGameTime();
} }
public int getGameTime() { public int getGameTime() {
return (int) (getCurrentTick() - startTick); return (int) (getCurrentTick() - startTick);
} }

View file

@ -51,7 +51,6 @@ public class LanguageSupport {
}; };
return Arrays.stream(words).anyMatch(input::contains); return Arrays.stream(words).anyMatch(input::contains);
} }
public static boolean isHelicopterIncoming(@NotNull String input) { public static boolean isHelicopterIncoming(@NotNull String input) {
final String[] words = { final String[] words = {
"The Helicopter is on its way! Hold out for 120 more seconds!" "The Helicopter is on its way! Hold out for 120 more seconds!"
@ -71,7 +70,6 @@ public class LanguageSupport {
throw new IllegalStateException("Unexpected value: " + language); throw new IllegalStateException("Unexpected value: " + language);
} }
} }
public static String[] getLanguages() { public static String[] getLanguages() {
return LANGUAGES; return LANGUAGES;
} }

View file

@ -1,37 +0,0 @@
package com.github.stachelbeere1248.zombiesutils.game.waves;
public enum Prefix {
BOSS(0xCC5555, "B", 0x7A3333),
BLAZES(0xEFB61F, "BL", 0x8F6D0F),
SLIME(0x88FF88, "S", 0x51A951),
HBM(0x2A415F, "HBM", 0x193241),
WITHER_SKELETON(0x888888, "WS", 0x515151),
OLD_ONE(0x55AA55, "O1", 0x336633),
GIANT(0x00FFFF, "G", 0x009999),
POLICE(0x16537E, "P", 0x0E324D),
CELL(0xFF8234, "C", 0x99501F),
WINDOW(0xAAAAAA, "W", 0x666666);
private final int color;
private final int fadedColor;
private final String prefix;
Prefix(final int color, final String prefix, final int fadedColor) {
this.color = color;
this.prefix = prefix;
this.fadedColor = fadedColor;
}
public int getColor() {
return color;
}
public String getPrefix() {
return prefix;
}
public int getFadedColor() {
return fadedColor;
}
}

View file

@ -1,188 +0,0 @@
package xyz.stachel.zombiesutils.init;
import org.spongepowered.asm.lib.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
/**
* A mixin plugin to automatically discover all mixins in the current JAR.
* <p>
* This mixin plugin automatically scans your entire JAR (or class directory, in case of an in-IDE launch) for classes inside of your
* mixin package and registers those. It does this recursively for sub packages of the mixin package as well. This means you will need
* to only have mixin classes inside of your mixin package, which is good style anyway.
*
* @author Linnea Gräf
*/
public class AutoDiscoveryMixinPlugin implements IMixinConfigPlugin {
private static final List<AutoDiscoveryMixinPlugin> mixinPlugins = new ArrayList<>();
public static List<AutoDiscoveryMixinPlugin> getMixinPlugins() {
return mixinPlugins;
}
private String mixinPackage;
@Override
public void onLoad(String mixinPackage) {
this.mixinPackage = mixinPackage;
mixinPlugins.add(this);
}
/**
* Resolves the base class root for a given class URL. This resolves either the JAR root, or the class file root.
* In either case the return value of this + the class name will resolve back to the original class url, or to other
* class urls for other classes.
*/
public URL getBaseUrlForClassUrl(URL classUrl) {
String string = classUrl.toString();
if (classUrl.getProtocol().equals("jar")) {
try {
return new URL(string.substring(4).split("!")[0]);
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
if (string.endsWith(".class")) {
try {
return new URL(string.replace("\\", "/")
.replace(getClass().getCanonicalName()
.replace(".", "/") + ".class", ""));
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
return classUrl;
}
/**
* Get the package that contains all the mixins. This value is set by mixin itself using {@link #onLoad}.
*/
public String getMixinPackage() {
return mixinPackage;
}
/**
* Get the path inside the class root to the mixin package
*/
public String getMixinBaseDir() {
return mixinPackage.replace(".", "/");
}
/**
* A list of all discovered mixins.
*/
private List<String> mixins = null;
/**
* Try to add mixin class ot the mixins based on the filepath inside of the class root.
* Removes the {@code .class} file suffix, as well as the base mixin package.
* <p><b>This method cannot be called after mixin initialization.</p>
*
* @param className the name or path of a class to be registered as a mixin.
*/
public void tryAddMixinClass(String className) {
String norm = (className.endsWith(".class") ? className.substring(0, className.length() - ".class".length()) : className)
.replace("\\", "/")
.replace("/", ".");
if (norm.startsWith(getMixinPackage() + ".") && !norm.endsWith(".")) {
mixins.add(norm.substring(getMixinPackage().length() + 1));
}
}
/**
* Search through the JAR or class directory to find mixins contained in {@link #getMixinPackage()}
*/
@Override
public List<String> getMixins() {
if (mixins != null) return mixins;
System.out.println("Trying to discover mixins");
mixins = new ArrayList<>();
URL classUrl = getClass().getProtectionDomain().getCodeSource().getLocation();
System.out.println("Found classes at " + classUrl);
Path file;
try {
file = Paths.get(getBaseUrlForClassUrl(classUrl).toURI());
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
System.out.println("Base directory found at " + file);
if (Files.isDirectory(file)) {
walkDir(file);
} else {
walkJar(file);
}
System.out.println("Found mixins: " + mixins);
return mixins;
}
/**
* Search through directory for mixin classes based on {@link #getMixinBaseDir}.
*
* @param classRoot The root directory in which classes are stored for the default package.
*/
private void walkDir(Path classRoot) {
System.out.println("Trying to find mixins from directory");
try (Stream<Path> classes = Files.walk(classRoot.resolve(getMixinBaseDir()))) {
classes.map(it -> classRoot.relativize(it).toString())
.forEach(this::tryAddMixinClass);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
/**
* Read through a JAR file, trying to find all mixins inside.
*/
private void walkJar(Path file) {
System.out.println("Trying to find mixins from jar file");
try (ZipInputStream zis = new ZipInputStream(Files.newInputStream(file))) {
ZipEntry next;
while ((next = zis.getNextEntry()) != null) {
tryAddMixinClass(next.getName());
zis.closeEntry();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@Override
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
}
@Override
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
}
@Override
public String getRefMapperConfig() {
return null;
}
@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
return true;
}
@Override
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {
}
}

View file

@ -1,2 +0,0 @@
public net.minecraft.client.renderer.GlStateManager$Color

View file

@ -2,16 +2,16 @@
{ {
"modid": "${modid}", "modid": "${modid}",
"name": "Zombies Utils", "name": "Zombies Utils",
"description": "An all-in-one mod for Hypixel Zombies. Targets legit speed-runners.", "description": "",
"version": "${version}", "version": "${version}",
"mcversion": "${mcversion}", "mcversion": "${mcversion}",
"url": "https://github.com/Stachelbeere1248/zombies-utils", "url": "https://github.com/Stachelbeere1248/zombies-utils",
"updateUrl": "https://github.com/Stachelbeere1248/zombies-utils/blob/master/update.json", "updateUrl": "https://github.com/Stachelbeere1248/zombies-utils/update.json",
"authorList": [ "authorList": [
"Stachelbeere1248" "Stachelbeere1248"
], ],
"credits": "Seosean, thamid-23", "credits": "Seosean, thamid-23",
"logoFile": "zombiesutils.png", "logoFile": "",
"screenshots": [], "screenshots": [],
"dependencies": [] "dependencies": []
} }

View file

@ -1,8 +1,11 @@
{ {
"package": "${basePackage}.mixin", "package": "com.github.stachelbeere1248.zombiesutils.mixin",
"plugin": "${basePackage}.init.AutoDiscoveryMixinPlugin",
"refmap": "mixins.${modid}.refmap.json", "refmap": "mixins.${modid}.refmap.json",
"minVersion": "0.7", "minVersion": "0.7",
"compatibilityLevel": "JAVA_8", "compatibilityLevel": "JAVA_8",
"__comment": "You do not need to manually register mixins in this template. Check the auto discovery mixin plugin for more info." "mixins": [
],
"client": [
"MixinNetHandlerPlayClient"
]
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 273 B

View file

@ -1,13 +1,10 @@
{ {
"homepage": "https://github.com/Stachelbeere1248/zombies-utils/releases", "homepage": "https://github.com/Stachelbeere1248/zombies-utils/releases",
"promos": { "promos": {
"1.8.9-latest": "1.3.7", "1.8.9-latest" : "1.3.4",
"1.8.9-recommended": "1.3.7" "1.8.9-recommended" : "1.3.4"
}, },
"1.8.9": { "1.8.9" : {
"1.3.6": "SST Prefixes, added update checker url", "1.3.5" : "SST Prefixes, added update checker url"
"1.3.7-PRE_1": "patch: difficiluty detection",
"1.3.7-PRE_2": "fix instant crash",
"1.3.7": "mark release, fix faded prefix colors"
} }
} }