PaperMC/paper-server/patches/unapplied/net/minecraft/world/damagesource/DamageSources.java.patch
2024-12-12 12:30:31 +01:00

62 lines
2.5 KiB
Diff

--- a/net/minecraft/world/damagesource/DamageSources.java
+++ b/net/minecraft/world/damagesource/DamageSources.java
@@ -43,9 +43,15 @@
private final DamageSource stalagmite;
private final DamageSource outsideBorder;
private final DamageSource genericKill;
+ // CraftBukkit start
+ private final DamageSource melting;
+ private final DamageSource poison;
public DamageSources(RegistryAccess registryManager) {
this.damageTypes = registryManager.lookupOrThrow(Registries.DAMAGE_TYPE);
+ this.melting = this.source(DamageTypes.ON_FIRE).melting();
+ this.poison = this.source(DamageTypes.MAGIC).poison();
+ // CraftBukkit end
this.inFire = this.source(DamageTypes.IN_FIRE);
this.campfire = this.source(DamageTypes.CAMPFIRE);
this.lightningBolt = this.source(DamageTypes.LIGHTNING_BOLT);
@@ -83,7 +89,17 @@
private DamageSource source(ResourceKey<DamageType> key, @Nullable Entity source, @Nullable Entity attacker) {
return new DamageSource(this.damageTypes.getOrThrow(key), source, attacker);
+ }
+
+ // CraftBukkit start
+ public DamageSource melting() {
+ return this.melting;
+ }
+
+ public DamageSource poison() {
+ return this.poison;
}
+ // CraftBukkit end
public DamageSource inFire() {
return this.inFire;
@@ -254,7 +270,7 @@
}
public DamageSource explosion(@Nullable Entity source, @Nullable Entity attacker) {
- return this.source(attacker != null && source != null ? DamageTypes.PLAYER_EXPLOSION : DamageTypes.EXPLOSION, source, attacker);
+ return this.source(attacker != null && source != null ? DamageTypes.PLAYER_EXPLOSION : DamageTypes.EXPLOSION, source, attacker); // Paper - revert to vanilla
}
public DamageSource sonicBoom(Entity attacker) {
@@ -262,9 +278,15 @@
}
public DamageSource badRespawnPointExplosion(Vec3 position) {
- return new DamageSource(this.damageTypes.getOrThrow(DamageTypes.BAD_RESPAWN_POINT), position);
+ // CraftBukkit start
+ return this.badRespawnPointExplosion(position, null);
}
+ public DamageSource badRespawnPointExplosion(Vec3 vec3d, org.bukkit.block.BlockState blockState) {
+ return new DamageSource(this.damageTypes.getOrThrow(DamageTypes.BAD_RESPAWN_POINT), vec3d).directBlockState(blockState);
+ // CraftBukkit end
+ }
+
public DamageSource outOfBorder() {
return this.outsideBorder;
}