Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
Add in some patches
Dieser Commit ist enthalten in:
Ursprung
cc491a396e
Commit
619d7c93d8
@ -6,7 +6,7 @@ Subject: [PATCH] Guard against serializing mismatching chunk coordinate
|
||||
Should help if something dumb happens
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||
index f9dd2d9312297a727344d43150c5cab74128cbca..b1c5e5ecf2488d1a6f0a5261d4ba8958de9659ae 100644
|
||||
index a7ee469bb2880a78540b79ae691ea449dfe22ce4..0d8cfc0808a8f204d57cec40929b489099eca815 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||
@@ -94,6 +94,18 @@ public class ChunkSerializer {
|
||||
@ -28,9 +28,9 @@ index f9dd2d9312297a727344d43150c5cab74128cbca..b1c5e5ecf2488d1a6f0a5261d4ba8958
|
||||
// Paper start
|
||||
public static final class InProgressChunkHolder {
|
||||
|
||||
@@ -119,7 +131,7 @@ public class ChunkSerializer {
|
||||
@@ -115,7 +127,7 @@ public class ChunkSerializer {
|
||||
|
||||
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
|
||||
- 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
|
||||
@ -38,7 +38,7 @@ index f9dd2d9312297a727344d43150c5cab74128cbca..b1c5e5ecf2488d1a6f0a5261d4ba8958
|
||||
if (!Objects.equals(chunkPos, chunkcoordintpair1)) {
|
||||
ChunkSerializer.LOGGER.error("Chunk file at {} is in the wrong location; relocating. (Expected {}, got {})", new Object[]{chunkPos, chunkPos, chunkcoordintpair1});
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
||||
index 35115f79825035ff28bdffa26ad4127fec8d05c1..10603eebf36caca7870e9cf087e99d529550ad3e 100644
|
||||
index b4e7c9b317d532d4915932f8f79dfebf2b63ff16..e4b3a70ff9f906a10f2ba3c07642193ca3269db7 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
||||
@@ -178,6 +178,13 @@ public class ChunkStorage implements AutoCloseable {
|
||||
@ -46,7 +46,7 @@ index 35115f79825035ff28bdffa26ad4127fec8d05c1..10603eebf36caca7870e9cf087e99d52
|
||||
// Paper start - async chunk io
|
||||
public void write(ChunkPos chunkPos, CompoundTag nbt) throws IOException {
|
||||
+ // 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;
|
||||
+ 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)));
|
@ -7,10 +7,10 @@ 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/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 5eaedecd2e53bcdc30defbf56d6a70a0c49f03ec..38a5d219713f7d3bb3d5ea73e4e6756a03128d01 100644
|
||||
index a897ed99e7a643244fbe6f0ba1afc1bc15bb8d8d..a1c8558db314ea34ad483f7f6f70c1833b57b669 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3552,6 +3552,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3601,6 +3601,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
return ((Byte) this.entityData.get(LivingEntity.DATA_LIVING_ENTITY_FLAGS) & 2) > 0 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;
|
||||
}
|
||||
|
||||
@ -21,23 +21,22 @@ index 5eaedecd2e53bcdc30defbf56d6a70a0c49f03ec..38a5d219713f7d3bb3d5ea73e4e6756a
|
||||
+
|
||||
private void updatingUsingItem() {
|
||||
if (this.isUsingItem()) {
|
||||
if (ItemStack.isSame(this.getItemInHand(this.getUsedItemHand()), this.useItem)) {
|
||||
@@ -3569,8 +3574,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
if (this.shouldTriggerItemUseEffects()) {
|
||||
if (ItemStack.isSameItem(this.getItemInHand(this.getUsedItemHand()), this.useItem)) {
|
||||
@@ -3619,7 +3624,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
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
|
||||
+ // 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));
|
||||
+ if ((--this.useItemRemaining == 0 || shouldLagCompensate) && !this.level.isClientSide && !this.useItem.useOnRelease()) {
|
||||
+ if ((--this.useItemRemaining == 0 || shouldLagCompensate) && !this.level().isClientSide && !stack.useOnRelease()) {
|
||||
+ this.useItemRemaining = 0;
|
||||
+ // Paper end
|
||||
this.completeUsingItem();
|
||||
}
|
||||
|
||||
@@ -3618,7 +3627,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3667,7 +3677,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper use override flag
|
||||
this.useItem = itemstack;
|
||||
@ -46,10 +45,10 @@ index 5eaedecd2e53bcdc30defbf56d6a70a0c49f03ec..38a5d219713f7d3bb3d5ea73e4e6756a
|
||||
+ this.useItemRemaining = this.totalEatTimeTicks = itemstack.getUseDuration();
|
||||
+ this.eatStartTime = System.nanoTime();
|
||||
+ // Paper end
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
this.setLivingEntityFlag(1, true);
|
||||
this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND);
|
||||
@@ -3643,7 +3655,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3692,7 +3705,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
} else if (!this.isUsingItem() && !this.useItem.isEmpty()) {
|
||||
this.useItem = ItemStack.EMPTY;
|
||||
@ -61,7 +60,7 @@ index 5eaedecd2e53bcdc30defbf56d6a70a0c49f03ec..38a5d219713f7d3bb3d5ea73e4e6756a
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3777,7 +3792,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3825,7 +3841,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
this.useItem = ItemStack.EMPTY;
|
@ -5,7 +5,7 @@ Subject: [PATCH] Entity Jump API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index a897ed99e7a643244fbe6f0ba1afc1bc15bb8d8d..574f8db51202c6686e7703f3193d63a1a4fefb65 100644
|
||||
index a1c8558db314ea34ad483f7f6f70c1833b57b669..55d8856e5fdeee4d38e49f5d4a252cf61212e5cb 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3262,8 +3262,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@ -12,7 +12,7 @@ The entity's current team collision rule causes them to NEVER collide.
|
||||
Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 574f8db51202c6686e7703f3193d63a1a4fefb65..6fbd1209edf59dab9cc8b0f568f2d31846264457 100644
|
||||
index 55d8856e5fdeee4d38e49f5d4a252cf61212e5cb..6bd0dcba534926716e26da6c171737ff1bc91ea7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3377,10 +3377,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 6fbd1209edf59dab9cc8b0f568f2d31846264457..934c5246f43566a7277b77d0e74b38fc94c6836f 100644
|
||||
index 6bd0dcba534926716e26da6c171737ff1bc91ea7..909ff425123228437cf3ab39c6733cd0a6dd2ef1 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2169,7 +2169,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@ -80,7 +80,7 @@ index 997f73e86d62b546e363382a3126bc43b4b17b7f..909d0c96840724033bd907560db46d4c
|
||||
|
||||
public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 934c5246f43566a7277b77d0e74b38fc94c6836f..d9ee22bbd654a2f39c443262b4a11f997ed1559e 100644
|
||||
index 909ff425123228437cf3ab39c6733cd0a6dd2ef1..258d055a368629154ab149813881e130fc51f698 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1688,9 +1688,9 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren