mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-01 20:52:12 -07:00
Add in some patches
This commit is contained in:
@@ -31,5 +31,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
// Paper end
|
// Paper end
|
||||||
ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos"));
|
ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); // Paper - diff on change, see ChunkSerializer#getChunkCoordinate
|
||||||
|
|
||||||
|
@@ -29,8 +29,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
public static final class InProgressChunkHolder {
|
public static final class InProgressChunkHolder {
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class ChunkSerializer {
|
@@ -0,0 +0,0 @@ public class ChunkSerializer {
|
||||||
|
|
||||||
public static InProgressChunkHolder loadChunk(ServerLevel world, PoiManager poiStorage, ChunkPos chunkPos, CompoundTag nbt, boolean distinguish) {
|
public static InProgressChunkHolder loadChunk(ServerLevel world, PoiManager poiStorage, ChunkPos chunkPos, CompoundTag nbt, boolean distinguish) {
|
||||||
java.util.ArrayDeque<Runnable> tasksToExecuteOnMain = new java.util.ArrayDeque<>();
|
|
||||||
// Paper end
|
// Paper end
|
||||||
- ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos"));
|
- ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos"));
|
||||||
+ ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); // Paper - diff on change, see ChunkSerializer#getChunkCoordinate
|
+ ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); // Paper - diff on change, see ChunkSerializer#getChunkCoordinate
|
||||||
@@ -46,7 +46,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
// Paper start - async chunk io
|
// Paper start - async chunk io
|
||||||
public void write(ChunkPos chunkPos, CompoundTag nbt) throws IOException {
|
public void write(ChunkPos chunkPos, CompoundTag nbt) throws IOException {
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ if (!chunkPos.equals(ChunkSerializer.getChunkCoordinate(nbt))) {
|
+ if (nbt != null && !chunkPos.equals(ChunkSerializer.getChunkCoordinate(nbt))) {
|
||||||
+ String world = (this instanceof net.minecraft.server.level.ChunkMap) ? ((net.minecraft.server.level.ChunkMap)this).level.getWorld().getName() : null;
|
+ String world = (this instanceof net.minecraft.server.level.ChunkMap) ? ((net.minecraft.server.level.ChunkMap)this).level.getWorld().getName() : null;
|
||||||
+ throw new IllegalArgumentException("Chunk coordinate and serialized data do not have matching coordinates, trying to serialize coordinate " + chunkPos.toString()
|
+ throw new IllegalArgumentException("Chunk coordinate and serialized data do not have matching coordinates, trying to serialize coordinate " + chunkPos.toString()
|
||||||
+ + " but compound says coordinate is " + ChunkSerializer.getChunkCoordinate(nbt).toString() + (world == null ? " for an unknown world" : (" for world: " + world)));
|
+ + " but compound says coordinate is " + ChunkSerializer.getChunkCoordinate(nbt).toString() + (world == null ? " for an unknown world" : (" for world: " + world)));
|
@@ -21,17 +21,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
private void updatingUsingItem() {
|
private void updatingUsingItem() {
|
||||||
if (this.isUsingItem()) {
|
if (this.isUsingItem()) {
|
||||||
if (ItemStack.isSame(this.getItemInHand(this.getUsedItemHand()), this.useItem)) {
|
if (ItemStack.isSameItem(this.getItemInHand(this.getUsedItemHand()), this.useItem)) {
|
||||||
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
if (this.shouldTriggerItemUseEffects()) {
|
|
||||||
this.triggerItemUseEffects(stack, 5);
|
this.triggerItemUseEffects(stack, 5);
|
||||||
}
|
}
|
||||||
-
|
|
||||||
- if (--this.useItemRemaining == 0 && !this.level.isClientSide && !stack.useOnRelease()) {
|
- if (--this.useItemRemaining == 0 && !this.level().isClientSide && !stack.useOnRelease()) {
|
||||||
+ // Paper start - lag compensate eating
|
+ // Paper start - lag compensate eating
|
||||||
+ // we add 1 to the expected time to avoid lag compensating when we should not
|
+ // we add 1 to the expected time to avoid lag compensating when we should not
|
||||||
+ boolean shouldLagCompensate = this.useItem.getItem().isEdible() && this.eatStartTime != -1 && (System.nanoTime() - this.eatStartTime) > ((1 + this.totalEatTimeTicks) * 50 * (1000 * 1000));
|
+ boolean shouldLagCompensate = this.useItem.getItem().isEdible() && this.eatStartTime != -1 && (System.nanoTime() - this.eatStartTime) > ((1 + this.totalEatTimeTicks) * 50 * (1000 * 1000));
|
||||||
+ if ((--this.useItemRemaining == 0 || shouldLagCompensate) && !this.level.isClientSide && !this.useItem.useOnRelease()) {
|
+ if ((--this.useItemRemaining == 0 || shouldLagCompensate) && !this.level().isClientSide && !stack.useOnRelease()) {
|
||||||
+ this.useItemRemaining = 0;
|
+ this.useItemRemaining = 0;
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
this.completeUsingItem();
|
this.completeUsingItem();
|
||||||
@@ -46,7 +45,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ this.useItemRemaining = this.totalEatTimeTicks = itemstack.getUseDuration();
|
+ this.useItemRemaining = this.totalEatTimeTicks = itemstack.getUseDuration();
|
||||||
+ this.eatStartTime = System.nanoTime();
|
+ this.eatStartTime = System.nanoTime();
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
if (!this.level.isClientSide) {
|
if (!this.level().isClientSide) {
|
||||||
this.setLivingEntityFlag(1, true);
|
this.setLivingEntityFlag(1, true);
|
||||||
this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND);
|
this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND);
|
||||||
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
Reference in New Issue
Block a user