From f3c1eb3dc0bf54fa51caff89031c28a1bfa2e306 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Fri, 20 Dec 2024 12:45:19 +0100 Subject: [PATCH] More param name fixes --- .../world/entity/AreaEffectCloud.java.patch | 17 -------- .../minecraft/world/entity/Entity.java.patch | 4 +- .../world/entity/TamableAnimal.java.patch | 2 +- .../world/entity/animal/Animal.java.patch | 16 ++++---- .../world/entity/animal/Bee.java.patch | 22 ++++------ .../world/entity/animal/Fox.java.patch | 2 +- .../entity/animal/MushroomCow.java.patch | 5 +-- .../world/entity/animal/Sheep.java.patch | 4 +- .../world/entity/animal/SnowGolem.java.patch | 4 +- .../world/entity/item/ItemEntity.java.patch | 2 +- .../world/entity/monster/Skeleton.java.patch | 2 +- .../world/entity/monster/Slime.java.patch | 8 ++-- .../world/entity/player/Inventory.java.patch | 41 +++++++++++-------- .../world/entity/player/Player.java.patch | 4 +- .../projectile/ShulkerBullet.java.patch | 4 +- .../entity/vehicle/AbstractBoat.java.patch | 7 ++-- .../vehicle/NewMinecartBehavior.java.patch | 2 +- .../vehicle/OldMinecartBehavior.java.patch | 2 +- .../AbstractContainerMenu.java.patch | 6 +-- 19 files changed, 68 insertions(+), 86 deletions(-) diff --git a/paper-server/patches/sources/net/minecraft/world/entity/AreaEffectCloud.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/AreaEffectCloud.java.patch index adddf98077..ae128ef1a7 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/AreaEffectCloud.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/AreaEffectCloud.java.patch @@ -79,20 +79,3 @@ return; } } -@@ -299,14 +_,14 @@ - this.waitTime = waitTime; - } - -- public void setOwner(@Nullable LivingEntity owner) { -+ public void setOwner(@Nullable net.minecraft.world.entity.LivingEntity owner) { - this.owner = owner; - this.ownerUUID = owner == null ? null : owner.getUUID(); - } - - @Nullable - @Override -- public LivingEntity getOwner() { -+ public net.minecraft.world.entity.LivingEntity getOwner() { - if (this.owner != null && !this.owner.isRemoved()) { - return this.owner; - } else { diff --git a/paper-server/patches/sources/net/minecraft/world/entity/Entity.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/Entity.java.patch index a6132cf6b8..6bd4be5cfe 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/Entity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/Entity.java.patch @@ -300,8 +300,8 @@ + this.setRemoved(reason, null); + } + -+ public void remove(Entity.RemovalReason entity_removalreason, org.bukkit.event.entity.EntityRemoveEvent.Cause cause) { -+ this.setRemoved(entity_removalreason, cause); ++ public void remove(Entity.RemovalReason reason, org.bukkit.event.entity.EntityRemoveEvent.Cause eventCause) { ++ this.setRemoved(reason, eventCause); + // CraftBukkit end } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/TamableAnimal.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/TamableAnimal.java.patch index 878f738ed0..b00c96d54c 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/TamableAnimal.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/TamableAnimal.java.patch @@ -61,7 +61,7 @@ } else { - this.moveTo(x + 0.5, y, z + 0.5, this.getYRot(), this.getXRot()); + // CraftBukkit start -+ org.bukkit.event.entity.EntityTeleportEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTeleportEvent(this, x + 0.5D, y, z + 0.5D); ++ org.bukkit.event.entity.EntityTeleportEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTeleportEvent(this, x + 0.5, y, z + 0.5); + if (event.isCancelled() || event.getTo() == null) { // Paper - prevent NP on null event to location + return false; + } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/Animal.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/Animal.java.patch index 4f63402c67..47de924357 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/animal/Animal.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/Animal.java.patch @@ -85,21 +85,19 @@ public void finalizeSpawnChildFromBreeding(ServerLevel level, Animal animal, @Nullable AgeableMob baby) { - Optional.ofNullable(this.getLoveCause()).or(() -> Optional.ofNullable(animal.getLoveCause())).ifPresent(player -> { -- player.awardStat(Stats.ANIMALS_BRED); -- CriteriaTriggers.BRED_ANIMALS.trigger(player, this, animal, baby); -- }); + // CraftBukkit start + this.finalizeSpawnChildFromBreeding(level, animal, baby, this.getRandom().nextInt(7) + 1); + } + public void finalizeSpawnChildFromBreeding(ServerLevel level, Animal animal, @Nullable AgeableMob baby, int experience) { + // CraftBukkit end + // Paper start -+ ServerPlayer entityplayer = this.getLoveCause(); -+ if (entityplayer == null) entityplayer = animal.getLoveCause(); -+ if (entityplayer != null) { ++ ServerPlayer player = this.getLoveCause(); ++ if (player == null) player = animal.getLoveCause(); ++ if (player != null) { + // Paper end -+ entityplayer.awardStat(Stats.ANIMALS_BRED); -+ CriteriaTriggers.BRED_ANIMALS.trigger(entityplayer, this, animal, baby); + player.awardStat(Stats.ANIMALS_BRED); + CriteriaTriggers.BRED_ANIMALS.trigger(player, this, animal, baby); +- }); + } // Paper this.setAge(6000); animal.setAge(6000); @@ -110,7 +108,7 @@ - level.addFreshEntity(new ExperienceOrb(level, this.getX(), this.getY(), this.getZ(), this.getRandom().nextInt(7) + 1)); + // CraftBukkit start - use event experience + if (experience > 0) { -+ level.addFreshEntity(new ExperienceOrb(level, this.getX(), this.getY(), this.getZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, baby)); // Paper ++ level.addFreshEntity(new ExperienceOrb(level, this.getX(), this.getY(), this.getZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, player, baby)); // Paper + } + // CraftBukkit end } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/Bee.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/Bee.java.patch index 5e9da74414..94a18bec62 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/animal/Bee.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/Bee.java.patch @@ -59,23 +59,19 @@ } } -@@ -489,11 +_,12 @@ - - @Nullable - BeehiveBlockEntity getBeehiveBlockEntity() { -- if (this.hivePos == null) { -- return null; -- } else { +@@ -492,7 +_,11 @@ + if (this.hivePos == null) { + return null; + } else { - return this.isTooFarAway(this.hivePos) ? null : this.level().getBlockEntity(this.hivePos, BlockEntityType.BEEHIVE).orElse(null); -+ // Paper start - move over logic to accommodate isTooFarAway with chunk load check -+ if (this.hivePos != null && !this.isTooFarAway(this.hivePos) && this.level().getChunkIfLoadedImmediately(this.hivePos.getX() >> 4, this.hivePos.getZ() >> 4) != null) { -+ return this.level().getBlockEntity(this.hivePos, BlockEntityType.BEEHIVE).orElse(null); ++ // Paper start - move over logic to accommodate isTooFarAway with chunk load check ++ return this.isTooFarAway(this.hivePos) || this.level().getChunkIfLoadedImmediately(this.hivePos.getX() >> 4, this.hivePos.getZ() >> 4) == null ++ ? null ++ : this.level().getBlockEntity(this.hivePos, BlockEntityType.BEEHIVE).orElse(null); ++ // Paper end } -+ return null; -+ // Paper end } - boolean isHiveValid() { @@ -525,6 +_,7 @@ } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/Fox.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/Fox.java.patch index 2db8810362..aa6fdd9654 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/animal/Fox.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/Fox.java.patch @@ -115,7 +115,7 @@ - fox.setAge(-24000); - fox.moveTo(this.animal.getX(), this.animal.getY(), this.animal.getZ(), 0.0F, 0.0F); - serverLevel.addFreshEntityWithPassengers(fox); -+ level.addFreshEntityWithPassengers(fox, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason ++ serverLevel.addFreshEntityWithPassengers(fox, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason this.level.broadcastEntityEvent(this.animal, (byte)18); if (serverLevel.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { - this.level diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/MushroomCow.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/MushroomCow.java.patch index 3b9b4c2f06..adb68967c7 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/animal/MushroomCow.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/MushroomCow.java.patch @@ -19,7 +19,7 @@ this.gameEvent(GameEvent.SHEAR, player); itemInHand.hurtAndBreak(1, player, getSlotForHand(hand)); } -@@ -163,15 +_,32 @@ +@@ -163,15 +_,31 @@ @Override public void shear(ServerLevel level, SoundSource soundSource, ItemStack shears) { @@ -48,8 +48,7 @@ - } + // Paper start - custom shear drops; moved drop generation to separate method + drops.forEach(drop -> { -+ ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), this.getY(1.0D), this.getZ(), drop); -+ this.spawnAtLocation(level, entityitem); ++ this.spawnAtLocation(level, new ItemEntity(this.level(), this.getX(), this.getY(1.0), this.getZ(), drop)); }); - }); + // Paper end - custom shear drops diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/Sheep.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/Sheep.java.patch index c85c408ef3..2a1505ea58 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/animal/Sheep.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/Sheep.java.patch @@ -49,10 +49,10 @@ - (serverLevel, itemStack) -> { - for (int i = 0; i < itemStack.getCount(); i++) { - ItemEntity itemEntity = this.spawnAtLocation(serverLevel, itemStack.copyWithCount(1), 1.0F); -+ drops.forEach(itemstack1 -> { // Paper - custom drops - loop in generated default drops ++ drops.forEach(itemStack -> { // Paper - custom drops - loop in generated default drops + if (true) { // Paper - custom drops - loop in generated default drops + this.forceDrops = true; // CraftBukkit -+ ItemEntity itemEntity = this.spawnAtLocation(level, itemstack1, 1.0F); // Paper - custom drops - copy already done above ++ ItemEntity itemEntity = this.spawnAtLocation(level, itemStack, 1.0F); // Paper - custom drops - copy already done above + this.forceDrops = false; // CraftBukkit if (itemEntity != null) { itemEntity.setDeltaMovement( diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/SnowGolem.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/SnowGolem.java.patch index c168577210..e647b528c6 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/animal/SnowGolem.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/SnowGolem.java.patch @@ -64,9 +64,9 @@ - this.dropFromShearingLootTable( - level, BuiltInLootTables.SHEAR_SNOW_GOLEM, shears, (serverLevel, itemStack) -> this.spawnAtLocation(serverLevel, itemStack, this.getEyeHeight()) - ); -+ drops.forEach(itemstack1 -> { // Paper - custom shear drops ++ drops.forEach(itemStack -> { // Paper - custom shear drops + this.forceDrops = true; // CraftBukkit -+ this.spawnAtLocation(level, itemstack1, this.getEyeHeight()); ++ this.spawnAtLocation(level, itemStack, this.getEyeHeight()); + this.forceDrops = false; // CraftBukkit + }); } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/item/ItemEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/item/ItemEntity.java.patch index 487f6205a1..22c2ed163b 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/item/ItemEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/item/ItemEntity.java.patch @@ -18,7 +18,7 @@ + // Paper start - Don't use level random in entity constructors (to make them thread-safe) + this(EntityType.ITEM, level); + this.setPos(posX, posY, posZ); -+ this.setDeltaMovement(this.random.nextDouble() * 0.2D - 0.1D, 0.2D, this.random.nextDouble() * 0.2D - 0.1D); ++ this.setDeltaMovement(this.random.nextDouble() * 0.2 - 0.1, 0.2, this.random.nextDouble() * 0.2 - 0.1); + this.setItem(itemStack); + // Paper end - Don't use level random in entity constructors } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/monster/Skeleton.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/monster/Skeleton.java.patch index 0f01620a40..49812bbeee 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/monster/Skeleton.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/monster/Skeleton.java.patch @@ -5,7 +5,7 @@ protected void doFreezeConversion() { - this.convertTo(EntityType.STRAY, ConversionParams.single(this, true, true), mob -> { -+ final Stray stray = this.convertTo(EntityType.STRAY, ConversionParams.single(this, true, true), (entityskeletonstray) -> { // Paper - Fix issues with mob conversion; reset conversion time to prevent event spam ++ final Stray stray = this.convertTo(EntityType.STRAY, ConversionParams.single(this, true, true), mob -> { // Paper - Fix issues with mob conversion; reset conversion time to prevent event spam if (!this.isSilent()) { this.level().levelEvent(null, 1048, this.blockPosition(), 0); } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/monster/Slime.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/monster/Slime.java.patch index 6f42d379d6..07a1abbeea 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/monster/Slime.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/monster/Slime.java.patch @@ -37,7 +37,7 @@ + } + + @Override -+ public void remove(Entity.RemovalReason entity_removalreason, org.bukkit.event.entity.EntityRemoveEvent.Cause cause) { ++ public void remove(Entity.RemovalReason reason, org.bukkit.event.entity.EntityRemoveEvent.Cause eventCause) { + // CraftBukkit end int size = this.getSize(); if (!this.level().isClientSide && size > 1 && this.isDeadOrDying()) { @@ -53,7 +53,7 @@ + if (!event.isCancelled() && event.getCount() > 0) { + i1 = event.getCount(); + } else { -+ super.remove(entity_removalreason, cause); // CraftBukkit - add Bukkit remove cause ++ super.remove(reason, eventCause); // CraftBukkit - add Bukkit remove cause + return; + } + java.util.List slimes = new java.util.ArrayList<>(i1); @@ -78,7 +78,7 @@ + } + // CraftBukkit start + if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTransformEvent(this, slimes, org.bukkit.event.entity.EntityTransformEvent.TransformReason.SPLIT).isCancelled()) { -+ super.remove(entity_removalreason, cause); // CraftBukkit - add Bukkit remove cause ++ super.remove(reason, eventCause); // CraftBukkit - add Bukkit remove cause + return; + } + for (LivingEntity living : slimes) { @@ -88,7 +88,7 @@ } - super.remove(reason); -+ super.remove(entity_removalreason, cause); // CraftBukkit - add Bukkit remove cause ++ super.remove(reason, eventCause); // CraftBukkit - add Bukkit remove cause } @Override diff --git a/paper-server/patches/sources/net/minecraft/world/entity/player/Inventory.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/player/Inventory.java.patch index 5a84bf452f..af826eead1 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/player/Inventory.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/player/Inventory.java.patch @@ -55,7 +55,7 @@ public Inventory(Player player) { this.player = player; } -@@ -50,10 +_,32 @@ +@@ -50,10 +_,39 @@ private boolean hasRemainingSpaceForItem(ItemStack destination, ItemStack origin) { return !destination.isEmpty() @@ -68,24 +68,31 @@ + } + + // CraftBukkit start - Watch method above! :D -+ public int canHold(ItemStack itemstack) { -+ int remains = itemstack.getCount(); -+ for (int i = 0; i < this.items.size(); ++i) { -+ ItemStack itemstack1 = this.getItem(i); -+ if (itemstack1.isEmpty()) return itemstack.getCount(); -+ -+ if (this.hasRemainingSpaceForItem(itemstack1, itemstack)) { -+ remains -= (itemstack1.getMaxStackSize() < this.getMaxStackSize() ? itemstack1.getMaxStackSize() : this.getMaxStackSize()) - itemstack1.getCount(); ++ public int canHold(ItemStack itemStack) { ++ int remains = itemStack.getCount(); ++ for (int slot = 0; slot < this.items.size(); ++slot) { ++ ItemStack itemInSlot = this.getItem(slot); ++ if (itemInSlot.isEmpty()) { ++ return itemStack.getCount(); + } -+ if (remains <= 0) return itemstack.getCount(); -+ } -+ ItemStack offhandItemStack = this.getItem(this.items.size() + this.armor.size()); -+ if (this.hasRemainingSpaceForItem(offhandItemStack, itemstack)) { -+ remains -= (offhandItemStack.getMaxStackSize() < this.getMaxStackSize() ? offhandItemStack.getMaxStackSize() : this.getMaxStackSize()) - offhandItemStack.getCount(); -+ } -+ if (remains <= 0) return itemstack.getCount(); + -+ return itemstack.getCount() - remains; ++ if (this.hasRemainingSpaceForItem(itemInSlot, itemStack)) { ++ remains -= (itemInSlot.getMaxStackSize() < this.getMaxStackSize() ? itemInSlot.getMaxStackSize() : this.getMaxStackSize()) - itemInSlot.getCount(); ++ } ++ if (remains <= 0) { ++ return itemStack.getCount(); ++ } ++ } ++ ++ ItemStack itemInOffhand = this.getItem(this.items.size() + this.armor.size()); ++ if (this.hasRemainingSpaceForItem(itemInOffhand, itemStack)) { ++ remains -= (itemInOffhand.getMaxStackSize() < this.getMaxStackSize() ? itemInOffhand.getMaxStackSize() : this.getMaxStackSize()) - itemInOffhand.getCount(); ++ } ++ if (remains <= 0) { ++ return itemStack.getCount(); ++ } ++ ++ return itemStack.getCount() - remains; + } + // CraftBukkit end diff --git a/paper-server/patches/sources/net/minecraft/world/entity/player/Player.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/player/Player.java.patch index 02d43bc4f7..4d20a5178a 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/player/Player.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/player/Player.java.patch @@ -462,8 +462,8 @@ + } + + @Override -+ public void remove(Entity.RemovalReason entity_removalreason, org.bukkit.event.entity.EntityRemoveEvent.Cause cause) { -+ super.remove(entity_removalreason, cause); ++ public void remove(Entity.RemovalReason reason, org.bukkit.event.entity.EntityRemoveEvent.Cause eventCause) { ++ super.remove(reason, eventCause); + // CraftBukkit end this.inventoryMenu.removed(this); if (this.containerMenu != null && this.hasContainerOpen()) { diff --git a/paper-server/patches/sources/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch index 310b6cb4c4..8f79e335e3 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch @@ -14,8 +14,8 @@ + return this.finalTarget; + } + -+ public void setTarget(Entity e) { -+ this.finalTarget = e; ++ public void setTarget(Entity finalTarget) { ++ this.finalTarget = finalTarget; + this.currentMoveDirection = Direction.UP; + this.selectNextMoveDirection(Direction.Axis.X); + } diff --git a/paper-server/patches/sources/net/minecraft/world/entity/vehicle/AbstractBoat.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/vehicle/AbstractBoat.java.patch index a0e7f6a45f..a5d91baad1 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/vehicle/AbstractBoat.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/vehicle/AbstractBoat.java.patch @@ -79,20 +79,19 @@ @Override public void remove(Entity.RemovalReason reason) { -- if (!this.level().isClientSide && reason.shouldDestroy() && this.isLeashed()) { + // CraftBukkit start - add Bukkit remove cause + this.remove(reason, null); + } + + @Override -+ public void remove(Entity.RemovalReason entity_removalreason, org.bukkit.event.entity.EntityRemoveEvent.Cause cause) { ++ public void remove(Entity.RemovalReason reason, org.bukkit.event.entity.EntityRemoveEvent.Cause eventCause) { + // CraftBukkit end -+ if (!this.level().isClientSide && entity_removalreason.shouldDestroy() && this.isLeashed()) { + if (!this.level().isClientSide && reason.shouldDestroy() && this.isLeashed()) { this.dropLeash(); } - super.remove(reason); -+ super.remove(entity_removalreason, cause); // CraftBukkit - add Bukkit remove cause ++ super.remove(reason, eventCause); // CraftBukkit - add Bukkit remove cause } @Override diff --git a/paper-server/patches/sources/net/minecraft/world/entity/vehicle/NewMinecartBehavior.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/vehicle/NewMinecartBehavior.java.patch index 510d8fd645..31506e8555 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/vehicle/NewMinecartBehavior.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/vehicle/NewMinecartBehavior.java.patch @@ -19,7 +19,7 @@ public double getSlowdownFactor() { - return this.minecart.isVehicle() ? 0.997 : 0.975; + if (this.minecart.frictionState == net.kyori.adventure.util.TriState.FALSE) return 1; // Paper -+ return this.minecart.isVehicle() || !this.minecart.slowWhenEmpty ? 0.997D : 0.975D; // CraftBukkit - add !this.slowWhenEmpty ++ return this.minecart.isVehicle() || !this.minecart.slowWhenEmpty ? 0.997 : 0.975; // CraftBukkit - add !this.slowWhenEmpty } @Override diff --git a/paper-server/patches/sources/net/minecraft/world/entity/vehicle/OldMinecartBehavior.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/vehicle/OldMinecartBehavior.java.patch index 71af93aa6c..cc3a0cf21d 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/vehicle/OldMinecartBehavior.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/vehicle/OldMinecartBehavior.java.patch @@ -53,6 +53,6 @@ public double getSlowdownFactor() { - return this.minecart.isVehicle() ? 0.997 : 0.96; + if (this.minecart.frictionState == net.kyori.adventure.util.TriState.FALSE) return 1; // Paper -+ return this.minecart.isVehicle() || !this.minecart.slowWhenEmpty ? 0.997D : 0.96D; // CraftBukkit - add !this.slowWhenEmpty ++ return this.minecart.isVehicle() || !this.minecart.slowWhenEmpty ? 0.997 : 0.96; // CraftBukkit - add !this.slowWhenEmpty } } diff --git a/paper-server/patches/sources/net/minecraft/world/inventory/AbstractContainerMenu.java.patch b/paper-server/patches/sources/net/minecraft/world/inventory/AbstractContainerMenu.java.patch index f28508dd93..e33c611feb 100644 --- a/paper-server/patches/sources/net/minecraft/world/inventory/AbstractContainerMenu.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/inventory/AbstractContainerMenu.java.patch @@ -160,11 +160,11 @@ slot.setChanged(); + // CraftBukkit start - Make sure the client has the right slot contents -+ if (player instanceof ServerPlayer && slot.getMaxStackSize() != 64) { -+ ((ServerPlayer) player).connection.send(new ClientboundContainerSetSlotPacket(this.containerId, this.incrementStateId(), slot.index, slot.getItem())); ++ if (player instanceof ServerPlayer serverPlayer && slot.getMaxStackSize() != 64) { ++ serverPlayer.connection.send(new ClientboundContainerSetSlotPacket(this.containerId, this.incrementStateId(), slot.index, slot.getItem())); + // Updating a crafting inventory makes the client reset the result slot, have to send it again + if (this.getBukkitView().getType() == org.bukkit.event.inventory.InventoryType.WORKBENCH || this.getBukkitView().getType() == org.bukkit.event.inventory.InventoryType.CRAFTING) { -+ ((ServerPlayer) player).connection.send(new ClientboundContainerSetSlotPacket(this.containerId, this.incrementStateId(), 0, this.getSlot(0).getItem())); ++ serverPlayer.connection.send(new ClientboundContainerSetSlotPacket(this.containerId, this.incrementStateId(), 0, this.getSlot(0).getItem())); + } + } + // CraftBukkit end