2023-03-14 17:30:00 +01:00
|
|
|
--- a/net/minecraft/world/damagesource/DamageSources.java
|
|
|
|
+++ b/net/minecraft/world/damagesource/DamageSources.java
|
2024-10-22 17:15:00 +02:00
|
|
|
@@ -43,9 +43,15 @@
|
2023-03-14 17:30:00 +01:00
|
|
|
private final DamageSource stalagmite;
|
2023-06-07 17:30:00 +02:00
|
|
|
private final DamageSource outsideBorder;
|
|
|
|
private final DamageSource genericKill;
|
2023-03-14 17:30:00 +01:00
|
|
|
+ // CraftBukkit start
|
2024-02-10 23:54:25 +01:00
|
|
|
+ private final DamageSource melting;
|
|
|
|
+ private final DamageSource poison;
|
2023-03-14 17:30:00 +01:00
|
|
|
|
2024-12-11 22:26:55 +01:00
|
|
|
public DamageSources(RegistryAccess registryManager) {
|
|
|
|
this.damageTypes = registryManager.lookupOrThrow(Registries.DAMAGE_TYPE);
|
2023-03-14 17:30:00 +01:00
|
|
|
+ this.melting = this.source(DamageTypes.ON_FIRE).melting();
|
|
|
|
+ this.poison = this.source(DamageTypes.MAGIC).poison();
|
|
|
|
+ // CraftBukkit end
|
|
|
|
this.inFire = this.source(DamageTypes.IN_FIRE);
|
2024-06-13 17:05:00 +02:00
|
|
|
this.campfire = this.source(DamageTypes.CAMPFIRE);
|
2023-03-14 17:30:00 +01:00
|
|
|
this.lightningBolt = this.source(DamageTypes.LIGHTNING_BOLT);
|
2024-12-11 22:26:55 +01:00
|
|
|
@@ -84,6 +90,16 @@
|
|
|
|
private DamageSource source(ResourceKey<DamageType> key, @Nullable Entity source, @Nullable Entity attacker) {
|
|
|
|
return new DamageSource(this.damageTypes.getOrThrow(key), source, attacker);
|
2024-02-10 23:54:25 +01:00
|
|
|
}
|
2024-12-11 22:26:55 +01:00
|
|
|
+
|
2024-02-10 23:54:25 +01:00
|
|
|
+ // CraftBukkit start
|
|
|
|
+ public DamageSource melting() {
|
|
|
|
+ return this.melting;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public DamageSource poison() {
|
|
|
|
+ return this.poison;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2024-12-11 22:26:55 +01:00
|
|
|
|
2024-02-10 23:54:25 +01:00
|
|
|
public DamageSource inFire() {
|
|
|
|
return this.inFire;
|
2024-12-11 22:26:55 +01:00
|
|
|
@@ -254,17 +270,29 @@
|
2024-05-04 00:15:51 +02:00
|
|
|
}
|
|
|
|
|
2024-12-11 22:26:55 +01:00
|
|
|
public DamageSource explosion(@Nullable Entity source, @Nullable Entity attacker) {
|
|
|
|
- return this.source(attacker != null && source != null ? DamageTypes.PLAYER_EXPLOSION : DamageTypes.EXPLOSION, source, attacker);
|
2024-05-04 00:15:51 +02:00
|
|
|
+ // CraftBukkit start
|
2024-12-11 22:26:55 +01:00
|
|
|
+ return this.explosion(source, attacker, attacker != null && source != null ? DamageTypes.PLAYER_EXPLOSION : DamageTypes.EXPLOSION);
|
|
|
|
}
|
|
|
|
|
2024-05-04 00:15:51 +02:00
|
|
|
+ public DamageSource explosion(@Nullable Entity entity, @Nullable Entity entity1, ResourceKey<DamageType> resourceKey) {
|
|
|
|
+ return this.source(resourceKey, entity, entity1);
|
|
|
|
+ // CraftBukkit end
|
2024-12-11 22:26:55 +01:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
public DamageSource sonicBoom(Entity attacker) {
|
|
|
|
return this.source(DamageTypes.SONIC_BOOM, attacker);
|
2024-05-04 00:15:51 +02:00
|
|
|
}
|
|
|
|
|
2024-12-11 22:26:55 +01:00
|
|
|
public DamageSource badRespawnPointExplosion(Vec3 position) {
|
|
|
|
- return new DamageSource(this.damageTypes.getOrThrow(DamageTypes.BAD_RESPAWN_POINT), position);
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ return this.badRespawnPointExplosion(position, null);
|
2024-04-29 12:08:56 +02:00
|
|
|
}
|
|
|
|
|
2024-12-11 22:26:55 +01:00
|
|
|
+ public DamageSource badRespawnPointExplosion(Vec3 vec3d, org.bukkit.block.BlockState blockState) {
|
2024-10-22 17:15:00 +02:00
|
|
|
+ return new DamageSource(this.damageTypes.getOrThrow(DamageTypes.BAD_RESPAWN_POINT), vec3d).directBlockState(blockState);
|
2024-04-29 12:08:56 +02:00
|
|
|
+ // CraftBukkit end
|
2024-12-11 22:26:55 +01:00
|
|
|
+ }
|
|
|
|
+
|
2024-04-29 12:08:56 +02:00
|
|
|
public DamageSource outOfBorder() {
|
2024-12-11 22:26:55 +01:00
|
|
|
return this.outsideBorder;
|
|
|
|
}
|