Skip to content

Commit

Permalink
2.0.3 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
Seosean committed Mar 23, 2024
1 parent 3bdb69c commit d311f77
Show file tree
Hide file tree
Showing 19 changed files with 193 additions and 189 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ plugins {
id "net.minecraftforge.gradle.forge" version "2.0.2"
}
*/
version = "2.0.2"
version = "2.0.3"
group= "com.seosean.showspawntime" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "ShowSpawnTime"

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/seosean/showspawntime/ShowSpawnTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
public class ShowSpawnTime
{
public static final String MODID = "showspawntime";
public static final String VERSION = "2.0.2";
public static final String VERSION = "2.0.3";
public static final String EMOJI_REGEX = "(?:[\uD83C\uDF00-\uD83D\uDDFF]|[\uD83E\uDD00-\uD83E\uDDFF]|[\uD83D\uDE00-\uD83D\uDE4F]|[\uD83D\uDE80-\uD83D\uDEFF]|[\u2600-\u26FF]\uFE0F?|[\u2700-\u27BF]\uFE0F?|\u24C2\uFE0F?|[\uD83C\uDDE6-\uD83C\uDDFF]{1,2}|[\uD83C\uDD70\uD83C\uDD71\uD83C\uDD7E\uD83C\uDD7F\uD83C\uDD8E\uD83C\uDD91-\uD83C\uDD9A]\uFE0F?|[\u0023\u002A\u0030-\u0039]\uFE0F?\u20E3|[\u2194-\u2199\u21A9-\u21AA]\uFE0F?|[\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55]\uFE0F?|[\u2934\u2935]\uFE0F?|[\u3030\u303D]\uFE0F?|[\u3297\u3299]\uFE0F?|[\uD83C\uDE01\uD83C\uDE02\uD83C\uDE1A\uD83C\uDE2F\uD83C\uDE32-\uD83C\uDE3A\uD83C\uDE50\uD83C\uDE51]\uFE0F?|[\u203C\u2049]\uFE0F?|[\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE]\uFE0F?|[\u00A9\u00AE]\uFE0F?|[\u2122\u2139]\uFE0F?|\uD83C\uDC04\uFE0F?|\uD83C\uDCCF\uFE0F?|[\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA]\uFE0F?)";
public static final String COLOR_REGEX = "§[a-zA-Z0-9]";
public static boolean isAutoSplitsLoaded;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ else if (button.id == 2002)
@Override
public void onGuiClosed()
{
super.onGuiClosed();

try {
if ((this.entryList.hasChangedEntry(true))) {
boolean requiresMcRestart = this.entryList.saveConfigElements();
Expand All @@ -81,6 +79,8 @@ public void onGuiClosed()
} catch (Throwable e) {
e.printStackTrace();
}

super.onGuiClosed();
}


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.seosean.showspawntime.events;

import net.minecraftforge.fml.common.eventhandler.Event;

public class NoticeSoundEvent extends Event {

private final String sound;
private final float pitch;
public NoticeSoundEvent(String sound, float pitch) {
this.sound = sound;
this.pitch = pitch;
}

public String getSound() {
return sound;
}

public float getPitch() {
return pitch;
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URL;
Expand Down Expand Up @@ -55,8 +56,6 @@ public void checkUpdates() {
new Thread(() -> {
try {
URL url = new URL("https://raw.githubusercontent.com/Seosean/ShowSpawnTime/2.0/build.gradle");

// Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 10809));
URLConnection connection = url.openConnection();

connection.setReadTimeout(20000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,43 +40,33 @@ public Powerup(PowerupType powerupType) {
this(powerupType, null);
}

private DelayedTask delayedTask;
private DelayedTask countdownTask;
public Powerup(PowerupType powerupType, EntityArmorStand entityArmorStand) {
this.powerupType = powerupType;
this.entityArmorStand = entityArmorStand;
this.offsetTime = 1200;
if (entityArmorStand != null) {
delayedTask = new DelayedTask() {
countdownTask = new DelayedTask() {
@Override
public void run() {
if (offsetTime <= 0) {
for (Map.Entry<EntityArmorStand, Powerup> entry : new ArrayList<>(powerups.entrySet())) {
if (entry.getValue().equals(Powerup.this)) {
powerups.remove(entry.getKey());
break;
}
}
powerups.remove(entityArmorStand);
this.cancel();
return;
}
offsetTime--;
}
};
delayedTask.runTaskTimer(0, 1);
countdownTask.runTaskTimer(0, 1);
} else {
this.inc = true;
}
}

public void claim() {
this.offsetTime = 0;
for (Map.Entry<EntityArmorStand, Powerup> entry : new ArrayList<>(powerups.entrySet())) {
if (entry.getValue().equals(Powerup.this)) {
powerups.remove(entry.getKey());
delayedTask.cancel();
return;
}
}
powerups.remove(entityArmorStand);
countdownTask.cancel();
}

public PowerupType getPowerupType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public PowerupDetect(){

}

public static Integer[] r2MaxRoundsDE = {2, 8, 12, 16, 21, 26};
public static Integer[] r2MaxRoundsDE = {2, 8, 12, 16, 21, 26, 31, 36};
public static Integer[] r2MaxRoundsBB = {2, 5, 8, 12, 16, 21, 26};
public static Integer[] r3MaxRoundsDEBB = {3, 6, 9, 13, 17, 22, 27};
public static Integer[] r3MaxRoundsDEBB = {3, 6, 9, 13, 17, 22, 27, 32, 37};

public static Integer[] r2MaxRoundsAA = {2, 5, 8, 12, 16, 21, 26, 31, 36, 41, 46, 51, 61, 66, 71, 76, 81, 86, 91, 96};
public static Integer[] r3MaxRoundsAA = {3, 6, 9, 13, 17, 22, 27, 32, 37, 42, 47, 52, 62, 67, 72, 77, 82, 87, 92, 97};
Expand Down Expand Up @@ -142,7 +142,8 @@ public void onChatReceived(ClientChatReceivedEvent event) {
public void run() {
for (Map.Entry<EntityArmorStand, Powerup> entry : new ArrayList<>(Powerup.powerups.entrySet())) {
if (entry.getValue().getPowerupType().equals(finalPowerupType)) {
if (entry.getKey() == null || entry.getKey().isDead) {
EntityArmorStand entityArmorStand = entry.getKey();
if (entityArmorStand == null || entityArmorStand.isDead) {
entry.getValue().claim();
isClaimed = true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,53 +1,67 @@
package com.seosean.showspawntime.features.spawntimes;

import com.seosean.showspawntime.config.MainConfiguration;
import com.seosean.showspawntime.events.NoticeSoundEvent;
import com.seosean.showspawntime.utils.GameUtils;
import com.seosean.showspawntime.utils.LanguageUtils;
import com.seosean.showspawntime.utils.PlayerUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

public class SpawnNotice {

private int currentRound;
private int[] currentRoundTimes = new int[0];
private final Minecraft minecraft = Minecraft.getMinecraft();
private static int currentRound;
private static int[] currentRoundTimes = new int[0];
private static final Minecraft minecraft = Minecraft.getMinecraft();

public void update(int round) {
this.currentRound = round;
this.currentRoundTimes = GameUtils.getRoundTimes(round);
public static void update(int round) {
currentRound = round;
currentRoundTimes = GameUtils.getRoundTimes(round);
}

public void onSpawn(int tick) {
public static void onSpawn(int tick) throws Exception{
if (currentRound == 0 || currentRoundTimes.length == 0) {
if (currentRound != 0) {
this.currentRoundTimes = GameUtils.getRoundTimes(currentRound);
currentRoundTimes = GameUtils.getRoundTimes(currentRound);
}
if (currentRoundTimes.length == 0) {
return;
}
}
EntityPlayerSP player = minecraft.thePlayer;
if (player == null) {
return;
}

int finalWaveTime = currentRoundTimes[currentRoundTimes.length - 1];

if ((MainConfiguration.PlayDEBBSound && (LanguageUtils.getMap().equals(LanguageUtils.ZombiesMap.DEAD_END) || LanguageUtils.getMap().equals(LanguageUtils.ZombiesMap.BAD_BLOOD) || LanguageUtils.getMap().equals(LanguageUtils.ZombiesMap.THE_LAB))) || (MainConfiguration.PlayAASound && LanguageUtils.getMap().equals(LanguageUtils.ZombiesMap.ALIEN_ARCADIUM))) {
for (int time : currentRoundTimes) {
if (time * 1000 == tick) {
if (finalWaveTime * 1000 == tick) {
minecraft.thePlayer.playSound(MainConfiguration.TheLastWaveSound, 2, (float) MainConfiguration.TheLastWavePitch);
PlayerUtils.playSound(MainConfiguration.TheLastWaveSound, (float) MainConfiguration.TheLastWavePitch);
} else {
minecraft.thePlayer.playSound(MainConfiguration.PrecededWaveSound, 2, (float) MainConfiguration.PrecededWavePitch);
PlayerUtils.playSound(MainConfiguration.PrecededWaveSound, (float) MainConfiguration.PrecededWavePitch);
}
return;
}
}
}
if(MainConfiguration.DEBBCountDown) {
if (tick == (finalWaveTime - 3) * 1000) {
Minecraft.getMinecraft().thePlayer.playSound(MainConfiguration.CountDownSound, 2, (float) MainConfiguration.CountDownPitch);
PlayerUtils.playSound(MainConfiguration.CountDownSound, (float) MainConfiguration.CountDownPitch);
} else if (tick == (finalWaveTime - 2) * 1000) {
Minecraft.getMinecraft().thePlayer.playSound(MainConfiguration.CountDownSound, 2, (float) MainConfiguration.CountDownPitch);
PlayerUtils.playSound(MainConfiguration.CountDownSound, (float) MainConfiguration.CountDownPitch);
} else if (tick == (finalWaveTime - 1) * 1000) {
Minecraft.getMinecraft().thePlayer.playSound(MainConfiguration.CountDownSound, 2, (float) MainConfiguration.CountDownPitch);
PlayerUtils.playSound(MainConfiguration.CountDownSound, (float) MainConfiguration.CountDownPitch);
}
}
}

@SubscribeEvent
public void onSoundPlay(NoticeSoundEvent event) {
Minecraft.getMinecraft().thePlayer.playSound(event.getSound(), 1.0F, event.getPitch());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.seosean.showspawntime.ShowSpawnTime;
import com.seosean.showspawntime.features.frcooldown.FastReviveCoolDown;
import com.seosean.showspawntime.features.spawntimes.SpawnNotice;
import com.seosean.showspawntime.utils.DelayedTask;
import com.seosean.showspawntime.utils.LanguageUtils;
import com.seosean.showspawntime.utils.PlayerUtils;
Expand Down Expand Up @@ -84,12 +85,12 @@ public void startOrSplit() {
zGameTick += 10;
if (zGameTick % 1000 == 0) {
if (zGameStarted && PlayerUtils.isInZombies()) {
ShowSpawnTime.getSpawnNotice().onSpawn(zGameTick);
SpawnNotice.onSpawn(zGameTick);
}
}



} catch (Exception e) {
System.out.println("SST Splits Exception 1!");
e.printStackTrace();
}
finally {
lock.unlock();
Expand All @@ -100,7 +101,7 @@ public void startOrSplit() {
zGameTick = 0;
}
} catch (Exception e) {
System.out.println("SST Splits Exception!");
System.out.println("SST Splits Exception 2!");
e.printStackTrace();
}
finally {
Expand Down
22 changes: 15 additions & 7 deletions src/main/java/com/seosean/showspawntime/mixins/MixinGuiIngame.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
import com.seosean.showspawntime.features.leftnotice.LeftNotice;
import com.seosean.showspawntime.features.powerups.Powerup;
import com.seosean.showspawntime.features.powerups.PowerupPredict;
import com.seosean.showspawntime.features.spawntimes.SpawnNotice;
import com.seosean.showspawntime.features.timerecorder.TimeRecorder;
import com.seosean.showspawntime.handler.Renderer;
import com.seosean.showspawntime.utils.DelayedTask;
import com.seosean.showspawntime.utils.GameUtils;
import com.seosean.showspawntime.utils.LanguageUtils;
import com.seosean.showspawntime.utils.PlayerUtils;
import com.seosean.showspawntime.utils.StringUtils;
Expand All @@ -19,6 +21,7 @@
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.scoreboard.Score;
import net.minecraft.util.EnumChatFormatting;
import org.apache.commons.lang3.ArrayUtils;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
Expand All @@ -28,6 +31,7 @@
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

Expand All @@ -54,10 +58,14 @@ private void displayTitle(String p_175178_1_, String p_175178_2_, int p_175178_3

Renderer.setShouldRender(true);

ShowSpawnTime.getSpawnNotice().update(round);
SpawnNotice.update(round);

Powerup.incPowerups.clear();

if (ArrayUtils.contains(GameUtils.getBossRounds(), round)) {
new ArrayList<>(Powerup.powerups.values()).forEach(Powerup::claim);
}

if (ShowSpawnTime.getPowerupDetect().isInsRound(round)) {
Powerup.deserialize(Powerup.PowerupType.INSTA_KILL);
}
Expand Down Expand Up @@ -121,11 +129,11 @@ private String modifyArgumentText(String text) {
}
if (MainConfiguration.PlayerHealthNotice) {
if (playerName.length() >= 2) {
EntityPlayer entityPlayer = getPlayerEntity(playerName);
EntityPlayer entityPlayer = showSpawnTime$getPlayerEntity(playerName);
if (entityPlayer != null) {
if (!entityPlayer.isInvisible()) {
float health = entityPlayer.getHealth();
playerHealthNoticeString = EnumChatFormatting.WHITE + "(" + getColor(entityPlayer) + (int) health + EnumChatFormatting.WHITE + ") ";
playerHealthNoticeString = EnumChatFormatting.WHITE + "(" + showSpawnTime$getColor(entityPlayer) + (int) health + EnumChatFormatting.WHITE + ") ";
}
}
}
Expand Down Expand Up @@ -251,14 +259,14 @@ private int modifyArgumentLeft2(int l1){


@Unique
private List<EntityPlayer> getPlayerList() {
private List<EntityPlayer> showSpawnTime$getPlayerList() {
return new CopyOnWriteArrayList<>(Minecraft.getMinecraft().theWorld.playerEntities);
}


@Unique
private EntityPlayer getPlayerEntity(String name) {
List<EntityPlayer> playerList = this.getPlayerList();
private EntityPlayer showSpawnTime$getPlayerEntity(String name) {
List<EntityPlayer> playerList = this.showSpawnTime$getPlayerList();
for (EntityPlayer entity: playerList){
String entityName = entity.getDisplayNameString().trim();
if (name.equals(entityName.trim())) {
Expand All @@ -269,7 +277,7 @@ private EntityPlayer getPlayerEntity(String name) {
}

@Unique
private EnumChatFormatting getColor(EntityPlayer entityPlayer) {
private EnumChatFormatting showSpawnTime$getColor(EntityPlayer entityPlayer) {
int currentHealth = (int)entityPlayer.getHealth();
if (currentHealth > entityPlayer.getMaxHealth() / 2) {
return EnumChatFormatting.GREEN;
Expand Down
Loading

0 comments on commit d311f77

Please sign in to comment.