Skip to content

Commit

Permalink
added sounds while other screens are up
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyzderp committed Jan 28, 2015
1 parent 1e47c1c commit 751414d
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 17 deletions.
2 changes: 1 addition & 1 deletion ant/build_examplemod.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<!-- The version of your mod, can be any string as long as it's valid as part of a file name -->
<!-- and should match the version string returned by your mod. -->
<property name="version" value="1.0.0" />
<property name="version" value="1.0.2" />

<!-- The Minecraft version the mod is for, appended to the output file name for reference -->
<property name="mcversion" value="1.7.2" />
Expand Down
4 changes: 2 additions & 2 deletions ant/buildnumber.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Sun Aug 24 15:42:45 PDT 2014
build.number=27
#Tue Jan 27 20:13:20 PST 2015
build.number=30
Binary file modified bin/com/kyzeragon/mobcountmod/LiteModMobCounter.class
Binary file not shown.
Binary file modified bin/com/kyzeragon/mobcountmod/MobCounter.class
Binary file not shown.
35 changes: 24 additions & 11 deletions java/com/kyzeragon/mobcountmod/LiteModMobCounter.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ public class LiteModMobCounter implements Tickable
private boolean showChildCounts = false;

private MobCounterConfigScreen configScreen = new MobCounterConfigScreen();
private MobCounter counter = new MobCounter();
private MobCounter counter = new MobCounter(staff);
private static KeyBinding counterKeyBinding;
private static KeyBinding hostileKeyBinding;
private static KeyBinding optionsKeyBinding;


private int counterVisible = 0; // 0 - not visible, 1 - compact, 2 - expanded
private int hostileVisible = 0;
private int playSoundCount = 100;
private int playSoundCount = 100; // counts down so sound plays once per sec

public LiteModMobCounter() {}

Expand All @@ -52,7 +52,7 @@ public String getName()
@Override
public String getVersion()
{
return "1.0.0";
return "1.0.2";
}

@Override
Expand Down Expand Up @@ -80,6 +80,27 @@ public void onTick(Minecraft minecraft, float partialTicks, boolean inGame, bool
{
configScreen.updateScreen();
}

if (inGame)
{
int totalCount = 0;
for (int i = 0; i < 8; i++)
{
totalCount += this.counter.countEntity(i + 8, true);
}
if (totalCount > 149)
{
if (this.playSoundCount == 0)
Minecraft.getMinecraft().thePlayer.playSound("note.bass", 1.0F, 1.0F);
else
{
if (this.playSoundCount > 99)
this.playSoundCount = -1;
}
this.playSoundCount++;
}
}

if (inGame && minecraft.currentScreen == null && Minecraft.isGuiEnabled())
{
if (this.useOptions && LiteModMobCounter.optionsKeyBinding.isPressed())
Expand Down Expand Up @@ -184,14 +205,6 @@ else if (Keyboard.isKeyDown(Keyboard.KEY_DOWN))
if (totalCount > 149) // if 150+ mobs, display in red and play sound.
{
color = 0xAA0000;
if (this.playSoundCount == 0)
Minecraft.getMinecraft().thePlayer.playSound("note.bass", 1.0F, 1.0F);
else
{
if (this.playSoundCount > 99)
this.playSoundCount = -1;
}
this.playSoundCount++;
}
else
this.playSoundCount = 100;
Expand Down
9 changes: 6 additions & 3 deletions java/com/kyzeragon/mobcountmod/MobCounter.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@ public class MobCounter {
private int hRadius; //radius for hostiles
private AxisAlignedBB hostileBB;

public MobCounter()
public MobCounter(boolean isStaff)
{
this.radius = 16;
this.hRadius = 16;
if (isStaff)
this.hRadius = 25;
else
this.hRadius = 16;

this.boundingBox = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0);
this.hostileBB = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0);

}

public int countEntity(int num, boolean adult)
Expand Down

0 comments on commit 751414d

Please sign in to comment.