3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00
Paper/patches/server/0896-Fix-a-bunch-of-vanilla-bugs.patch

251 Zeilen
14 KiB
Diff

2022-10-01 19:39:42 +02:00
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
2022-10-28 02:53:16 +02:00
https://bugs.mojang.com/browse/MC-147659
Some witch huts spawn the incorrect cat
Note: Marked as Won't Fix, makes 0 sense
2022-11-19 19:23:31 +01:00
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
https://bugs.mojang.com/browse/MC-258360
Fix items equipped on AbstractHorse losing NBT
https://bugs.mojang.com/browse/MC-121048
by: MelnCat <melncatuwu@gmail.com>
This moves the setHealth call to below the recordDamage call to prevent
recordDamage from clearing the CombatTracker, since recordDamage will
clear the CombatTracker if the entity is dead. This fixes death messages
such as the "doomed to fall" messages.
https://bugs.mojang.com/browse/MC-257875
by: Jake Potrebic <jake.m.potrebic@gmail.com>
Fixes server not consuming fire charges when igniting a creeper
https://bugs.mojang.com/browse/MC-258535
by: Jake Potrebic <jake.m.potrebic@gmail.com>
Fixes certain explosion damage not scaling with difficulty
2022-10-28 02:53:16 +02:00
Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
Co-authored-by: MelnCat <melncatuwu@gmail.com>
2022-10-28 02:53:16 +02:00
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
index 1023f91b6a23fc974ba709ec09834d9faae8003a..6fedf7381762ae3d76c4801ed6d5c0844c6c857b 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;
2022-10-01 19:39:42 +02:00
diff --git a/src/main/java/net/minecraft/server/commands/DeOpCommands.java b/src/main/java/net/minecraft/server/commands/DeOpCommands.java
index cca2618d90306eed9894c5fa7b6ed96b68210688..10769c60bd53438d44fbc6192667acdf4cc95594 100644
--- a/src/main/java/net/minecraft/server/commands/DeOpCommands.java
+++ b/src/main/java/net/minecraft/server/commands/DeOpCommands.java
@@ -33,7 +33,7 @@ public class DeOpCommands {
if (playerList.isOp(gameProfile)) {
playerList.deop(gameProfile);
++i;
- source.sendSuccess(Component.translatable("commands.deop.success", targets.iterator().next().getName()), true);
+ source.sendSuccess(Component.translatable("commands.deop.success", gameProfile.getName()), true); // Paper - fixes MC-253721
}
}
diff --git a/src/main/java/net/minecraft/server/commands/OpCommand.java b/src/main/java/net/minecraft/server/commands/OpCommand.java
index 43e77cef0fce75f59aeb05e161668bebb8fca229..ef50fbf8cb3f008827850b5ed33422007be09bd2 100644
--- a/src/main/java/net/minecraft/server/commands/OpCommand.java
+++ b/src/main/java/net/minecraft/server/commands/OpCommand.java
@@ -38,7 +38,7 @@ public class OpCommand {
if (!playerList.isOp(gameProfile)) {
playerList.op(gameProfile);
++i;
- source.sendSuccess(Component.translatable("commands.op.success", targets.iterator().next().getName()), true);
+ source.sendSuccess(Component.translatable("commands.op.success", gameProfile.getName()), true); // Paper - fixes MC-253721
}
}
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;
2022-11-19 19:23:31 +01:00
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();
2022-10-01 19:39:42 +02:00
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 db533f458357683b8f3925d628ff1197144f67eb..cfa904d42734d0fb0c1ed8b18f4d8bc131027962 100644
2022-10-01 19:39:42 +02:00
--- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
2022-12-07 23:05:32 +01:00
@@ -236,9 +236,10 @@ public class Goat extends Animal {
2022-10-01 19:39:42 +02:00
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 d38ac1f3ef105474df1294541041c2607ca53244..f9496f757bcf7000fab1f16386e775d54d96e47a 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
@@ -247,7 +247,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
if (sound != null) {
this.level.playSound((Player) null, (Entity) this, this.getSaddleSoundEvent(), sound, 0.5F, 1.0F);
}
@@ -256,7 +262,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
public void equipArmor(Player player, ItemStack stack) {
if (this.isArmor(stack)) {
- this.inventory.setItem(1, new ItemStack(stack.getItem()));
+ this.inventory.setItem(1, stack.copyWithCount(1)); // Paper - fix equipping items with nbt - MC-258360, MC-191591
if (!player.getAbilities().instabuild) {
stack.shrink(1);
}
2022-10-28 02:53:16 +02:00
diff --git a/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java b/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java
2022-12-07 23:05:32 +01:00
index f174094febfdfdc309f1b50877be60bae8a98156..5f407535298a31a34cfe114dd863fd6a9b977707 100644
2022-10-28 02:53:16 +02:00
--- 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;
}
2022-10-01 19:39:42 +02:00
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 7985beb01059a9e4394920bcf3335d842bd20f4e..fabce3bc592b1b172b227395a07febdbb66ec3c9 100644
2022-10-01 19:39:42 +02:00
--- 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 c35375e15c0368fec12d37a4b82668b51d9fe9ff..0c975875f1f2d0236d42a291486a7e78e1702802 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);
}
2022-10-01 19:39:42 +02:00
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
2022-10-01 19:39:42 +02:00
--- 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 5e70b5f643faabfc05989de9592d8c5c787102e3..2a786c9fd29dc2139cf487fa645cd43345d60167 100644
2022-10-01 19:39:42 +02:00
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -664,13 +664,10 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
2022-10-01 19:39:42 +02:00
@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
}
}