mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 04:02:50 +01:00
c0936a71bd
Upstream has released updates that appear 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: 01aa02eb PR-858: Add LivingEntity#playHurtAnimation() 9421320f PR-884: Refinements to new ban API for improved compatibility and correctness 37a60b45 SPIGOT-6455, SPIGOT-7030, PR-750: Improve ban API 4eeb174b All smithing inventories are now the new smithing inventory f2bb168e PR-880: Add methods to get/set FallingBlock CancelDrop e7a807fa PR-879: Add Player#sendHealthUpdate() 692b8e96 SPIGOT-7370: Remove float value conversion in plugin.yml 2d033390 SPIGOT-7403: Add direct API for waxed signs 16a08373 PR-876: Add missing Raider API and 'no action ticks' CraftBukkit Changes: b60a95c8c PR-1189: Add LivingEntity#playHurtAnimation() 95c335c63 PR-1226: Fix VehicleEnterEvent not being called for certain entities 0a0fc3bee PR-1227: Refinements to new ban API for improved compatibility and correctness 0d0b1e5dc Revert bad change to PathfinderGoalSit causing all cats to sit 648196070 SPIGOT-6455, SPIGOT-7030, PR-1054: Improve ban API 31fe848d6 All smithing inventories are now the new smithing inventory 9a919a143 SPIGOT-7416: SmithItemEvent not firing in Smithing Table 9f64f0d22 PR-1221: Add methods to get/set FallingBlock CancelDrop 3be9ac171 PR-1220: Add Player#sendHealthUpdate() c1279f775 PR-1209: Clean up various patches c432e4397 Fix Raider#setCelebrating() implementation 504d96665 SPIGOT-7403: Add direct API for waxed signs c68c1f1b3 PR-1216: Add missing Raider API and 'no action ticks' 85b89c3dd Increase outdated build delay Spigot Changes: 9ebce8af Rebuild patches 64b565e6 Rebuild patches
275 lines
16 KiB
Diff
275 lines
16 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Mon, 11 Jul 2022 11:56:41 -0700
|
|
Subject: [PATCH] Fix a bunch of vanilla bugs
|
|
|
|
https://bugs.mojang.com/browse/MC-253884
|
|
show raid entity event to all tracking players
|
|
|
|
https://bugs.mojang.com/browse/MC-253721
|
|
wrong msg for opping multiple players
|
|
|
|
https://bugs.mojang.com/browse/MC-248588
|
|
respect mob griefing gamerule for draining water cauldrons
|
|
|
|
https://bugs.mojang.com/browse/MC-244739
|
|
play goat eating sound for last item in stack
|
|
|
|
https://bugs.mojang.com/browse/MC-243057
|
|
ignore furnace fuel slot in recipe book click
|
|
|
|
https://bugs.mojang.com/browse/MC-147659
|
|
Some witch huts spawn the incorrect cat
|
|
Note: Marked as Won't Fix, makes 0 sense
|
|
|
|
https://bugs.mojang.com/browse/MC-179072
|
|
Creepers do not defuse when switching from Survival to Creative/Spectator
|
|
|
|
https://bugs.mojang.com/browse/MC-191591
|
|
Fix items equipped on AbstractHorse losing NBT
|
|
|
|
https://bugs.mojang.com/browse/MC-259571
|
|
Fix changeGameModeForPlayer to use gameModeForPlayer
|
|
|
|
https://bugs.mojang.com/browse/MC-262422
|
|
Fix lightning being able to hit spectators
|
|
|
|
https://bugs.mojang.com/browse/MC-224454
|
|
Fix mobs attempting to pathfind through azalea blocks
|
|
|
|
Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
|
|
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
|
index f651d866355557d10d4bb8730e0aceac483d3ba7..f2500cbe0aecf4959921a56c88a8947839a9b0e4 100644
|
|
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
|
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
|
@@ -351,7 +351,7 @@ public interface DispenseItemBehavior {
|
|
}
|
|
}
|
|
// CraftBukkit end
|
|
- ((Saddleable) list.get(0)).equipSaddle(SoundSource.BLOCKS);
|
|
+ ((Saddleable) list.get(0)).equipSaddle(SoundSource.BLOCKS, CraftItemStack.asNMSCopy(event.getItem())); // Paper - Fix saddles losing nbt data - MC-191591
|
|
// itemstack.shrink(1); // CraftBukkit - handled above
|
|
this.setSuccess(true);
|
|
return stack;
|
|
diff --git a/src/main/java/net/minecraft/server/commands/DeOpCommands.java b/src/main/java/net/minecraft/server/commands/DeOpCommands.java
|
|
index 40490d10649e92cf622849f1bb87538102b130c7..797efca662dcc0fe7f4cf0b4b7baa235ea044f1f 100644
|
|
--- a/src/main/java/net/minecraft/server/commands/DeOpCommands.java
|
|
+++ b/src/main/java/net/minecraft/server/commands/DeOpCommands.java
|
|
@@ -34,7 +34,7 @@ public class DeOpCommands {
|
|
playerList.deop(gameProfile);
|
|
++i;
|
|
source.sendSuccess(() -> {
|
|
- return Component.translatable("commands.deop.success", targets.iterator().next().getName());
|
|
+ return Component.translatable("commands.deop.success", gameProfile.getName()); // Paper - fixes MC-253721
|
|
}, true);
|
|
}
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/commands/OpCommand.java b/src/main/java/net/minecraft/server/commands/OpCommand.java
|
|
index 6cd6d69a20e95e344fc18ab67dc300824537a59b..2e2a7c2cf3081187da817479a9da3eb10f662a6d 100644
|
|
--- a/src/main/java/net/minecraft/server/commands/OpCommand.java
|
|
+++ b/src/main/java/net/minecraft/server/commands/OpCommand.java
|
|
@@ -39,7 +39,7 @@ public class OpCommand {
|
|
playerList.op(gameProfile);
|
|
++i;
|
|
source.sendSuccess(() -> {
|
|
- return Component.translatable("commands.op.success", targets.iterator().next().getName());
|
|
+ return Component.translatable("commands.op.success", gameProfile.getName()); // Paper - fixes MC-253721
|
|
}, true);
|
|
}
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
index 06df21e55fdb70558b85fc095a04b3bb64fbe770..c6a7aace64785f76792b03be08fb69e4cb93d1b3 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -1091,7 +1091,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
} else {
|
|
AABB axisalignedbb = (new AABB(blockposition1, new BlockPos(blockposition1.getX(), this.getMaxBuildHeight(), blockposition1.getZ()))).inflate(3.0D);
|
|
List<LivingEntity> list = this.getEntitiesOfClass(LivingEntity.class, axisalignedbb, (entityliving) -> {
|
|
- return entityliving != null && entityliving.isAlive() && this.canSeeSky(entityliving.blockPosition());
|
|
+ return entityliving != null && entityliving.isAlive() && this.canSeeSky(entityliving.blockPosition()) && !entityliving.isSpectator(); // Paper - Fix lightning being able to hit spectators (MC-262422)
|
|
});
|
|
|
|
if (!list.isEmpty()) {
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
index 6cc9c28032cafd15d884223a01208ce6f027c151..14bbc86bbaad49b2af16f3b171eb667c28eda702 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
@@ -92,7 +92,7 @@ public class ServerPlayerGameMode {
|
|
return event; // Paper
|
|
}
|
|
// CraftBukkit end
|
|
- this.setGameModeForPlayer(gameMode, this.previousGameModeForPlayer);
|
|
+ this.setGameModeForPlayer(gameMode, this.gameModeForPlayer); // Paper - Fix MC-259571
|
|
this.player.onUpdateAbilities();
|
|
this.player.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE, this.player), this.player); // CraftBukkit
|
|
this.level.updateSleepingPlayerList();
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Saddleable.java b/src/main/java/net/minecraft/world/entity/Saddleable.java
|
|
index effe4c4fb37fe13aece70cdef4966047d4719af9..7152674d3f3fb98198585cb5ece2bb88877345f9 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Saddleable.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Saddleable.java
|
|
@@ -9,6 +9,11 @@ public interface Saddleable {
|
|
boolean isSaddleable();
|
|
|
|
void equipSaddle(@Nullable SoundSource sound);
|
|
+ // Paper start - Fix saddles losing nbt data - MC-191591
|
|
+ default void equipSaddle(final @Nullable SoundSource sound, final @Nullable net.minecraft.world.item.ItemStack stack) {
|
|
+ this.equipSaddle(sound);
|
|
+ }
|
|
+ // Paper end
|
|
|
|
default SoundEvent getSaddleSoundEvent() {
|
|
return SoundEvents.HORSE_SADDLE;
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/SwellGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/SwellGoal.java
|
|
index 19540fd4a7f992888fadb6501d0c8a5a7e71fcf6..e241ae250f4f04a17ef2c583d00b065a4ca56a4c 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/goal/SwellGoal.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/SwellGoal.java
|
|
@@ -21,6 +21,13 @@ public class SwellGoal extends Goal {
|
|
return this.creeper.getSwellDir() > 0 || livingEntity != null && this.creeper.distanceToSqr(livingEntity) < 9.0D;
|
|
}
|
|
|
|
+ // Paper start - Fix MC-179072
|
|
+ @Override
|
|
+ public boolean canContinueToUse() {
|
|
+ return !net.minecraft.world.entity.EntitySelector.NO_CREATIVE_OR_SPECTATOR.test(this.creeper.getTarget()) && canUse();
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
@Override
|
|
public void start() {
|
|
this.creeper.getNavigation().stop();
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
|
|
index c7b914cc0d702c6dd04add5247ec509d5870abb3..247aca0b612f5079a0596350e8311c385df8ab1c 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
|
|
@@ -237,9 +237,10 @@ public class Goat extends Animal {
|
|
player.setItemInHand(hand, itemstack1);
|
|
return InteractionResult.sidedSuccess(this.level().isClientSide);
|
|
} else {
|
|
+ boolean isFood = this.isFood(itemstack); // Paper - track before stack is possibly decreased to 0 (Fixes MC-244739)
|
|
InteractionResult enuminteractionresult = super.mobInteract(player, hand);
|
|
|
|
- if (enuminteractionresult.consumesAction() && this.isFood(itemstack)) {
|
|
+ if (enuminteractionresult.consumesAction() && isFood) { // Paper
|
|
this.level().playSound((Player) null, (Entity) this, this.getEatingSound(itemstack), SoundSource.NEUTRAL, 1.0F, Mth.randomBetween(this.level().random, 0.8F, 1.2F));
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
|
index 6bab94ac458081e9ed6e1999a9a3f884dd710604..49d7109b6ca63c8073db777549a65b2fcb70967e 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
|
@@ -250,7 +250,13 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
|
|
|
@Override
|
|
public void equipSaddle(@Nullable SoundSource sound) {
|
|
- this.inventory.setItem(0, new ItemStack(Items.SADDLE));
|
|
+ // Paper start - Fix saddles losing nbt data - MC-191591
|
|
+ this.equipSaddle(sound, null);
|
|
+ }
|
|
+ @Override
|
|
+ public void equipSaddle(@Nullable SoundSource sound, @Nullable ItemStack stack) {
|
|
+ this.inventory.setItem(0, stack != null ? stack : new ItemStack(Items.SADDLE));
|
|
+ // Paper end
|
|
}
|
|
|
|
public void equipArmor(Player player, ItemStack stack) {
|
|
diff --git a/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java b/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java
|
|
index f174094febfdfdc309f1b50877be60bae8a98156..5f407535298a31a34cfe114dd863fd6a9b977707 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java
|
|
@@ -87,8 +87,8 @@ public class CatSpawner implements CustomSpawner {
|
|
if (cat == null) {
|
|
return 0;
|
|
} else {
|
|
+ cat.moveTo(pos, 0.0F, 0.0F); // Paper - move up - Fix MC-147659
|
|
cat.finalizeSpawn(world, world.getCurrentDifficultyAt(pos), MobSpawnType.NATURAL, (SpawnGroupData)null, (CompoundTag)null);
|
|
- cat.moveTo(pos, 0.0F, 0.0F);
|
|
world.addFreshEntityWithPassengers(cat);
|
|
return 1;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raids.java b/src/main/java/net/minecraft/world/entity/raid/Raids.java
|
|
index 380afb885e85e4cf80e746d217033345a7514443..41457c9f27b18fa2734a6cca297ec5186470e82f 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/raid/Raids.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/raid/Raids.java
|
|
@@ -125,7 +125,7 @@ public class Raids extends SavedData {
|
|
// CraftBukkit end
|
|
} else {
|
|
player.removeEffect(MobEffects.BAD_OMEN);
|
|
- player.connection.send(new ClientboundEntityEventPacket(player, (byte) 43));
|
|
+ this.level.broadcastEntityEvent(player, net.minecraft.world.entity.EntityEvent.BAD_OMEN_TRIGGERED /* (byte) 43 */); // Paper - Fix MC-253884
|
|
}
|
|
|
|
if (flag) {
|
|
@@ -140,7 +140,7 @@ public class Raids extends SavedData {
|
|
}
|
|
// CraftBukkit end
|
|
raid.absorbBadOmen(player);
|
|
- player.connection.send(new ClientboundEntityEventPacket(player, (byte) 43));
|
|
+ this.level.broadcastEntityEvent(player, net.minecraft.world.entity.EntityEvent.BAD_OMEN_TRIGGERED /* (byte) 43 */); // Paper - Fix MC-253884
|
|
if (!raid.hasFirstWaveSpawned()) {
|
|
player.awardStat(Stats.RAID_TRIGGER);
|
|
CriteriaTriggers.BAD_OMEN.trigger(player);
|
|
diff --git a/src/main/java/net/minecraft/world/item/SaddleItem.java b/src/main/java/net/minecraft/world/item/SaddleItem.java
|
|
index 11e8f2bf261abcb75d4dd011702c8f396e9f5be4..7234010d81078d357ab9bca422e44864a9e269bb 100644
|
|
--- a/src/main/java/net/minecraft/world/item/SaddleItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/SaddleItem.java
|
|
@@ -18,7 +18,7 @@ public class SaddleItem extends Item {
|
|
if (entity instanceof Saddleable saddleable && entity.isAlive()) {
|
|
if (!saddleable.isSaddled() && saddleable.isSaddleable()) {
|
|
if (!user.level().isClientSide) {
|
|
- saddleable.equipSaddle(SoundSource.NEUTRAL);
|
|
+ saddleable.equipSaddle(SoundSource.NEUTRAL, stack.copyWithCount(1)); // Paper - Fix saddles losing nbt data - MC-191591
|
|
entity.level().gameEvent(entity, GameEvent.EQUIP, entity.position());
|
|
stack.shrink(1);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java b/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java
|
|
index 023ed8441d629629828051b4098b09b06ce51a75..95b53450a807fccfa55b59852da52785b8cf3e3d 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java
|
|
@@ -45,4 +45,11 @@ public class AzaleaBlock extends BushBlock implements BonemealableBlock {
|
|
public void performBonemeal(ServerLevel world, RandomSource random, BlockPos pos, BlockState state) {
|
|
TREE_GROWER.growTree(world, world.getChunkSource().getGenerator(), pos, state, random);
|
|
}
|
|
+
|
|
+ // Paper start - Fix MC-224454
|
|
+ @Override
|
|
+ public boolean isPathfindable(BlockState state, BlockGetter world, BlockPos pos, net.minecraft.world.level.pathfinder.PathComputationType type) {
|
|
+ return false;
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
|
|
index 2932419b7ca3f066b1db329829af36ba31e17c65..e11eced0bf15dfecaf64f5e1c28e973c38746095 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
|
|
@@ -63,7 +63,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock {
|
|
if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
|
|
if (!world.isClientSide && entity.isOnFire() && this.isEntityInsideContent(state, pos, entity)) {
|
|
// CraftBukkit start
|
|
- if (entity.mayInteract(world, pos)) {
|
|
+ if ((entity instanceof net.minecraft.world.entity.player.Player || world.getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_MOBGRIEFING)) && entity.mayInteract(world, pos)) { // Paper - Fixes MC-248588
|
|
if (!this.handleEntityOnFireInsideWithEvent(state, world, pos, entity)) { // Paper - fix powdered snow cauldron extinguishing entities
|
|
return;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
index 436290eaa0dab05a642b67b265117dbe5eceb8b7..5ccc419b904aec590c5624438da61ca6724b20d6 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
@@ -674,13 +674,10 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
|
|
|
@Override
|
|
public void fillStackedContents(StackedContents finder) {
|
|
- Iterator iterator = this.items.iterator();
|
|
-
|
|
- while (iterator.hasNext()) {
|
|
- ItemStack itemstack = (ItemStack) iterator.next();
|
|
-
|
|
- finder.accountStack(itemstack);
|
|
- }
|
|
+ // Paper start - don't account fuel stack (fixes MC-243057)
|
|
+ finder.accountStack(this.items.get(SLOT_INPUT));
|
|
+ finder.accountStack(this.items.get(SLOT_RESULT));
|
|
+ // Paper end
|
|
|
|
}
|
|
}
|