Optimised wither collapse calc
This commit is contained in:
parent
a12936a827
commit
b86e581fc5
|
|
@ -39,12 +39,10 @@ public abstract class WitherSkeletonRework extends AbstractSkeleton {
|
|||
}
|
||||
} else { // If on hoe, collapse wither effect
|
||||
int duration = effectsMap.get(MobEffects.WITHER).getDuration();
|
||||
int dmgCount = 0;
|
||||
int dmgCount;
|
||||
int durationToDmg = 40 >> amp;
|
||||
while(duration>0){ // There is definitely a better way to do this, I'll come back to it later
|
||||
if(durationToDmg == 0 || duration % durationToDmg == 0) {dmgCount++;}
|
||||
duration--;
|
||||
}
|
||||
if (durationToDmg==0){dmgCount=duration;}
|
||||
else{dmgCount = duration / durationToDmg;}
|
||||
instance.removeEffect(MobEffects.WITHER);
|
||||
instance.hurt(instance.damageSources().wither(), dmgCount);
|
||||
this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(Items.STONE_SWORD));
|
||||
|
|
|
|||
Loading…
Reference in a new issue