Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
readd exploded block state patch
Dieser Commit ist enthalten in:
Ursprung
c225146bc9
Commit
3e54639d9c
@ -41,28 +41,6 @@ index 0612eef6d9a9cda81a8d761be2b5e9b094388270..77bf6865c6df829c5b5455d440cb2222
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/util/ExtraCodecs.java b/src/main/java/net/minecraft/util/ExtraCodecs.java
|
||||
index cf64c2bed790da41a2e524e75d60a069765f035a..6dede9fb8ce33e6f7a6a6d06789d9638ce8c579d 100644
|
||||
--- a/src/main/java/net/minecraft/util/ExtraCodecs.java
|
||||
+++ b/src/main/java/net/minecraft/util/ExtraCodecs.java
|
||||
@@ -259,7 +259,7 @@ public class ExtraCodecs {
|
||||
Optional<Pair<A, T>> optional = dataResult.resultOrPartial(mutableObject::setValue);
|
||||
return optional.isPresent() ? dataResult : DataResult.error(() -> {
|
||||
return "(" + (String)mutableObject.getValue() + " -> using default)";
|
||||
- }, Pair.of(object, object));
|
||||
+ }, Pair.of(object, objectx)); // Paper - remapping fix
|
||||
}
|
||||
|
||||
public <T> DataResult<T> coApply(DynamicOps<T> dynamicOps, A objectx, DataResult<T> dataResult) {
|
||||
@@ -542,7 +542,7 @@ public class ExtraCodecs {
|
||||
|
||||
static record LazyInitializedCodec<A>(Supplier<Codec<A>> delegate) implements Codec<A> {
|
||||
LazyInitializedCodec {
|
||||
- supplier = Suppliers.memoize(supplier::get);
|
||||
+ delegate = Suppliers.memoize(delegate::get); // Paper - remapping fix
|
||||
}
|
||||
|
||||
public <T> DataResult<Pair<A, T>> decode(DynamicOps<T> dynamicOps, T object) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java
|
||||
index 1206ca32cadb98573938328f611b67162c700d84..d81f7eecb8204a974da14a75d1a7a23a6c071112 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java
|
||||
|
@ -119,19 +119,6 @@ index 2f66abf62d303342f5fe614fb3e35e7844497ffc..b346fa94b23d81da7da073f71dd12e67
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/util/ExtraCodecs.java b/src/main/java/net/minecraft/util/ExtraCodecs.java
|
||||
index 6dede9fb8ce33e6f7a6a6d06789d9638ce8c579d..128353b6cad685689403bd1757cc9cc7cc1091d1 100644
|
||||
--- a/src/main/java/net/minecraft/util/ExtraCodecs.java
|
||||
+++ b/src/main/java/net/minecraft/util/ExtraCodecs.java
|
||||
@@ -227,7 +227,7 @@ public class ExtraCodecs {
|
||||
}, (pair) -> {
|
||||
return ImmutableList.of(leftFunction.apply(pair), rightFunction.apply(pair));
|
||||
});
|
||||
- Codec<I> codec3 = RecordCodecBuilder.<Pair>create((instance) -> {
|
||||
+ Codec<I> codec3 = RecordCodecBuilder.<Pair<P, P>>create((instance) -> { // Paper - decompile fix
|
||||
return instance.group(codec.fieldOf(leftFieldName).forGetter(Pair::getFirst), codec.fieldOf(rightFieldName).forGetter(Pair::getSecond)).apply(instance, Pair::of);
|
||||
}).comapFlatMap((pair) -> {
|
||||
return combineFunction.apply((P)pair.getFirst(), (P)pair.getSecond());
|
||||
diff --git a/src/main/java/net/minecraft/util/SortedArraySet.java b/src/main/java/net/minecraft/util/SortedArraySet.java
|
||||
index 2dc801061025888192c3bf2c4c38b928c16a0165..ca788f0dcec4a117b410fe8348969e056b138b1e 100644
|
||||
--- a/src/main/java/net/minecraft/util/SortedArraySet.java
|
||||
|
@ -2570,22 +2570,6 @@ index 6529064505dc3de875be1764f88897736b85975d..d19d1f1595a226ce0472be5e2efafbc0
|
||||
return message.hasSignature() && !message.hasExpiredServer(Instant.now());
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/util/ExtraCodecs.java b/src/main/java/net/minecraft/util/ExtraCodecs.java
|
||||
index 128353b6cad685689403bd1757cc9cc7cc1091d1..b08a2a6d0f19322ced405ab51d98124f9cb2887c 100644
|
||||
--- a/src/main/java/net/minecraft/util/ExtraCodecs.java
|
||||
+++ b/src/main/java/net/minecraft/util/ExtraCodecs.java
|
||||
@@ -68,6 +68,11 @@ public class ExtraCodecs {
|
||||
}
|
||||
}, (text) -> {
|
||||
try {
|
||||
+ // Paper start
|
||||
+ if (text instanceof io.papermc.paper.adventure.AdventureComponent adventureComponent) {
|
||||
+ return DataResult.success(net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson().serializeToTree(adventureComponent.adventure$component()));
|
||||
+ }
|
||||
+ // Paper end
|
||||
return DataResult.success(Component.Serializer.toJsonTree(text));
|
||||
} catch (IllegalArgumentException var2) {
|
||||
return DataResult.error(var2::getMessage);
|
||||
diff --git a/src/main/java/net/minecraft/world/BossEvent.java b/src/main/java/net/minecraft/world/BossEvent.java
|
||||
index 4c62df5a3781ec9df4a5c5f1b528649e6e8a62d1..affd1b8c7589ba59330dc0b6fc803cce4ee57397 100644
|
||||
--- a/src/main/java/net/minecraft/world/BossEvent.java
|
||||
|
@ -5,53 +5,57 @@ 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 8795c94e6b6474addddbb0b337a962e8fac46b2b..2848cb7c76e94d8349f042dc92daf01322a6ce5a 100644
|
||||
index 72d62387bfdcbf8e69fe433145be81fbe3bb051a..93a1e990b0a6caae4143c2f9d09bfb368fa1d6db 100644
|
||||
--- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java
|
||||
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
|
||||
@@ -74,6 +74,7 @@ public class DamageSource {
|
||||
@@ -52,6 +52,7 @@ public class DamageSource {
|
||||
return this;
|
||||
}
|
||||
// Paper end
|
||||
// CraftBukkit end
|
||||
+ public @Nullable org.bukkit.block.BlockState explodedBlockState; // Paper - add exploded state
|
||||
|
||||
public static DamageSource fallingBlock(Entity attacker) {
|
||||
return (new EntityDamageSource("fallingBlock", attacker)).damageHelmet();
|
||||
@@ -147,8 +148,16 @@ public class DamageSource {
|
||||
return (new EntityDamageSource("sonic_boom", attacker)).bypassArmor().bypassEnchantments().setMagic();
|
||||
public String toString() {
|
||||
return "DamageSource (" + this.type().msgId() + ")";
|
||||
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSources.java b/src/main/java/net/minecraft/world/damagesource/DamageSources.java
|
||||
index 6d46908692637ace5d81a9948f5ed42e142f549a..d3d9bb2cdcaa3d671370ee3014341fe741275743 100644
|
||||
--- a/src/main/java/net/minecraft/world/damagesource/DamageSources.java
|
||||
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSources.java
|
||||
@@ -243,7 +243,16 @@ public class DamageSources {
|
||||
return this.source(DamageTypes.SONIC_BOOM, attacker);
|
||||
}
|
||||
|
||||
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
|
||||
public static DamageSource badRespawnPointExplosion(Vec3 pos) {
|
||||
- return new BadRespawnPointDamage(pos);
|
||||
public DamageSource badRespawnPointExplosion(Vec3 position) {
|
||||
- return new DamageSource(this.damageTypes.getHolderOrThrow(DamageTypes.BAD_RESPAWN_POINT), position);
|
||||
+ // Paper start
|
||||
+ return badRespawnPointExplosion(pos, null);
|
||||
+ return this.badRespawnPointExplosion(position, null);
|
||||
+ }
|
||||
+ public static DamageSource badRespawnPointExplosion(Vec3 pos, @Nullable org.bukkit.block.BlockState explodedBlockState) {
|
||||
+ DamageSource source = new BadRespawnPointDamage(pos);
|
||||
+
|
||||
+ public DamageSource badRespawnPointExplosion(Vec3 position, @Nullable org.bukkit.block.BlockState explodedBlockState) {
|
||||
+ DamageSource source = new DamageSource(this.damageTypes.getHolderOrThrow(DamageTypes.BAD_RESPAWN_POINT), position);
|
||||
+ 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 4a7733c259d75bf2b3ea559fd4eba398bc56195d..5ef6b5ad4dd69a57595914c7af8422ee2f6ad054 100644
|
||||
index ff2ea0ae47fb6e083cf7dbb992d59416067b5c7d..59837144c2c0460aca6e8c349eb3d6528111d1dc 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -334,7 +334,7 @@ public class Explosion {
|
||||
@@ -343,7 +343,7 @@ 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
|
||||
- BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 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, this.damageSource.explodedBlockState); // Paper - 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 f1a7c5202d4efbfaf5d88609d243f25f6817ecbe..64e68bf6decc765274caaabfd34a5b2d7d82434c 100644
|
||||
index 002575ac14697572602e3f622b7ed1c93eca04c3..96434f14525a2159f335b94aad95081f488fadf3 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
||||
@@ -88,6 +88,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
|
||||
@@ -87,6 +87,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
|
||||
|
||||
// CraftBukkit - moved world and biome check into EntityHuman
|
||||
if (false && !BedBlock.canSetSpawn(world)) {
|
||||
@ -59,16 +63,16 @@ index f1a7c5202d4efbfaf5d88609d243f25f6817ecbe..64e68bf6decc765274caaabfd34a5b2d
|
||||
world.removeBlock(pos, false);
|
||||
BlockPos blockposition1 = pos.relative(((Direction) state.getValue(BedBlock.FACING)).getOpposite());
|
||||
|
||||
@@ -97,7 +98,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
|
||||
@@ -96,7 +97,7 @@ 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
|
||||
- world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK);
|
||||
+ world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, explodedBlockState), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK);
|
||||
return InteractionResult.SUCCESS;
|
||||
} else if ((Boolean) state.getValue(BedBlock.OCCUPIED)) {
|
||||
if (!this.kickVillagerOutOfBed(world, pos)) {
|
||||
@@ -139,6 +140,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
|
||||
@@ -138,6 +139,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
|
||||
private InteractionResult explodeBed(BlockState iblockdata, Level world, BlockPos blockposition) {
|
||||
{
|
||||
{
|
||||
@ -76,20 +80,20 @@ index f1a7c5202d4efbfaf5d88609d243f25f6817ecbe..64e68bf6decc765274caaabfd34a5b2d
|
||||
world.removeBlock(blockposition, false);
|
||||
BlockPos blockposition1 = blockposition.relative(((Direction) iblockdata.getValue(BedBlock.FACING)).getOpposite());
|
||||
|
||||
@@ -148,7 +150,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
|
||||
@@ -147,7 +149,7 @@ 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
|
||||
- world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK);
|
||||
+ world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, explodedBlockState), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, Level.ExplosionInteraction.BLOCK);
|
||||
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 53b35f003034e7f4c9dd8ccfaf77389163009453..1b7140ffab0492ab130743a2d158b30efb2cfece 100644
|
||||
index 16f23ecffa52925904d585f3fed76aa61bac5f9d..bcea8af63b9911c36873290e5c34567b1eeaacf4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||
@@ -113,6 +113,7 @@ public class RespawnAnchorBlock extends Block {
|
||||
@@ -114,6 +114,7 @@ public class RespawnAnchorBlock extends Block {
|
||||
}
|
||||
|
||||
private void explode(BlockState state, Level world, final BlockPos explodedPos) {
|
||||
@ -97,20 +101,20 @@ index 53b35f003034e7f4c9dd8ccfaf77389163009453..1b7140ffab0492ab130743a2d158b30e
|
||||
world.removeBlock(explodedPos, false);
|
||||
boolean bl = Direction.Plane.HORIZONTAL.stream().map(explodedPos::relative).anyMatch((pos) -> {
|
||||
return isWaterThatWouldFlow(pos, world);
|
||||
@@ -125,7 +126,7 @@ public class RespawnAnchorBlock extends Block {
|
||||
@@ -126,7 +127,7 @@ 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
|
||||
- world.explode((Entity)null, world.damageSources().badRespawnPointExplosion(vec3), explosionDamageCalculator, vec3, 5.0F, true, Level.ExplosionInteraction.BLOCK);
|
||||
+ world.explode((Entity)null, world.damageSources().badRespawnPointExplosion(vec3, explodedBlockState), explosionDamageCalculator, vec3, 5.0F, true, Level.ExplosionInteraction.BLOCK);
|
||||
}
|
||||
|
||||
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 d3f66bc8c9fa18322bd025fac2793456a5200717..4d6f2b9b063b4b5accfe9fe1e6c230f114451d23 100644
|
||||
index 1caa329567b50a962c54bb00c79cc98e4f2724c8..9215297d5f7856ef3f03ebcbf866c5b59048ba30 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
|
||||
@@ -267,6 +267,12 @@ public final class CraftBlockStates {
|
||||
@@ -271,6 +271,12 @@ public final class CraftBlockStates {
|
||||
BlockEntity tileEntity = (blockEntityTag == null) ? null : BlockEntity.loadStatic(blockPosition, blockData, blockEntityTag);
|
||||
return CraftBlockStates.getBlockState(null, blockPosition, blockData, tileEntity);
|
||||
}
|
@ -22,7 +22,7 @@ This patch corrects this behaviour by only shrinking the item if a totem
|
||||
of undying was found and the event was called uncancelled.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 24bcbe515dac7f6cab28a4148afb23d1f44be94b..6ed2bd15b9f69b58f02034a8679912b608555b61 100644
|
||||
index ee859b78121fe80bfd7858c49d41d8770b204801..9358a2112952f0a90b058a7078b3577b5a56f76b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1543,7 +1543,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@ -7,7 +7,7 @@ Subject: [PATCH] Win Screen API
|
||||
public net.minecraft.server.level.ServerPlayer seenCredits
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 974509844a004690f52b751f23dd1159bfa23b62..d7df13dcbf45b46f31f7e3a85ba38d9f57e5d583 100644
|
||||
index ec7a028f36cb4d116c1ff63d34d3d69dfe063f14..eca5e6b93dd84307bf9dbadf32414d6f506e69dc 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1208,6 +1208,25 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add Entity Body Yaw API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index 62b5df7e3bcf1037d96897b41f25038c535515d5..bc3d3dc4e2efb54896233fd0a4aa140972cb02f6 100644
|
||||
index a77f626f79db9a10367bcd51ae946f93fea6ee69..aec588b41f19b2147a4e7267bafa417fbcf7abc0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -1034,6 +1034,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren