Skip to content

Commit

Permalink
Fixed #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Wurmatron committed Nov 10, 2017
1 parent ad72dfc commit 08fa752
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void onEntitySpawn (EntityJoinWorldEvent e) {
if (!(e.getEntity () instanceof EntityPlayer) && e.getEntity () instanceof EntityLivingBase) {
EntityLivingBase entity = (EntityLivingBase) e.getEntity ();
IViral status = entity.getCapability (ViralProvider.VIRAL,null);
if (getChancePercentage () >= 1)
if (getChancePercentage () >= 100)
status.set (1);
else if (rand.nextInt (getChancePercentage ()) == 0)
status.set (1);
Expand Down Expand Up @@ -77,7 +77,7 @@ private void spreadViral (EntityLivingBase entity) {
if (e instanceof IAnimals && !Settings.infectPassive)
return;
EntityLivingBase ent = (EntityLivingBase) e;
if (!ent.world.isRemote && rand.nextInt (getChancePercentage ()) == 0) {
if (!ent.world.isRemote && rand.nextInt (getChancePercentage () - 1) == 0) {
IViral status = ent.getCapability (ViralProvider.VIRAL,null);
if (status.status () == 0) {
status.set (1);
Expand All @@ -90,11 +90,6 @@ private void spreadViral (EntityLivingBase entity) {
}

private int getChancePercentage () {
if (Settings.chance < 1)
if (Settings.chance >= 0.1)
return 100 - (int) (Settings.chance * 100);
else if (Settings.chance >= 0.01)
return 1000 - (int) (Settings.chance * 1000);
return 1;
return (int) (Settings.chance * 100);
}
}

0 comments on commit 08fa752

Please sign in to comment.