diff --git a/.gitignore b/.gitignore index ab1c723..85e5992 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,5 @@ Temporary Items *.class *.class *.class -bin/com/kyzeragon/mobcountmod/LiteModMobCounter.class \ No newline at end of file +bin/com/kyzeragon/mobcountmod/LiteModMobCounter.class +*.class \ No newline at end of file diff --git a/ant/build_examplemod.xml b/ant/build_examplemod.xml index 3cc0f33..8c1db5b 100644 --- a/ant/build_examplemod.xml +++ b/ant/build_examplemod.xml @@ -17,7 +17,7 @@ - + diff --git a/ant/buildnumber.txt b/ant/buildnumber.txt index 8674508..5012ed2 100644 --- a/ant/buildnumber.txt +++ b/ant/buildnumber.txt @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Sun Jul 05 17:59:19 PDT 2015 -build.number=44 +#Wed Sep 02 23:48:54 PDT 2015 +build.number=46 diff --git a/bin/com/kyzeragon/mobcountmod/LiteModMobCounter.class b/bin/com/kyzeragon/mobcountmod/LiteModMobCounter.class index 47fed2a..1d17d79 100644 Binary files a/bin/com/kyzeragon/mobcountmod/LiteModMobCounter.class and b/bin/com/kyzeragon/mobcountmod/LiteModMobCounter.class differ diff --git a/bin/com/kyzeragon/mobcountmod/MobCounter.class b/bin/com/kyzeragon/mobcountmod/MobCounter.class index bc95ae0..672a714 100644 Binary files a/bin/com/kyzeragon/mobcountmod/MobCounter.class and b/bin/com/kyzeragon/mobcountmod/MobCounter.class differ diff --git a/java/com/kyzeragon/mobcountmod/LiteModMobCounter.java b/java/com/kyzeragon/mobcountmod/LiteModMobCounter.java index be579e9..5da099c 100644 --- a/java/com/kyzeragon/mobcountmod/LiteModMobCounter.java +++ b/java/com/kyzeragon/mobcountmod/LiteModMobCounter.java @@ -38,7 +38,6 @@ public class LiteModMobCounter implements Tickable, ChatFilter, OutboundChatList private static KeyBinding hostileKeyBinding; private static KeyBinding optionsKeyBinding; - private boolean showChildCounts; private boolean sentCmd; private MobCounterConfigScreen configScreen = new MobCounterConfigScreen(); private MobCounter counter = new MobCounter(staff); @@ -70,13 +69,12 @@ else if (this.staff) } @Override - public String getVersion() { return "1.1.3"; } + public String getVersion() { return "1.1.4"; } @Override public void init(File configPath) { this.sentCmd = false; - this.showChildCounts = false; this.notifyFac = false; this.sound = "note.bass"; @@ -278,10 +276,9 @@ public boolean onChat(S02PacketChat chatPacket, IChatComponent chat, */ private void hostileLimit() { - // System.out.println("playSoundCount: " + this.playSoundCount + " sendMsgCount: " + this.sendMsgCount); int totalCount = 0; for (int i = 0; i < 8; i++) - totalCount += this.counter.countEntity(i + 8, true); + totalCount += this.counter.countEntity(i + 8); if (this.playSoundCount != 0) this.playSoundCount++; if (this.sendMsgCount != 0) @@ -363,17 +360,21 @@ private void displayPassiveCompact() FontRenderer fontRender = Minecraft.getMinecraft().fontRenderer; this.counter.updateBB(); fontRender.drawStringWithShadow("Radius: " + this.counter.getRadius(), 0, 0, 0xFFAA00); - if (staff) - fontRender.drawStringWithShadow("Players: " + this.counter.countEntity(16, true), 60, 0, 0xFFFFFF); + if (staff) + { + fontRender.drawStringWithShadow("Players: " + this.counter.countEntity(16), 60, 0, 0xFFFFFF); + int color = 0xFFFFFF; + int count = this.counter.countEntity(18); + if (count > 16) color = 0xAA0000; + fontRender.drawStringWithShadow("Snowmen: " + count, 0, 50, color); + } String toDisplay; int color = 0xFFFFFF; for (int i = 0; i < 4; i++) { - int count = this.counter.countEntity(i, true) + this.counter.countEntity(i, false); + int count = this.counter.countEntity(i); toDisplay = "" + count; - if (this.showChildCounts) - toDisplay = this.counter.countEntity(i, false) + "/" + this.counter.countEntity(i, true); if (count > 16) color = 0xAA0000; fontRender.drawStringWithShadow(this.passives[i] + toDisplay, 0, i * 10 + 10, color); color = 0xFFFFFF; @@ -385,22 +386,26 @@ private void displayPassiveCompact() */ private void displayPassiveExpanded() { + FontRenderer fontRender = Minecraft.getMinecraft().fontRenderer; for (int i = 4; i < 8; i++) { - FontRenderer fontRender = Minecraft.getMinecraft().fontRenderer; int color = 0xFFFFFF; - int count = this.counter.countEntity(i, true) + this.counter.countEntity(i, false); + int count = this.counter.countEntity(i); String toDisplay = "" + count; int x = 70; - if (this.showChildCounts) - { - toDisplay = this.counter.countEntity(i, false) + "/" + this.counter.countEntity(i, true); - x = 80; - } + if (count > 16) color = 0xAA0000; fontRender.drawStringWithShadow(this.passives[i] + toDisplay, x, i * 10 - 30, color); color = 0xFFFFFF; } + + if (this.staff) + { + int color = 0xFFFFFF; + int count = this.counter.countEntity(17); + if (count > 16) color = 0xAA0000; + fontRender.drawStringWithShadow("Golems: " + count, 70, 50, color); + } } /** @@ -412,6 +417,8 @@ private void displayHostile() int offset = 0; if (this.counterVisible > 0) offset = 50; + if (this.staff) + offset += 10; if (this.counter.getXP5()) { @@ -426,24 +433,23 @@ private void displayHostile() int totalCount = 0; for (int i = 0; i < 4; i++) { - int count = this.counter.countEntity(i + 8, true); + int count = this.counter.countEntity(i + 8); totalCount += count; fontRender.drawStringWithShadow(this.hostiles[i] + count, 0, i * 10 + 10 + offset, 0xFFFFFF); } for (int i = 4; i < 8; i++) { - int count = this.counter.countEntity(i + 8, true); + int count = this.counter.countEntity(i + 8); totalCount += count; if (this.hostileVisible > 1) fontRender.drawStringWithShadow(this.hostiles[i] + count, 90, i * 10 - 30 + offset, 0xFFFFFF); } int color = 0xFFFFFF; if (totalCount > 149) // if 150+ mobs, display in red. - { color = 0xAA0000; - } else this.playSoundCount = 100; + if (this.counter.getXP5()) fontRender.drawStringWithShadow("Total: " + totalCount, 70, offset, color); else diff --git a/java/com/kyzeragon/mobcountmod/MobCounter.java b/java/com/kyzeragon/mobcountmod/MobCounter.java index ec7dd52..1b84dd8 100644 --- a/java/com/kyzeragon/mobcountmod/MobCounter.java +++ b/java/com/kyzeragon/mobcountmod/MobCounter.java @@ -34,44 +34,34 @@ public MobCounter(boolean isStaff) this.hostileBB = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0); } - public int countEntity(int num, boolean adult) + public int countEntity(int num) { Minecraft minecraft = Minecraft.getMinecraft(); - List result = new ArrayList(); switch (num) { - case 0: result = minecraft.theWorld.getEntitiesWithinAABB(EntityChicken.class, boundingBox); break; - case 1: result = minecraft.theWorld.getEntitiesWithinAABB(EntityPig.class, boundingBox); break; - case 2: result = minecraft.theWorld.getEntitiesWithinAABB(EntitySheep.class, boundingBox); break; - case 3: result = minecraft.theWorld.getEntitiesWithinAABB(EntityCow.class, boundingBox); break; - case 4: result = minecraft.theWorld.getEntitiesWithinAABB(EntityHorse.class, boundingBox); break; - case 5: result = minecraft.theWorld.getEntitiesWithinAABB(EntityMooshroom.class, boundingBox); break; - case 6: result = minecraft.theWorld.getEntitiesWithinAABB(EntityOcelot.class, boundingBox); break; - case 7: result = minecraft.theWorld.getEntitiesWithinAABB(EntityWolf.class, boundingBox); break; - - case 8: return (minecraft.theWorld.getEntitiesWithinAABB(EntityZombie.class, hostileBB).size() - this.countEntity(14, true)); + case 0: return minecraft.theWorld.getEntitiesWithinAABB(EntityChicken.class, boundingBox).size(); + case 1: return minecraft.theWorld.getEntitiesWithinAABB(EntityPig.class, boundingBox).size(); + case 2: return minecraft.theWorld.getEntitiesWithinAABB(EntitySheep.class, boundingBox).size(); + case 3: return minecraft.theWorld.getEntitiesWithinAABB(EntityCow.class, boundingBox).size() - this.countEntity(5); + case 4: return minecraft.theWorld.getEntitiesWithinAABB(EntityHorse.class, boundingBox).size(); + case 5: return minecraft.theWorld.getEntitiesWithinAABB(EntityMooshroom.class, boundingBox).size(); + case 6: return minecraft.theWorld.getEntitiesWithinAABB(EntityOcelot.class, boundingBox).size(); + case 7: return minecraft.theWorld.getEntitiesWithinAABB(EntityWolf.class, boundingBox).size(); + + case 8: return (minecraft.theWorld.getEntitiesWithinAABB(EntityZombie.class, hostileBB).size() - this.countEntity(14)); case 9: return minecraft.theWorld.getEntitiesWithinAABB(EntityCaveSpider.class, hostileBB).size(); case 10: return minecraft.theWorld.getEntitiesWithinAABB(EntitySkeleton.class, hostileBB).size(); - case 11: return (minecraft.theWorld.getEntitiesWithinAABB(EntitySpider.class, hostileBB).size() - this.countEntity(9, true)); + case 11: return (minecraft.theWorld.getEntitiesWithinAABB(EntitySpider.class, hostileBB).size() - this.countEntity(9)); case 12: return minecraft.theWorld.getEntitiesWithinAABB(EntityCreeper.class, hostileBB).size(); case 13: return minecraft.theWorld.getEntitiesWithinAABB(EntityWitch.class, hostileBB).size(); case 14: return minecraft.theWorld.getEntitiesWithinAABB(EntityPigZombie.class, hostileBB).size(); case 15: return minecraft.theWorld.getEntitiesWithinAABB(EntitySlime.class, hostileBB).size(); case 16: return minecraft.theWorld.getEntitiesWithinAABB(EntityPlayer.class, boundingBox).size() - 1; + case 17: return minecraft.theWorld.getEntitiesWithinAABB(EntityIronGolem.class, boundingBox).size(); + case 18: return minecraft.theWorld.getEntitiesWithinAABB(EntitySnowman.class, boundingBox).size(); } - if (adult) - { - return result.size() - this.countEntity(num, false); - } else { - int count = 0; - for (Object mob: result) - { - if (((EntityAgeable)mob).isChild()) - count++; - } - return count; - } + return 0; } public void updateBB()