Fix slot desync
General patch fixing slot desyncs between the server and client that result from cancelled events/paper introduced logic. Co-authored-by: Minecrell <minecrell@minecrell.net> Co-authored-by: Newwind <support@newwindserver.com>
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
|
||||
public class Cow extends Animal {
|
||||
|
||||
@@ -92,8 +97,16 @@
|
||||
@@ -92,8 +97,17 @@
|
||||
ItemStack itemstack = player.getItemInHand(hand);
|
||||
|
||||
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {
|
||||
@@ -20,6 +20,7 @@
|
||||
+ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) player.level(), player, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET, hand);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ player.containerMenu.sendAllDataToRemote(); // Paper - Fix inventory desync
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -229,15 +234,23 @@
|
||||
@@ -229,15 +234,24 @@
|
||||
ItemStack itemstack = player.getItemInHand(hand);
|
||||
|
||||
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {
|
||||
@@ -29,6 +29,7 @@
|
||||
+ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) player.level(), player, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET, hand);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ player.containerMenu.sendAllDataToRemote(); // Paper - Fix inventory desync
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
@@ -47,7 +48,7 @@
|
||||
this.playEatingSound();
|
||||
}
|
||||
|
||||
@@ -353,8 +366,7 @@
|
||||
@@ -353,8 +367,7 @@
|
||||
double d2 = (double) Mth.randomBetween(this.random, -0.2F, 0.2F);
|
||||
ItemEntity entityitem = new ItemEntity(this.level(), vec3d.x(), vec3d.y(), vec3d.z(), itemstack, d0, d1, d2);
|
||||
|
||||
@@ -57,7 +58,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,4 +395,15 @@
|
||||
@@ -383,4 +396,15 @@
|
||||
public static boolean checkGoatSpawnRules(EntityType<? extends Animal> entityType, LevelAccessor world, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random) {
|
||||
return world.getBlockState(pos.below()).is(BlockTags.GOATS_SPAWNABLE_ON) && isBrightEnoughToSpawn(world, pos);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user