Skip to content

Commit

Permalink
not gonna do adult/child separation, added stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyzderp committed Sep 3, 2015
1 parent 7379f43 commit fc4dd3a
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 50 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ Temporary Items
*.class
*.class
*.class
bin/com/kyzeragon/mobcountmod/LiteModMobCounter.class
bin/com/kyzeragon/mobcountmod/LiteModMobCounter.class
*.class
Expand Down
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.1.3" />
<property name="version" value="1.1.4" />

<!-- 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 Jul 05 17:59:19 PDT 2015
build.number=44
#Wed Sep 02 23:48:54 PDT 2015
build.number=46
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.
48 changes: 27 additions & 21 deletions java/com/kyzeragon/mobcountmod/LiteModMobCounter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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";

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
}

/**
Expand All @@ -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())
{
Expand All @@ -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
Expand Down
40 changes: 15 additions & 25 deletions java/com/kyzeragon/mobcountmod/MobCounter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit fc4dd3a

Please sign in to comment.