-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
193 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/com/seosean/showspawntime/events/NoticeSoundEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
30 changes: 0 additions & 30 deletions
30
src/main/java/com/seosean/showspawntime/events/PowerupSpawnEvent.java
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
src/main/java/com/seosean/showspawntime/events/ZombiesTickEvent.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 27 additions & 13 deletions
40
src/main/java/com/seosean/showspawntime/features/spawntimes/SpawnNotice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.