Applied all patches

This commit is contained in:
Nassim Jahnke 2023-03-14 22:29:14 +01:00
parent b5f8080674
commit c07518e0c6
37 changed files with 56 additions and 206 deletions

View file

@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return 0; return 0;
} else { } else {
@@ -0,0 +0,0 @@ public class PhantomSpawner implements CustomSpawner { @@ -0,0 +0,0 @@ public class PhantomSpawner implements CustomSpawner {
int j = Mth.clamp(serverstatisticmanager.getValue(Stats.CUSTOM.get(Stats.TIME_SINCE_REST)), (int) 1, Integer.MAX_VALUE); int j = Mth.clamp(serverstatisticmanager.getValue(Stats.CUSTOM.get(Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE);
boolean flag2 = true; boolean flag2 = true;
- if (randomsource.nextInt(j) >= 72000) { - if (randomsource.nextInt(j) >= 72000) {

View file

@ -62,9 +62,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name @@ -0,0 +0,0 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
@Nullable @Nullable
@Override @Override
public AbstractContainerMenu createMenu(int syncId, Inventory inv, Player player) { public AbstractContainerMenu createMenu(int syncId, Inventory playerInventory, Player player) {
- return BaseContainerBlockEntity.canUnlock(player, this.lockKey, this.getDisplayName()) ? new BeaconMenu(syncId, inv, this.dataAccess, ContainerLevelAccess.create(this.level, this.getBlockPos())) : null; - return BaseContainerBlockEntity.canUnlock(player, this.lockKey, this.getDisplayName()) ? new BeaconMenu(syncId, playerInventory, this.dataAccess, ContainerLevelAccess.create(this.level, this.getBlockPos())) : null;
+ return BaseContainerBlockEntity.canUnlock(player, this.lockKey, this.getDisplayName(), this) ? new BeaconMenu(syncId, inv, this.dataAccess, ContainerLevelAccess.create(this.level, this.getBlockPos())) : null; // Paper + return BaseContainerBlockEntity.canUnlock(player, this.lockKey, this.getDisplayName(), this) ? new BeaconMenu(syncId, playerInventory, this.dataAccess, ContainerLevelAccess.create(this.level, this.getBlockPos())) : null;
} }
@Override @Override

View file

@ -4,6 +4,19 @@ Date: Sun, 8 Aug 2021 19:56:02 +0200
Subject: [PATCH] Add CompostItemEvent and EntityCompostItemEvent Subject: [PATCH] Add CompostItemEvent and EntityCompostItemEvent
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java b/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
@@ -0,0 +0,0 @@ public class WorkAtComposter extends WorkAtPoi {
i -= p;
for(int q = 0; q < p; ++q) {
- blockState = ComposterBlock.insertItem(entity, blockState, world, itemStack, blockPos);
+ blockState = ComposterBlock.insertItem(entity, blockState, world, itemStack, blockPos, entity); // Paper
if (blockState.getValue(ComposterBlock.LEVEL) == 7) {
this.spawnComposterFillEffects(world, composterState, blockPos, blockState);
return;
diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java --- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
@ -12,8 +25,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (state != dummyBlockState && org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, pos, dummyBlockState).isCancelled()) { // if block state will change and event cancelled if (state != dummyBlockState && org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(player, pos, dummyBlockState).isCancelled()) { // if block state will change and event cancelled
return InteractionResult.sidedSuccess(world.isClientSide); return InteractionResult.sidedSuccess(world.isClientSide);
} }
- BlockState iblockdata1 = ComposterBlock.addItem(state, world, pos, itemstack, rand); - BlockState iblockdata1 = ComposterBlock.addItem(player, state, world, pos, itemstack, rand);
+ BlockState iblockdata1 = ComposterBlock.addItem(state, world, pos, itemstack, player); + BlockState iblockdata1 = ComposterBlock.addItem(player, state, world, pos, itemstack);
+ if (iblockdata1 == null) { + if (iblockdata1 == null) {
+ return InteractionResult.PASS; + return InteractionResult.PASS;
+ } + }
@ -21,43 +34,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
world.levelEvent(1500, pos, state != iblockdata1 ? 1 : 0); world.levelEvent(1500, pos, state != iblockdata1 ? 1 : 0);
@@ -0,0 +0,0 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { @@ -0,0 +0,0 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
if (i < 7 && ComposterBlock.COMPOSTABLES.containsKey(itemstack.getItem())) { return state;
// CraftBukkit start
double rand = worldserver.getRandom().nextDouble();
- BlockState iblockdata1 = ComposterBlock.addItem(iblockdata, DummyGeneratorAccess.INSTANCE, blockposition, itemstack, rand);
+ BlockState iblockdata1 = ComposterBlock.addItem(iblockdata, DummyGeneratorAccess.INSTANCE, blockposition, itemstack, rand, entity); // Paper
if (iblockdata == iblockdata1 || org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, iblockdata1).isCancelled()) {
return iblockdata;
} }
- iblockdata1 = ComposterBlock.addItem(iblockdata, (LevelAccessor) worldserver, blockposition, itemstack, rand); iblockdata1 = ComposterBlock.addItem(user, state, world, pos, stack, rand);
+ // Paper start + // Paper start
+ iblockdata1 = ComposterBlock.addItem(iblockdata, (LevelAccessor) worldserver, blockposition, itemstack, rand, entity);
+ if (iblockdata1 == null) { + if (iblockdata1 == null) {
+ return iblockdata; + return state;
+ } + }
+ // Paper end + // Paper end
// CraftBukkit end // CraftBukkit end
itemstack.shrink(1); stack.shrink(1);
@@ -0,0 +0,0 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { @@ -0,0 +0,0 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
// CraftBukkit start
return ComposterBlock.addItem(state, world, pos, item, world.getRandom().nextDouble());
}
+ // Paper start
+ static BlockState addItem(BlockState state, LevelAccessor world, BlockPos pos, ItemStack item, @Nullable Entity entity) {
+ return ComposterBlock.addItem(state, world, pos, item, world.getRandom().nextDouble(), entity);
+ }
+ // Paper end
static BlockState addItem(BlockState iblockdata, LevelAccessor generatoraccess, BlockPos blockposition, ItemStack itemstack, double rand) {
+ // Paper start
+ return ComposterBlock.addItem(iblockdata, generatoraccess, blockposition, itemstack, rand, null);
+ }
+
+ @Nullable
+ static BlockState addItem(BlockState iblockdata, LevelAccessor generatoraccess, BlockPos blockposition, ItemStack itemstack, double rand, @Nullable Entity entity) {
+ // Paper end
// CraftBukkit end
int i = (Integer) iblockdata.getValue(ComposterBlock.LEVEL); int i = (Integer) iblockdata.getValue(ComposterBlock.LEVEL);
float f = ComposterBlock.COMPOSTABLES.getFloat(itemstack.getItem()); float f = ComposterBlock.COMPOSTABLES.getFloat(itemstack.getItem());
@ -82,7 +70,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
int j = i + 1; int j = i + 1;
@@ -0,0 +0,0 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { @@ -0,0 +0,0 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
this.changed = true; this.changed = true;
BlockState iblockdata = ComposterBlock.addItem(this.state, this.level, this.pos, itemstack); BlockState iblockdata = ComposterBlock.addItem((Entity) null, this.state, this.level, this.pos, itemstack);
+ // Paper start + // Paper start
+ if (iblockdata == null) { + if (iblockdata == null) {

View file

@ -25,7 +25,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/ma
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/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 { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.level.getCraftServer().getPluginManager().callEvent(event); this.level.getCraftServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {

View file

@ -149,14 +149,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());
@@ -0,0 +0,0 @@ public interface DispenseItemBehavior { @@ -0,0 +0,0 @@ public interface DispenseItemBehavior {
EntityType.updateCustomEntityTag(worldserver, (Player) null, entityarmorstand, stack.getTag()); ArmorStand entityarmorstand = (ArmorStand) EntityType.ARMOR_STAND.spawn(worldserver, stack.getTag(), consumer, blockposition, MobSpawnType.DISPENSER, false, false);
entityarmorstand.setYRot(enumdirection.toYRot());
worldserver.addFreshEntity(entityarmorstand); if (entityarmorstand != null) {
- // itemstack.shrink(1); // CraftBukkit - Handled during event processing - // itemstack.shrink(1); // CraftBukkit - Handled during event processing
+ if (shrink) stack.shrink(1); // Paper - actually handle here + if (shrink) stack.shrink(1); // Paper - actually handle here
}
return stack; return stack;
}
});
@@ -0,0 +0,0 @@ public interface DispenseItemBehavior { @@ -0,0 +0,0 @@ public interface DispenseItemBehavior {
if (!list.isEmpty()) { if (!list.isEmpty()) {
@ -451,7 +451,7 @@ diff --git a/src/main/java/net/minecraft/world/item/ArmorItem.java b/src/main/ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/ArmorItem.java --- a/src/main/java/net/minecraft/world/item/ArmorItem.java
+++ b/src/main/java/net/minecraft/world/item/ArmorItem.java +++ b/src/main/java/net/minecraft/world/item/ArmorItem.java
@@ -0,0 +0,0 @@ public class ArmorItem extends Item implements Wearable { @@ -0,0 +0,0 @@ public class ArmorItem extends Item implements Equipable {
} else { } else {
LivingEntity entityliving = (LivingEntity) list.get(0); LivingEntity entityliving = (LivingEntity) list.get(0);
EquipmentSlot enumitemslot = Mob.getEquipmentSlotForItem(armor); EquipmentSlot enumitemslot = Mob.getEquipmentSlotForItem(armor);
@ -460,7 +460,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit start // CraftBukkit start
Level world = pointer.getLevel(); Level world = pointer.getLevel();
org.bukkit.block.Block block = world.getWorld().getBlockAt(pointer.getPos().getX(), pointer.getPos().getY(), pointer.getPos().getZ()); org.bukkit.block.Block block = world.getWorld().getBlockAt(pointer.getPos().getX(), pointer.getPos().getY(), pointer.getPos().getZ());
@@ -0,0 +0,0 @@ public class ArmorItem extends Item implements Wearable { @@ -0,0 +0,0 @@ public class ArmorItem extends Item implements Equipable {
} }
if (event.isCancelled()) { if (event.isCancelled()) {
@ -476,7 +476,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Chain to handler for new item // Chain to handler for new item
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());
@@ -0,0 +0,0 @@ public class ArmorItem extends Item implements Wearable { @@ -0,0 +0,0 @@ public class ArmorItem extends Item implements Equipable {
((Mob) entityliving).setPersistenceRequired(); ((Mob) entityliving).setPersistenceRequired();
} }

View file

@ -37,7 +37,7 @@ diff --git a/src/main/java/net/minecraft/world/level/block/CarvedPumpkinBlock.ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/CarvedPumpkinBlock.java --- a/src/main/java/net/minecraft/world/level/block/CarvedPumpkinBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CarvedPumpkinBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CarvedPumpkinBlock.java
@@ -0,0 +0,0 @@ public class CarvedPumpkinBlock extends HorizontalDirectionalBlock implements We @@ -0,0 +0,0 @@ public class CarvedPumpkinBlock extends HorizontalDirectionalBlock implements Eq
// clearPatternBlocks(world, shapedetector_shapedetectorcollection); // CraftBukkit - moved down // clearPatternBlocks(world, shapedetector_shapedetectorcollection); // CraftBukkit - moved down
entity.moveTo((double) pos.getX() + 0.5D, (double) pos.getY() + 0.05D, (double) pos.getZ() + 0.5D, 0.0F, 0.0F); entity.moveTo((double) pos.getX() + 0.5D, (double) pos.getY() + 0.05D, (double) pos.getZ() + 0.5D, 0.0F, 0.0F);
// CraftBukkit start // CraftBukkit start

View file

@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/player/Player.java --- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity {
public FishingHook fishing; protected float hurtDir;
// Paper start // Paper start
public boolean affectsSpawning = true; public boolean affectsSpawning = true;
+ public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; + public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET;

View file

@ -16,4 +16,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (this.tamable.distanceToSqr(this.owner) <= 16 * 16) this.tamable.getLookControl().setLookAt(this.owner, 10.0F, (float) this.tamable.getMaxHeadXRot()); // Paper + if (this.tamable.distanceToSqr(this.owner) <= 16 * 16) this.tamable.getLookControl().setLookAt(this.owner, 10.0F, (float) this.tamable.getMaxHeadXRot()); // Paper
if (--this.timeToRecalcPath <= 0) { if (--this.timeToRecalcPath <= 0) {
this.timeToRecalcPath = this.adjustedTickDelay(10); this.timeToRecalcPath = this.adjustedTickDelay(10);
if (!this.tamable.isLeashed() && !this.tamable.isPassenger()) { if (this.tamable.distanceToSqr((Entity) this.owner) >= 144.0D) {

View file

@ -89,8 +89,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- player.getEntityData().refresh(player); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn - player.getEntityData().refresh(player); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn
+ //player.getEntityData().refresh(player); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn Paper - THIS IS NOT NEEDED ANYMORE + //player.getEntityData().refresh(player); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn Paper - THIS IS NOT NEEDED ANYMORE
// CraftBukkit start - Only add if the player wasn't moved in the event this.sendLevelInfo(player, worldserver1);
if (player.level == worldserver1 && !worldserver1.players().contains(player)) {
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bucketable.java b/src/main/java/net/minecraft/world/entity/animal/Bucketable.java diff --git a/src/main/java/net/minecraft/world/entity/animal/Bucketable.java b/src/main/java/net/minecraft/world/entity/animal/Bucketable.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bucketable.java --- a/src/main/java/net/minecraft/world/entity/animal/Bucketable.java

View file

@ -22,11 +22,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -0,0 +0,0 @@ public abstract class PlayerList {
player.sendServerStatus(serverping);
}
playerconnection.teleport(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot());
player.sendServerStatus(this.server.getStatus());
- player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players)); - player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players));
+ // player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players)); // Paper - use single player info update packet + // player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players)); // Paper
this.players.add(player); this.players.add(player);
this.playersByName.put(player.getScoreboardName().toLowerCase(java.util.Locale.ROOT), player); // Spigot this.playersByName.put(player.getScoreboardName().toLowerCase(java.util.Locale.ROOT), player); // Spigot
this.playersByUUID.put(player.getUUID(), player); this.playersByUUID.put(player.getUUID(), player);
@ -58,3 +58,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
player.sentListPacket = true; player.sentListPacket = true;
player.supressTrackerForLogin = false; // Paper player.supressTrackerForLogin = false; // Paper
((ServerLevel)player.level).getChunkSource().chunkMap.addEntity(player); // Paper - track entity now ((ServerLevel)player.level).getChunkSource().chunkMap.addEntity(player); // Paper - track entity now
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSources.java b/src/main/java/net/minecraft/world/damagesource/DamageSources.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/damagesource/DamageSources.java
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSources.java
@@ -0,0 +0,0 @@ public class DamageSources {
public DamageSource sonicBoom(Entity attacker) {
return this.source(DamageTypes.SONIC_BOOM, attacker);
}
-
- public DamageSource badRespawnPointExplosion(Vec3 position) {
- return new DamageSource(this.damageTypes.getHolderOrThrow(DamageTypes.BAD_RESPAWN_POINT), position);
- }
}

View file

@ -1,125 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Fri, 22 Oct 2021 16:25:07 -0700
Subject: [PATCH] Add exploded block state to BlockExplodeEvent
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
@@ -0,0 +0,0 @@ public class DamageSource {
return this;
}
// Paper end
+ public @Nullable org.bukkit.block.BlockState explodedBlockState; // Paper - add exploded state
public static DamageSource fallingBlock(Entity attacker) {
return (new EntityDamageSource("fallingBlock", attacker)).damageHelmet();
@@ -0,0 +0,0 @@ public class DamageSource {
return (new EntityDamageSource("sonic_boom", attacker)).bypassArmor().bypassEnchantments().setMagic();
}
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
public static DamageSource badRespawnPointExplosion(Vec3 pos) {
- return new BadRespawnPointDamage(pos);
+ // Paper start
+ return badRespawnPointExplosion(pos, null);
+ }
+ public static DamageSource badRespawnPointExplosion(Vec3 pos, @Nullable org.bukkit.block.BlockState explodedBlockState) {
+ DamageSource source = new BadRespawnPointDamage(pos);
+ source.explodedBlockState = explodedBlockState;
+ return source;
+ // Paper end
}
public String toString() {
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -0,0 +0,0 @@ public class Explosion {
bukkitBlocks = event.blockList();
yield = event.getYield();
} else {
- BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F); // Paper - fix explosion yield with new gamerules
+ BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F, this.damageSource.explodedBlockState); // Paper - fix explosion yield with new gamerules & exploded block state
this.level.getCraftServer().getPluginManager().callEvent(event);
cancelled = event.isCancelled();
bukkitBlocks = event.blockList();
diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
@@ -0,0 +0,0 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
// CraftBukkit - moved world and biome check into EntityHuman
if (false && !BedBlock.canSetSpawn(world)) {
+ final org.bukkit.block.BlockState explodedBlockState = org.bukkit.craftbukkit.block.CraftBlockStates.getUnplacedBlockState(world, pos, state); // Paper - exploded block state (this won't be called due to the false, but it's good for reference)
world.removeBlock(pos, false);
BlockPos blockposition1 = pos.relative(((Direction) state.getValue(BedBlock.FACING)).getOpposite());
@@ -0,0 +0,0 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
Vec3 vec3d = pos.getCenter();
- world.explode((Entity) null, DamageSource.badRespawnPointExplosion(vec3d), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK);
+ world.explode((Entity) null, DamageSource.badRespawnPointExplosion(vec3d, explodedBlockState), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK); // Paper - exploded block state
return InteractionResult.SUCCESS;
} else if ((Boolean) state.getValue(BedBlock.OCCUPIED)) {
if (!this.kickVillagerOutOfBed(world, pos)) {
@@ -0,0 +0,0 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
private InteractionResult explodeBed(BlockState iblockdata, Level world, BlockPos blockposition) {
{
{
+ final org.bukkit.block.BlockState explodedBlockState = org.bukkit.craftbukkit.block.CraftBlockStates.getUnplacedBlockState(world, blockposition, iblockdata); // Paper - exploded block state
world.removeBlock(blockposition, false);
BlockPos blockposition1 = blockposition.relative(((Direction) iblockdata.getValue(BedBlock.FACING)).getOpposite());
@@ -0,0 +0,0 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
Vec3 vec3d = blockposition.getCenter();
- world.explode((Entity) null, DamageSource.badRespawnPointExplosion(vec3d), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK);
+ world.explode((Entity) null, DamageSource.badRespawnPointExplosion(vec3d, explodedBlockState), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK); // Paper - exploded block state
return InteractionResult.SUCCESS;
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
@@ -0,0 +0,0 @@ public class RespawnAnchorBlock extends Block {
}
private void explode(BlockState state, Level world, final BlockPos explodedPos) {
+ final org.bukkit.block.BlockState explodedBlockState = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(explodedPos, state, null); // Paper - exploded block state
world.removeBlock(explodedPos, false);
boolean bl = Direction.Plane.HORIZONTAL.stream().map(explodedPos::relative).anyMatch((pos) -> {
return isWaterThatWouldFlow(pos, world);
@@ -0,0 +0,0 @@ public class RespawnAnchorBlock extends Block {
}
};
Vec3 vec3 = explodedPos.getCenter();
- world.explode((Entity)null, DamageSource.badRespawnPointExplosion(vec3), explosionDamageCalculator, vec3, 5.0F, true, Level.ExplosionInteraction.BLOCK);
+ world.explode((Entity)null, DamageSource.badRespawnPointExplosion(vec3, explodedBlockState), explosionDamageCalculator, vec3, 5.0F, true, Level.ExplosionInteraction.BLOCK); // Paper - exploded block state
}
public static boolean canSetSpawn(Level world) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
@@ -0,0 +0,0 @@ public final class CraftBlockStates {
BlockEntity tileEntity = (blockEntityTag == null) ? null : BlockEntity.loadStatic(blockPosition, blockData, blockEntityTag);
return CraftBlockStates.getBlockState(null, blockPosition, blockData, tileEntity);
}
+ // Paper start
+ public static BlockState getUnplacedBlockState(net.minecraft.world.level.BlockGetter levelAccessor, BlockPos blockPos, net.minecraft.world.level.block.state.BlockState blockData) {
+ BlockEntity tileEntity = levelAccessor.getBlockEntity(blockPos);
+ return CraftBlockStates.getBlockState(null, blockPos, blockData, tileEntity);
+ }
+ // Paper end
// See BlockStateFactory#createBlockState(World, BlockPosition, IBlockData, TileEntity)
private static CraftBlockState getBlockState(World world, BlockPos blockPosition, net.minecraft.world.level.block.state.BlockState blockData, BlockEntity tileEntity) {

View file

@ -1,26 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 14 Dec 2022 17:46:27 -0800
Subject: [PATCH] Fix explosion yield with new gamerules
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -0,0 +0,0 @@ public class Explosion {
float yield;
if (explode != null) {
- EntityExplodeEvent event = new EntityExplodeEvent(explode, location, blockList, this.blockInteraction == Explosion.BlockInteraction.DESTROY ? 1.0F / this.radius : 1.0F);
+ EntityExplodeEvent event = new EntityExplodeEvent(explode, location, blockList, this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F); // Paper - fix explosion yield with new gamerules
this.level.getCraftServer().getPluginManager().callEvent(event);
cancelled = event.isCancelled();
bukkitBlocks = event.blockList();
yield = event.getYield();
} else {
- BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, this.blockInteraction == Explosion.BlockInteraction.DESTROY ? 1.0F / this.radius : 1.0F);
+ BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F); // Paper - fix explosion yield with new gamerules
this.level.getCraftServer().getPluginManager().callEvent(event);
cancelled = event.isCancelled();
bukkitBlocks = event.blockList();