Skip to content

Commit

Permalink
increased hostile limit to 150 and plays sound
Browse files Browse the repository at this point in the history
also defaults to no displays on startup
  • Loading branch information
Kyzderp committed Jan 27, 2015
1 parent 9f3c12b commit c7529a0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ant/build_examplemod.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<!-- The file is well commented and you should have a read through this script before making -->
<!-- changes to ensure that you know how it works. -->

<project name="mobcounter" basedir="." default="main">
<project name="mobcounter_staff" basedir="." default="main">

<!-- 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. -->
Expand Down
Binary file modified bin/com/kyzeragon/mobcountmod/LiteModMobCounter.class
Binary file not shown.
33 changes: 27 additions & 6 deletions java/com/kyzeragon/mobcountmod/LiteModMobCounter.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
@ExposableOptions(strategy = ConfigStrategy.Versioned, filename="mobcountermod.json")
public class LiteModMobCounter implements Tickable
{
private boolean staff = false;
private boolean showChildCounts = true;
private static final boolean staff = true;
private static final boolean useOptions = false;

private boolean showChildCounts = false;

private MobCounterConfigScreen configScreen = new MobCounterConfigScreen();
private MobCounter counter = new MobCounter();
Expand All @@ -33,14 +35,17 @@ public class LiteModMobCounter implements Tickable
private static KeyBinding optionsKeyBinding;


private int counterVisible = 1; // 0 - not visible, 1 - compact, 2 - expanded
private int counterVisible = 0; // 0 - not visible, 1 - compact, 2 - expanded
private int hostileVisible = 0;
private int playSoundCount = 100;

public LiteModMobCounter() {}

@Override
public String getName()
{
if (this.staff)
return "Mob Counter - Staff";
return "Mob Counter";
}

Expand All @@ -55,15 +60,19 @@ public void init(File configPath)
{
counterKeyBinding = new KeyBinding("key.counter.toggle", Keyboard.KEY_P, "key.categories.litemods");
hostileKeyBinding = new KeyBinding("key.counter.togglehostile", Keyboard.KEY_O, "key.categories.litemods");
optionsKeyBinding = new KeyBinding("key.counter.options", Keyboard.KEY_SEMICOLON, "key.categories.litemods");
if (this.useOptions)
optionsKeyBinding = new KeyBinding("key.counter.options", Keyboard.KEY_SEMICOLON, "key.categories.litemods");

LiteLoader.getInput().registerKeyBinding(counterKeyBinding);
LiteLoader.getInput().registerKeyBinding(hostileKeyBinding);
if (this.useOptions)
LiteLoader.getInput().registerKeyBinding(optionsKeyBinding);
}

@Override
public void upgradeSettings(String version, File configPath, File oldConfigPath) {}

@SuppressWarnings("unused")
@Override
public void onTick(Minecraft minecraft, float partialTicks, boolean inGame, boolean clock)
{
Expand All @@ -73,7 +82,7 @@ public void onTick(Minecraft minecraft, float partialTicks, boolean inGame, bool
}
if (inGame && minecraft.currentScreen == null && Minecraft.isGuiEnabled())
{
if (LiteModMobCounter.optionsKeyBinding.isPressed())
if (this.useOptions && LiteModMobCounter.optionsKeyBinding.isPressed())
{
minecraft.displayGuiScreen(this.configScreen);
}
Expand Down Expand Up @@ -172,8 +181,20 @@ else if (Keyboard.isKeyDown(Keyboard.KEY_DOWN))
fontRender.drawStringWithShadow(mobs[i] + count, 90, i * 10 - 30 + offset, 0xFFFFFF);
}
int color = 0xFFFFFF;
if (totalCount > 64)
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;
fontRender.drawStringWithShadow("Total: " + totalCount, 60, offset, color);
}

Expand Down

0 comments on commit c7529a0

Please sign in to comment.