13
0
geforkt von Mirrors/Paper
Dieser Commit ist enthalten in:
Noah van der Aa 2024-10-23 23:35:21 +02:00
Ursprung d523c6211b
Commit 56700a6f23
35 geänderte Dateien mit 108 neuen und 184 gelöschten Zeilen

Datei anzeigen

@ -34,16 +34,16 @@ diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Fox.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java
@@ -0,0 +0,0 @@ public class Fox extends Animal implements VariantHolder<Fox.Type> {
@@ -0,0 +0,0 @@ public class Fox extends Animal implements VariantHolder<Fox.Variant> {
this.setSleeping(nbt.getBoolean("Sleeping"));
this.setVariant(Fox.Type.byName(nbt.getString("Type")));
this.setVariant(Fox.Variant.byName(nbt.getString("Type")));
- this.setSitting(nbt.getBoolean("Sitting"));
+ this.setSitting(nbt.getBoolean("Sitting"), false); // Paper - Add EntityToggleSitEvent
this.setIsCrouching(nbt.getBoolean("Crouching"));
if (this.level() instanceof ServerLevel) {
this.setTargetGoals();
@@ -0,0 +0,0 @@ public class Fox extends Animal implements VariantHolder<Fox.Type> {
@@ -0,0 +0,0 @@ public class Fox extends Animal implements VariantHolder<Fox.Variant> {
}
public void setSitting(boolean sitting) {
@ -72,7 +72,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
@@ -0,0 +0,0 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
@@ -0,0 +0,0 @@ public class Camel extends AbstractHorse {
}
public void sitDown() {
@ -81,7 +81,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.makeSound(SoundEvents.CAMEL_SIT);
this.setPose(Pose.SITTING);
this.gameEvent(GameEvent.ENTITY_ACTION);
@@ -0,0 +0,0 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
@@ -0,0 +0,0 @@ public class Camel extends AbstractHorse {
}
public void standUp() {
@ -90,7 +90,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.makeSound(SoundEvents.CAMEL_STAND);
this.setPose(Pose.STANDING);
this.gameEvent(GameEvent.ENTITY_ACTION);
@@ -0,0 +0,0 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
@@ -0,0 +0,0 @@ public class Camel extends AbstractHorse {
}
public void standUpInstantly() {

Datei anzeigen

@ -27,4 +27,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end - PlayerAttackEntityEvent
float f = this.isAutoSpinAttack() ? this.autoSpinAttackDmg : (float) this.getAttributeValue(Attributes.ATTACK_DAMAGE);
ItemStack itemstack = this.getWeaponItem();
DamageSource damagesource = this.damageSources().playerAttack(this);
DamageSource damagesource = (DamageSource) Optional.ofNullable(itemstack.getItem().getDamageSource(this)).orElse(this.damageSources().playerAttack(this));

Datei anzeigen

@ -9,10 +9,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
+++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
@@ -0,0 +0,0 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
public boolean runNext(Level world) {
BlockPos blockPos = this.sourcePos.relative(NeighborUpdater.UPDATE_ORDER[this.idx++]);
BlockState blockState = world.getBlockState(blockPos);
- NeighborUpdater.executeUpdate(world, blockState, blockPos, this.sourceBlock, this.sourcePos, false);
orientation = this.orientation.withFront(direction);
}
- NeighborUpdater.executeUpdate(world, blockState, blockPos, this.sourceBlock, orientation, false);
+ // Paper start - Call BlockPhysicsEvent
+ try {
+ org.bukkit.event.block.BlockPhysicsEvent event = new org.bukkit.event.block.BlockPhysicsEvent(
@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ org.bukkit.craftbukkit.block.CraftBlock.at(world, this.sourcePos));
+
+ if (event.callEvent()) { // continue to check for adjacent block (increase idx)
+ NeighborUpdater.executeUpdate(world, blockState, blockPos, this.sourceBlock, this.sourcePos, false);
+ NeighborUpdater.executeUpdate(world, blockState, blockPos, this.sourceBlock, orientation, false);
+ }
+ } catch (StackOverflowError ex) {
+ world.lastPhysicsProblem = blockPos;

Datei anzeigen

@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class ServerPlayerGameMode {
}
if (player.getCooldowns().isOnCooldown(stack.getItem())) {
if (player.getCooldowns().isOnCooldown(stack)) {
- cancelledBlock = true;
+ cancelledItem = true; // Paper - correctly handle items on cooldown
}

Datei anzeigen

@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@Override
protected void pickUpItem(ItemEntity item) {
- this.onItemPickup(item);
+ // this.onItemPickup(item); // Paper - EntityPickupItemEvent fixes; call in PiglinAi#pickUpItem after EntityPickupItemEvent is fired
PiglinAi.pickUpItem(this, item);
protected void pickUpItem(ServerLevel world, ItemEntity itemEntity) {
- this.onItemPickup(itemEntity);
+ // this.onItemPickup(itemEntity); // Paper - EntityPickupItemEvent fixes; call in PiglinAi#pickUpItem after EntityPickupItemEvent is fired
PiglinAi.pickUpItem(world, this, itemEntity);
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
@ -32,26 +32,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
ItemStack itemstack;
// CraftBukkit start
- if (drop.getItem().is(Items.GOLD_NUGGET) && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(piglin, drop, 0, false).isCancelled()) {
- if (itemEntity.getItem().is(Items.GOLD_NUGGET) && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(piglin, itemEntity, 0, false).isCancelled()) {
+ // Paper start - EntityPickupItemEvent fixes; fix event firing twice
+ if (drop.getItem().is(Items.GOLD_NUGGET) /* && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(piglin, drop, 0, false).isCancelled() */) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(piglin, drop, 0, false).isCancelled()) return;
+ piglin.onItemPickup(drop); // Paper - moved from Piglin#pickUpItem - call prior to item entity modification
+ // Paper end - EntityPickupItemEvent fixes
piglin.take(drop, drop.getItem().getCount());
itemstack = drop.getItem();
drop.discard(EntityRemoveEvent.Cause.PICKUP); // CraftBukkit - add Bukkit remove cause
} else if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(piglin, drop, drop.getItem().getCount() - 1, false).isCancelled()) {
+ piglin.onItemPickup(drop); // Paper - EntityPickupItemEvent fixes; moved from Piglin#pickUpItem - call prior to item entity modification
piglin.take(drop, 1);
itemstack = PiglinAi.removeOneItemFromItemEntity(drop);
+ if (itemEntity.getItem().is(Items.GOLD_NUGGET)/* && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(piglin, itemEntity, 0, false).isCancelled()*/) { // Paper
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(piglin, itemEntity, 0, false).isCancelled()) return;
+ piglin.onItemPickup(itemEntity); // Paper - moved from Piglin#pickUpItem - call prior to item entity modification
+ // Paper end
piglin.take(itemEntity, itemEntity.getItem().getCount());
itemstack = itemEntity.getItem();
itemEntity.discard(EntityRemoveEvent.Cause.PICKUP); // CraftBukkit - add Bukkit remove cause
} else if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(piglin, itemEntity, itemEntity.getItem().getCount() - 1, false).isCancelled()) {
+ piglin.onItemPickup(itemEntity); // Paper - EntityPickupItemEvent fixes; moved from Piglin#pickUpItem - call prior to item entity modification
piglin.take(itemEntity, 1);
itemstack = PiglinAi.removeOneItemFromItemEntity(itemEntity);
} else {
@@ -0,0 +0,0 @@ public class PiglinAi {
} else if (PiglinAi.isFood(itemstack) && !PiglinAi.hasEatenRecently(piglin)) {
PiglinAi.eat(piglin);
} else {
- boolean flag = !piglin.equipItemIfPossible(itemstack, drop).equals(ItemStack.EMPTY); // CraftBukkit
+ boolean flag = !piglin.equipItemIfPossible(itemstack, null).equals(ItemStack.EMPTY); // CraftBukkit // Paper - pass null item entity to prevent duplicate pickup item event call - called above.
- boolean flag = !piglin.equipItemIfPossible(world, itemstack, itemEntity).equals(ItemStack.EMPTY); // CraftBukkit
+ boolean flag = !piglin.equipItemIfPossible(world, itemstack, null).equals(ItemStack.EMPTY); // CraftBukkit // Paper - pass null item entity to prevent duplicate pickup item event call - called above.
if (!flag) {
PiglinAi.putInInventory(piglin, itemstack);
@ -62,7 +62,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class Raider extends PatrollingMonster {
boolean flag = this.hasActiveRaid() && this.getCurrentRaid().getLeader(this.getWave()) != null;
if (this.hasActiveRaid() && !flag && ItemStack.matches(itemstack, Raid.getLeaderBannerInstance(this.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN)))) {
if (this.hasActiveRaid() && !flag && ItemStack.matches(itemstack, Raid.getOminousBannerInstance(this.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN)))) {
+ // Paper start - EntityPickupItemEvent fixes
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, item, 0, false).isCancelled()) {
+ return;

Datei anzeigen

@ -12,18 +12,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/world/effect/WeavingMobEffect.java
@@ -0,0 +0,0 @@ class WeavingMobEffect extends MobEffect {
@Override
public void onMobRemoved(LivingEntity entity, int amplifier, Entity.RemovalReason reason) {
if (reason == Entity.RemovalReason.KILLED && (entity instanceof Player || entity.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) {
- this.spawnCobwebsRandomlyAround(entity.level(), entity.getRandom(), entity.getOnPos());
+ this.spawnCobwebsRandomlyAround(entity, entity.level(), entity.getRandom(), entity.getOnPos()); // Paper - Fire EntityChangeBlockEvent in more places
public void onMobRemoved(ServerLevel world, LivingEntity entity, int amplifier, Entity.RemovalReason reason) {
if (reason == Entity.RemovalReason.KILLED && (entity instanceof Player || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) {
- this.spawnCobwebsRandomlyAround(world, entity.getRandom(), entity.blockPosition());
+ this.spawnCobwebsRandomlyAround(entity, world, entity.getRandom(), entity.blockPosition()); // Paper - Fire EntityChangeBlockEvent in more places
}
}
- private void spawnCobwebsRandomlyAround(Level world, RandomSource random, BlockPos pos) {
+ private void spawnCobwebsRandomlyAround(LivingEntity entity, Level world, RandomSource random, BlockPos pos) { // Paper - Fire EntityChangeBlockEvent in more places
Set<BlockPos> set = Sets.newHashSet();
int i = this.maxCobwebs.applyAsInt(random);
@@ -0,0 +0,0 @@ class WeavingMobEffect extends MobEffect {
}
@ -46,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
@@ -0,0 +0,0 @@ public class LightningBolt extends Entity {
}
}
- private static void clearCopperOnLightningStrike(Level world, BlockPos pos) {
@ -153,26 +148,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return InteractionResult.PASS;
+ }
+ // Paper end
if (player instanceof ServerPlayer) {
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger((ServerPlayer)player, blockPos, itemStack);
if (player instanceof ServerPlayer serverPlayer) {
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(serverPlayer, blockPos, itemStack);
}
diff --git a/src/main/java/net/minecraft/world/item/PotionItem.java b/src/main/java/net/minecraft/world/item/PotionItem.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/PotionItem.java
+++ b/src/main/java/net/minecraft/world/item/PotionItem.java
@@ -0,0 +0,0 @@ public class PotionItem extends Item {
BlockState iblockdata = world.getBlockState(blockposition);
if (context.getClickedFace() != Direction.DOWN && iblockdata.is(BlockTags.CONVERTABLE_TO_MUD) && potioncontents.is(Potions.WATER)) {
PotionContents potionContents = itemStack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY);
BlockState blockState = level.getBlockState(blockPos);
if (context.getClickedFace() != Direction.DOWN && blockState.is(BlockTags.CONVERTABLE_TO_MUD) && potionContents.is(Potions.WATER)) {
+ // Paper start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityhuman, blockposition, Blocks.MUD.defaultBlockState())) {
+ entityhuman.containerMenu.sendAllDataToRemote();
+ return InteractionResult.PASS;
+ }
+ // Paper end
world.playSound((Player) null, blockposition, SoundEvents.GENERIC_SPLASH, SoundSource.BLOCKS, 1.0F, 1.0F);
entityhuman.setItemInHand(context.getHand(), ItemUtils.createFilledResult(itemstack, entityhuman, new ItemStack(Items.GLASS_BOTTLE)));
entityhuman.awardStat(Stats.ITEM_USED.get(itemstack.getItem()));
level.playSound(null, blockPos, SoundEvents.GENERIC_SPLASH, SoundSource.BLOCKS, 1.0F, 1.0F);
player.setItemInHand(context.getHand(), ItemUtils.createFilledResult(itemStack, player, new ItemStack(Items.GLASS_BOTTLE)));
player.awardStat(Stats.ITEM_USED.get(itemStack.getItem()));
diff --git a/src/main/java/net/minecraft/world/item/ShovelItem.java b/src/main/java/net/minecraft/world/item/ShovelItem.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/ShovelItem.java

Datei anzeigen

@ -95,7 +95,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// CraftBukkit end
}
- boolean anyPlayerCloseEnoughForSpawning(ChunkPos pos) {
@ -107,9 +107,9 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/mai
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
} else {
AABB axisalignedbb = AABB.encapsulatingFullBlocks(blockposition1, new BlockPos(blockposition1.atY(this.getMaxBuildHeight()))).inflate(3.0D);
AABB axisalignedbb = AABB.encapsulatingFullBlocks(blockposition1, blockposition1.atY(this.getMaxY() + 1)).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)
@ -134,13 +134,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
} else if (enuminteractionresult.shouldSwing() && !this.player.gameMode.interactResult) { // Paper - Call interact event
this.player.swing(enumhand, true);
this.player.swing(enumhand, true);
}
}
- }
+ } else { this.player.containerMenu.sendAllDataToRemote(); } // Paper - Fix inventory desync; MC-99075
} else {
MutableComponent ichatmutablecomponent1 = Component.translatable("build.tooHigh", i - 1).withStyle(ChatFormatting.RED);
MutableComponent ichatmutablecomponent1 = Component.translatable("build.tooHigh", i).withStyle(ChatFormatting.RED);
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -224,14 +224,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
@@ -0,0 +0,0 @@ public class Goat extends Animal {
player.setItemInHand(hand, itemstack1);
return InteractionResult.sidedSuccess(this.level().isClientSide);
return InteractionResult.SUCCESS;
} 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));
this.playEatingSound();
}
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
@ -251,8 +251,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end
+
@Nullable
public MapId getFramedMapId(ItemStack itemstack) {
return (MapId) itemstack.get(DataComponents.MAP_ID);
public MapId getFramedMapId(ItemStack stack) {
return (MapId) stack.get(DataComponents.MAP_ID);
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java
@ -262,7 +262,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return 0;
} else {
+ cat.moveTo(pos, 0.0F, 0.0F); // Paper - move up - Fix MC-147659
cat.finalizeSpawn(world, world.getCurrentDifficultyAt(pos), MobSpawnType.NATURAL, null);
cat.finalizeSpawn(world, world.getCurrentDifficultyAt(pos), EntitySpawnReason.NATURAL, null);
- cat.moveTo(pos, 0.0F, 0.0F);
world.addFreshEntityWithPassengers(cat);
return 1;
@ -283,35 +283,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.paymentSlot.hasItem()) {
// Paper start - Add PlayerChangeBeaconEffectEvent
io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent event = new io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent((org.bukkit.entity.Player) this.player.player.getBukkitEntity(), convert(primary), convert(secondary), this.access.getLocation().getBlock());
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java
@@ -0,0 +0,0 @@ public class AzaleaBlock extends BushBlock implements BonemealableBlock {
public void performBonemeal(ServerLevel world, RandomSource random, BlockPos pos, BlockState state) {
TreeGrower.AZALEA.growTree(world, world.getChunkSource().getGenerator(), pos, state, random);
}
+
+ // Paper start - Fix MC-224454
+ @Override
+ public boolean isPathfindable(BlockState state, 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
@@ -0,0 +0,0 @@ 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 - Add EntityInsideBlockEvent
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;
}
if (entity.isOnFire() && this.isEntityInsideContent(state, pos, entity)) {
// CraftBukkit start - moved down
// entity.clearFire();
- if (entity.mayInteract(worldserver, pos)) {
+ if ((entity instanceof net.minecraft.world.entity.player.Player || worldserver.getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_MOBGRIEFING)) && entity.mayInteract(worldserver, pos)) { // Paper - Fixes MC-248588
if (this.handleEntityOnFireInsideWithEvent(state, world, pos, entity)) { // Paper - fix powdered snow cauldron extinguishing entities
entity.clearFire();
}
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@ -319,7 +303,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@Override
public void fillStackedContents(StackedContents finder) {
public void fillStackedContents(StackedItemContents finder) {
- Iterator iterator = this.items.iterator();
-
- while (iterator.hasNext()) {
@ -360,12 +344,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- public void reset() {
+ public void reset(TrialSpawner logic) { // Paper - Fix TrialSpawner forgets assigned mob; MC-273635
this.currentMobs.clear();
this.nextSpawnData = Optional.empty();
- this.resetStatistics();
+ this.resetStatistics(logic);
}
- public void resetStatistics() {
+ public void resetStatistics(TrialSpawner logic) { // Paper - Fix TrialSpawner forgets assigned mob; MC-273635
this.detectedPlayers.clear();
this.totalMobsSpawned = 0;
this.nextMobSpawnsAt = 0L;
this.cooldownEndsAt = 0L;
this.currentMobs.clear();
- this.nextSpawnData = Optional.empty();
+ this.nextSpawnData = Optional.empty();
+ if (!logic.getConfig().spawnPotentialsDefinition().isEmpty()) this.nextSpawnData = Optional.empty(); // Paper - Fix TrialSpawner forgets assigned mob; MC-273635
}
@ -378,8 +369,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
case INACTIVE -> trialSpawnerData.getOrCreateDisplayEntity(logic, world, WAITING_FOR_PLAYERS) == null ? this : WAITING_FOR_PLAYERS;
case WAITING_FOR_PLAYERS -> {
if (!logic.canSpawnInLevel(world)) {
- trialSpawnerData.reset();
+ trialSpawnerData.reset(logic); // Paper - Fix TrialSpawner forgets assigned mob; MC-273635
- trialSpawnerData.resetStatistics();
+ trialSpawnerData.resetStatistics(logic); // Paper - Fix TrialSpawner forgets assigned mob; MC-273635
yield this;
} else if (!trialSpawnerData.hasMobToSpawn(logic, world.random)) {
yield INACTIVE;
@ -387,8 +378,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
case ACTIVE -> {
if (!logic.canSpawnInLevel(world)) {
- trialSpawnerData.reset();
+ trialSpawnerData.reset(logic); // Paper - Fix TrialSpawner forgets assigned mob; MC-273635
- trialSpawnerData.resetStatistics();
+ trialSpawnerData.resetStatistics(logic); // Paper - Fix TrialSpawner forgets assigned mob; MC-273635
yield WAITING_FOR_PLAYERS;
} else if (!trialSpawnerData.hasMobToSpawn(logic, world.random)) {
yield INACTIVE;
@ -401,25 +392,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
yield WAITING_FOR_PLAYERS;
} else {
yield this;
diff --git a/src/main/java/net/minecraft/world/level/portal/DimensionTransition.java b/src/main/java/net/minecraft/world/level/portal/DimensionTransition.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/portal/DimensionTransition.java
+++ b/src/main/java/net/minecraft/world/level/portal/DimensionTransition.java
@@ -0,0 +0,0 @@ public record DimensionTransition(ServerLevel newLevel, Vec3 pos, Vec3 speed, fl
}
public DimensionTransition(ServerLevel worldserver, Entity entity, DimensionTransition.PostDimensionTransition dimensiontransition_a, PlayerTeleportEvent.TeleportCause cause) {
- this(worldserver, findAdjustedSharedSpawnPos(worldserver, entity), Vec3.ZERO, 0.0F, 0.0F, false, dimensiontransition_a, cause);
+ this(worldserver, findAdjustedSharedSpawnPos(worldserver, entity), Vec3.ZERO, worldserver.getSharedSpawnAngle(), 0.0F, false, dimensiontransition_a, cause); // Paper - MC-200092 - fix spawn pos yaw being ignored
// CraftBukkit end
}
@@ -0,0 +0,0 @@ public record DimensionTransition(ServerLevel newLevel, Vec3 pos, Vec3 speed, fl
}
public static DimensionTransition missingRespawnBlock(ServerLevel world, Entity entity, DimensionTransition.PostDimensionTransition postDimensionTransition) {
- return new DimensionTransition(world, findAdjustedSharedSpawnPos(world, entity), Vec3.ZERO, 0.0F, 0.0F, true, postDimensionTransition);
+ return new DimensionTransition(world, findAdjustedSharedSpawnPos(world, entity), Vec3.ZERO, world.getSharedSpawnAngle(), 0.0F, true, postDimensionTransition); // Paper - MC-200092 - fix spawn pos yaw being ignored
}
private static Vec3 findAdjustedSharedSpawnPos(ServerLevel world, Entity entity) {

Datei anzeigen

@ -14,14 +14,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- this.heal(foodinfo != null ? (float) foodinfo.nutrition() : 1.0F);
+ this.heal(foodinfo != null ? (float) foodinfo.nutrition() : 1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // Paper - Add missing regain reason
this.playEatingSound();
}
return InteractionResult.sidedSuccess(this.level().isClientSide());
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
@@ -0,0 +0,0 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
@@ -0,0 +0,0 @@ public class Camel extends AbstractHorse {
boolean flag = this.getHealth() < this.getMaxHealth();
if (flag) {

Datei anzeigen

@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Date: Tue, 16 Aug 2022 19:44:55 +0200
Subject: [PATCH] Missing effect cause
diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
+++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
@@ -0,0 +0,0 @@ public class Axolotl extends Animal implements VariantHolder<Axolotl.Variant>, B
player.addEffect(new MobEffectInstance(MobEffects.REGENERATION, j, 0), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AXOLOTL); // CraftBukkit
}
- player.removeEffect(MobEffects.DIG_SLOWDOWN);
+ player.removeEffect(MobEffects.DIG_SLOWDOWN, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AXOLOTL); // Paper - Add missing effect cause
}
@Override

Datei anzeigen

@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/mai
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
if (entity instanceof Mob entityinsentient) {
@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
String s = "onTrackingStart called during navigation iteration";
Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration"));
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
if (entity instanceof Mob entityinsentient) {

Datei anzeigen

@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.level().getProfiler().pop();
this.level().getProfiler().push("rangeChecks");
gameprofilerfiller.pop();
gameprofilerfiller.push("rangeChecks");
- while (this.getYRot() - this.yRotO < -180.0F) {
- this.yRotO -= 360.0F;
@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F;
+ // Paper end
this.level().getProfiler().pop();
gameprofilerfiller.pop();
this.animStep += f2;
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644

Datei anzeigen

@ -11,8 +11,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class JigsawBlockEntity extends BlockEntity {
public void generate(ServerLevel world, int maxDepth, boolean keepJigsaws) {
BlockPos blockPos = this.getBlockPos().relative(this.getBlockState().getValue(JigsawBlock.ORIENTATION).front());
Registry<StructureTemplatePool> registry = world.registryAccess().registryOrThrow(Registries.TEMPLATE_POOL);
- Holder<StructureTemplatePool> holder = registry.getHolderOrThrow(this.pool);
Registry<StructureTemplatePool> registry = world.registryAccess().lookupOrThrow(Registries.TEMPLATE_POOL);
- Holder<StructureTemplatePool> holder = registry.getOrThrow(this.pool);
+ // Paper start - Replace getHolderOrThrow with a null check
+ Holder<StructureTemplatePool> holder = registry.getHolder(this.pool).orElse(null);
+ if (holder == null) {

Datei anzeigen

@ -12,9 +12,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
public boolean canCollideWith(Entity other) {
- return Boat.canVehicleCollide(this, other);
- return AbstractBoat.canVehicleCollide(this, other);
+ // Paper start - fix VehicleEntityCollisionEvent not called when colliding with player
+ boolean collides = Boat.canVehicleCollide(this, other);
+ boolean collides = AbstractBoat.canVehicleCollide(this, other);
+ if (!collides) {
+ return false;
+ }

Datei anzeigen

@ -1,58 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Date: Tue, 16 Aug 2022 19:44:55 +0200
Subject: [PATCH] Missing effect cause
diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
+++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
@@ -0,0 +0,0 @@ public class Axolotl extends Animal implements LerpingModel, VariantHolder<Axolo
player.addEffect(new MobEffectInstance(MobEffects.REGENERATION, j, 0), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AXOLOTL); // CraftBukkit
}
- player.removeEffect(MobEffects.DIG_SLOWDOWN);
+ player.removeEffect(MobEffects.DIG_SLOWDOWN, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AXOLOTL); // Paper - Add missing effect cause
}
@Override
diff --git a/src/main/java/net/minecraft/world/item/HoneyBottleItem.java b/src/main/java/net/minecraft/world/item/HoneyBottleItem.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/HoneyBottleItem.java
+++ b/src/main/java/net/minecraft/world/item/HoneyBottleItem.java
@@ -0,0 +0,0 @@ public class HoneyBottleItem extends Item {
}
if (!world.isClientSide) {
- user.removeEffect(MobEffects.POISON);
+ user.removeEffect(MobEffects.POISON, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // Paper - Add missing effect cause
}
if (stack.isEmpty()) {
diff --git a/src/main/java/net/minecraft/world/item/OminousBottleItem.java b/src/main/java/net/minecraft/world/item/OminousBottleItem.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/OminousBottleItem.java
+++ b/src/main/java/net/minecraft/world/item/OminousBottleItem.java
@@ -0,0 +0,0 @@ public class OminousBottleItem extends Item {
if (!world.isClientSide) {
world.playSound(null, user.blockPosition(), SoundEvents.OMINOUS_BOTTLE_DISPOSE, user.getSoundSource(), 1.0F, 1.0F);
Integer integer = stack.getOrDefault(DataComponents.OMINOUS_BOTTLE_AMPLIFIER, Integer.valueOf(0));
- user.addEffect(new MobEffectInstance(MobEffects.BAD_OMEN, 120000, integer, false, false, true));
+ user.addEffect(new MobEffectInstance(MobEffects.BAD_OMEN, 120000, integer, false, false, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.POTION_DRINK); // Paper - Add missing effect cause
}
stack.consume(1, user);
diff --git a/src/main/java/net/minecraft/world/item/SuspiciousStewItem.java b/src/main/java/net/minecraft/world/item/SuspiciousStewItem.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/SuspiciousStewItem.java
+++ b/src/main/java/net/minecraft/world/item/SuspiciousStewItem.java
@@ -0,0 +0,0 @@ public class SuspiciousStewItem extends Item {
while (iterator.hasNext()) {
SuspiciousStewEffects.Entry suspicioussteweffects_a = (SuspiciousStewEffects.Entry) iterator.next();
- user.addEffect(suspicioussteweffects_a.createEffectInstance());
+ user.addEffect(suspicioussteweffects_a.createEffectInstance(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // Paper - Add missing effect cause
}
return super.finishUsingItem(stack, world, user);

Datei anzeigen

@ -1 +0,0 @@
MCUTILS: look at chunkmap changes around line 555. I removed our changes because I wasn't sure what changed, needs to be looked at!