Push next version of WMD

This commit is contained in:
Zontreck 2022-10-12 23:50:06 -07:00
parent 689485e337
commit b8a065590c
10 changed files with 427 additions and 6 deletions

View file

@ -0,0 +1,36 @@
package dev.zontreck.mcmods;
import net.minecraft.world.entity.player.Player;
public class Health {
public float maximum;
public float current;
public int asPercent()
{
return (int)Math.round(Math.abs((current * 100 / maximum)));
}
public Health lastHealthState;
public static Health of(Player player){
Health obj = new Health();
obj.current = player.getHealth();
obj.maximum = player.getMaxHealth();
return obj;
}
public boolean shouldGiveAlert()
{
if(asPercent()<=50){
return true;
}else return false;
}
public boolean identical(Health other)
{
if(other.current == current && other.maximum == maximum)return true;
else return false;
}
}