net.minecraft.world.damagesource
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/world/damagesource/DamageSource.java
|
--- a/net/minecraft/world/damagesource/DamageSource.java
|
||||||
+++ b/net/minecraft/world/damagesource/DamageSource.java
|
+++ b/net/minecraft/world/damagesource/DamageSource.java
|
||||||
@@ -21,7 +21,106 @@
|
@@ -20,6 +_,105 @@
|
||||||
private final Entity directEntity;
|
private final Entity directEntity;
|
||||||
@Nullable
|
@Nullable
|
||||||
private final Vec3 damageSourcePosition;
|
private final Vec3 damageSourcePosition;
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
+ private boolean poison = false;
|
+ private boolean poison = false;
|
||||||
+ @Nullable
|
+ @Nullable
|
||||||
+ private Entity customEventDamager = null; // This field is a helper for when causing entity damage is not set by vanilla // Paper - fix DamageSource API
|
+ private Entity customEventDamager = null; // This field is a helper for when causing entity damage is not set by vanilla // Paper - fix DamageSource API
|
||||||
|
+
|
||||||
+ public DamageSource sweep() {
|
+ public DamageSource sweep() {
|
||||||
+ this.sweep = true;
|
+ this.sweep = true;
|
||||||
+ return this;
|
+ return this;
|
||||||
@@ -103,11 +103,10 @@
|
|||||||
+ return damageSource;
|
+ return damageSource;
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "DamageSource (" + this.type().msgId() + ")";
|
@@ -134,4 +_,18 @@
|
||||||
}
|
|
||||||
@@ -163,4 +262,18 @@
|
|
||||||
public Holder<DamageType> typeHolder() {
|
public Holder<DamageType> typeHolder() {
|
||||||
return this.type;
|
return this.type;
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/world/damagesource/DamageSources.java
|
--- a/net/minecraft/world/damagesource/DamageSources.java
|
||||||
+++ b/net/minecraft/world/damagesource/DamageSources.java
|
+++ b/net/minecraft/world/damagesource/DamageSources.java
|
||||||
@@ -43,9 +43,15 @@
|
@@ -42,9 +_,15 @@
|
||||||
private final DamageSource stalagmite;
|
private final DamageSource stalagmite;
|
||||||
private final DamageSource outsideBorder;
|
private final DamageSource outsideBorder;
|
||||||
private final DamageSource genericKill;
|
private final DamageSource genericKill;
|
||||||
@@ -8,20 +8,18 @@
|
|||||||
+ private final DamageSource melting;
|
+ private final DamageSource melting;
|
||||||
+ private final DamageSource poison;
|
+ private final DamageSource poison;
|
||||||
|
|
||||||
public DamageSources(RegistryAccess registryManager) {
|
public DamageSources(RegistryAccess registry) {
|
||||||
this.damageTypes = registryManager.lookupOrThrow(Registries.DAMAGE_TYPE);
|
this.damageTypes = registry.lookupOrThrow(Registries.DAMAGE_TYPE);
|
||||||
+ this.melting = this.source(DamageTypes.ON_FIRE).melting();
|
+ this.melting = this.source(DamageTypes.ON_FIRE).melting();
|
||||||
+ this.poison = this.source(DamageTypes.MAGIC).poison();
|
+ this.poison = this.source(DamageTypes.MAGIC).poison();
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
this.inFire = this.source(DamageTypes.IN_FIRE);
|
this.inFire = this.source(DamageTypes.IN_FIRE);
|
||||||
this.campfire = this.source(DamageTypes.CAMPFIRE);
|
this.campfire = this.source(DamageTypes.CAMPFIRE);
|
||||||
this.lightningBolt = this.source(DamageTypes.LIGHTNING_BOLT);
|
this.lightningBolt = this.source(DamageTypes.LIGHTNING_BOLT);
|
||||||
@@ -83,7 +89,17 @@
|
@@ -84,6 +_,16 @@
|
||||||
|
return new DamageSource(this.damageTypes.getOrThrow(damageTypeKey), causingEntity, directEntity);
|
||||||
|
}
|
||||||
|
|
||||||
private DamageSource source(ResourceKey<DamageType> key, @Nullable Entity source, @Nullable Entity attacker) {
|
|
||||||
return new DamageSource(this.damageTypes.getOrThrow(key), source, attacker);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ public DamageSource melting() {
|
+ public DamageSource melting() {
|
||||||
+ return this.melting;
|
+ return this.melting;
|
||||||
@@ -29,34 +27,24 @@
|
|||||||
+
|
+
|
||||||
+ public DamageSource poison() {
|
+ public DamageSource poison() {
|
||||||
+ return this.poison;
|
+ return this.poison;
|
||||||
}
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
|
+
|
||||||
public DamageSource inFire() {
|
public DamageSource inFire() {
|
||||||
return this.inFire;
|
return this.inFire;
|
||||||
@@ -254,7 +270,7 @@
|
|
||||||
}
|
}
|
||||||
|
@@ -261,7 +_,13 @@
|
||||||
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) {
|
public DamageSource badRespawnPointExplosion(Vec3 position) {
|
||||||
- return new DamageSource(this.damageTypes.getOrThrow(DamageTypes.BAD_RESPAWN_POINT), position);
|
- return new DamageSource(this.damageTypes.getOrThrow(DamageTypes.BAD_RESPAWN_POINT), position);
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ return this.badRespawnPointExplosion(position, null);
|
+ return this.badRespawnPointExplosion(position, null);
|
||||||
}
|
+ }
|
||||||
|
+
|
||||||
+ public DamageSource badRespawnPointExplosion(Vec3 vec3d, org.bukkit.block.BlockState blockState) {
|
+ public DamageSource badRespawnPointExplosion(Vec3 vec3d, org.bukkit.block.BlockState blockState) {
|
||||||
+ return new DamageSource(this.damageTypes.getOrThrow(DamageTypes.BAD_RESPAWN_POINT), vec3d).directBlockState(blockState);
|
+ return new DamageSource(this.damageTypes.getOrThrow(DamageTypes.BAD_RESPAWN_POINT), vec3d).directBlockState(blockState);
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+ }
|
|
||||||
+
|
|
||||||
public DamageSource outOfBorder() {
|
|
||||||
return this.outsideBorder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DamageSource outOfBorder() {
|
||||||
Reference in New Issue
Block a user