geforkt von Mirrors/Paper
842e040c19
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 220bc594 #486: Add method to get player's attack cooldown 21853d39 SPIGOT-5681: Increase max plugin channel size 5b972adc Improve build process b55e58d9 Note which custom generator is missing required method CraftBukkit Changes:893ad93b
#650: Add method to get player's attack cooldownef706b06
#655: Added support for the VM tag jansi.passthrough when processing messages sent to a ColouredConsoleSender.e0cfb347
SPIGOT-5689: Fireball.setDirection increases velocity too much94cb030f
SPIGOT-5673: swingHand API does not show to selfb331a055
SPIGOT-5680: isChunkGenerated creates empty region filese1335932
Improve build processa8ec1d60
Add a couple of method null checks to CraftWorldce66f693
Misc checkstyle fixes8bd0e9ab
SPIGOT-5669: Fix Beehive.isSedated Spigot Changes: 2040c4c4 SPIGOT-5677, MC-114796: Fix portals generating outside world border ab8f6b5a Rebuild patches e7dc2f53 Rebuild patches
88 Zeilen
3.7 KiB
Diff
88 Zeilen
3.7 KiB
Diff
From 826d9e18cd1a733abb0f857568be89ab89bda212 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Tue, 14 Jan 2020 15:28:28 -0800
|
|
Subject: [PATCH] Lag compensate eating
|
|
|
|
When the server is lagging, players will wait longer when eating.
|
|
Change to also use a time check instead if it passes.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index aada8d3b08..252b3c5929 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -113,7 +113,7 @@ public abstract class EntityLiving extends Entity {
|
|
private int jumpTicks;
|
|
private float bD;
|
|
public ItemStack activeItem; // Paper - public
|
|
- protected int bl;
|
|
+ protected int bl; protected final int getEatTimeTicks() { return this.bl; } protected final void setEatTimeTicks(int value) { this.bl = value; } // Paper - OBFHELPER
|
|
protected int bm;
|
|
private BlockPosition bE;
|
|
private DamageSource bF;
|
|
@@ -2847,6 +2847,10 @@ public abstract class EntityLiving extends Entity {
|
|
return ((Byte) this.datawatcher.get(EntityLiving.ao) & 2) > 0 ? EnumHand.OFF_HAND : EnumHand.MAIN_HAND;
|
|
}
|
|
|
|
+ // Paper start - lag compensate eating
|
|
+ protected long eatStartTime;
|
|
+ protected int totalEatTimeTicks;
|
|
+ // Paper end
|
|
private void o() {
|
|
if (this.isHandRaised()) {
|
|
if (ItemStack.d(this.b(this.getRaisedHand()), this.activeItem)) {
|
|
@@ -2855,7 +2859,14 @@ public abstract class EntityLiving extends Entity {
|
|
this.b(this.activeItem, 5);
|
|
}
|
|
|
|
- if (--this.bl == 0 && !this.world.isClientSide && !this.activeItem.m()) {
|
|
+
|
|
+ // Paper start - lag compensate eating
|
|
+ // we add 1 to the expected time to avoid lag compensating when we should not
|
|
+ boolean shouldLagCompensate
|
|
+ = this.activeItem.getItem().isFood() && this.eatStartTime != -1 && (System.nanoTime() - this.eatStartTime) > ((1 + this.totalEatTimeTicks) * 50 * (1000 * 1000));
|
|
+ if ((--this.bl == 0 || shouldLagCompensate) && !this.world.isClientSide && !this.activeItem.m()) {
|
|
+ this.setEatTimeTicks(0);
|
|
+ // Paper end
|
|
this.q();
|
|
}
|
|
} else {
|
|
@@ -2905,7 +2916,10 @@ public abstract class EntityLiving extends Entity {
|
|
|
|
if (!itemstack.isEmpty() && !this.isHandRaised() || forceUpdate) { // Paper use override flag
|
|
this.activeItem = itemstack;
|
|
- this.bl = itemstack.k();
|
|
+ // Paper start - lag compensate eating
|
|
+ this.bl = this.totalEatTimeTicks = itemstack.k();
|
|
+ this.eatStartTime = System.nanoTime();
|
|
+ // Paper end
|
|
if (!this.world.isClientSide) {
|
|
this.c(1, true);
|
|
this.c(2, enumhand == EnumHand.OFF_HAND);
|
|
@@ -2929,7 +2943,10 @@ public abstract class EntityLiving extends Entity {
|
|
}
|
|
} else if (!this.isHandRaised() && !this.activeItem.isEmpty()) {
|
|
this.activeItem = ItemStack.a;
|
|
- this.bl = 0;
|
|
+ // Paper start - lag compensate eating
|
|
+ this.bl = this.totalEatTimeTicks = 0;
|
|
+ this.eatStartTime = -1L;
|
|
+ // Paper end
|
|
}
|
|
}
|
|
|
|
@@ -3051,7 +3068,10 @@ public abstract class EntityLiving extends Entity {
|
|
}
|
|
|
|
this.activeItem = ItemStack.a;
|
|
- this.bl = 0;
|
|
+ // Paper start - lag compensate eating
|
|
+ this.bl = this.totalEatTimeTicks = 0;
|
|
+ this.eatStartTime = -1L;
|
|
+ // Paper end
|
|
}
|
|
|
|
public boolean isBlocking() {
|
|
--
|
|
2.26.2
|
|
|