mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 02:37:27 +00:00
Fixed setHunger/Saturation using client-side functions from FoodStats
This commit is contained in:
1 parent
df2e742cbb
commit
769a574210
1 file changed
+10
-2
@@ -74,7 +74,11 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
}
|
||||
|
||||
public void setHunger(int hunger){
|
||||
player.getFoodStats().setFoodLevel(hunger);
|
||||
int prevHunger = this.getHunger();
|
||||
if(hunger < 0)
|
||||
hunger = 0;
|
||||
|
||||
player.getFoodStats().addStats(hunger-prevHunger,0);
|
||||
}
|
||||
|
||||
public float getSaturation(){
|
||||
@@ -82,7 +86,11 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
}
|
||||
|
||||
public void setSaturation(float saturation){
|
||||
player.getFoodStats().setFoodSaturationLevel(saturation);
|
||||
float prevSaturation = this.getHunger();
|
||||
if(saturation < 0)
|
||||
saturation = 0;
|
||||
|
||||
player.getFoodStats().addStats(0,saturation-prevSaturation);
|
||||
}
|
||||
|
||||
public int getDimension(){
|
||||
|
||||
Reference in new issue
Block a user