Update to Minecraft 1.17

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-06-11 15:00:00 +10:00
parent 75faba7fde
commit b3a8254758
619 changed files with 10708 additions and 8451 deletions

View File

@@ -14,14 +14,14 @@
public int foodLevel = 20;
public float saturationLevel = 5.0F;
public float exhaustionLevel;
private int foodTickTimer;
private int tickTimer;
+ // CraftBukkit start
+ private EntityHuman entityhuman;
+ public int saturatedRegenRate = 10;
+ public int unsaturatedRegenRate = 80;
+ public int starvationRate = 80;
+ // CraftBukkit end
private int e = 20;
private int lastFoodLevel = 20;
- public FoodMetaData() {}
+ public FoodMetaData() { throw new AssertionError("Whoopsie, we missed the bukkit."); } // CraftBukkit start - throw an error
@@ -66,17 +66,17 @@
+ this.foodLevel = event.getFoodLevel();
+ }
+
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), this.foodLevel, this.saturationLevel));
+ ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), this.foodLevel, this.saturationLevel));
+ // CraftBukkit end
}
}
@@ -49,23 +84,25 @@
if (flag && this.saturationLevel > 0.0F && entityhuman.eJ() && this.foodLevel >= 20) {
++this.foodTickTimer;
- if (this.foodTickTimer >= 10) {
+ if (this.foodTickTimer >= this.saturatedRegenRate) { // CraftBukkit
if (flag && this.saturationLevel > 0.0F && entityhuman.ft() && this.foodLevel >= 20) {
++this.tickTimer;
- if (this.tickTimer >= 10) {
+ if (this.tickTimer >= this.saturatedRegenRate) { // CraftBukkit
float f = Math.min(this.saturationLevel, 6.0F);
- entityhuman.heal(f / 6.0F);
@@ -84,23 +84,23 @@
+ entityhuman.heal(f / 6.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED); // CraftBukkit - added RegainReason
+ // this.a(f); CraftBukkit - EntityExhaustionEvent
+ entityhuman.applyExhaustion(f, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.REGEN); // CraftBukkit - EntityExhaustionEvent
this.foodTickTimer = 0;
this.tickTimer = 0;
}
} else if (flag && this.foodLevel >= 18 && entityhuman.eJ()) {
++this.foodTickTimer;
- if (this.foodTickTimer >= 80) {
} else if (flag && this.foodLevel >= 18 && entityhuman.ft()) {
++this.tickTimer;
- if (this.tickTimer >= 80) {
- entityhuman.heal(1.0F);
- this.a(6.0F);
+ if (this.foodTickTimer >= this.unsaturatedRegenRate) { // CraftBukkit - add regen rate manipulation
+ if (this.tickTimer >= this.unsaturatedRegenRate) { // CraftBukkit - add regen rate manipulation
+ entityhuman.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED); // CraftBukkit - added RegainReason
+ // this.a(6.0F); CraftBukkit - EntityExhaustionEvent
+ entityhuman.applyExhaustion(6.0f, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.REGEN); // CraftBukkit - EntityExhaustionEvent
this.foodTickTimer = 0;
this.tickTimer = 0;
}
} else if (this.foodLevel <= 0) {
++this.foodTickTimer;
- if (this.foodTickTimer >= 80) {
+ if (this.foodTickTimer >= this.starvationRate) { // CraftBukkit - add regen rate manipulation
++this.tickTimer;
- if (this.tickTimer >= 80) {
+ if (this.tickTimer >= this.starvationRate) { // CraftBukkit - add regen rate manipulation
if (entityhuman.getHealth() > 10.0F || enumdifficulty == EnumDifficulty.HARD || entityhuman.getHealth() > 1.0F && enumdifficulty == EnumDifficulty.NORMAL) {
entityhuman.damageEntity(DamageSource.STARVE, 1.0F);
}