SPIGOT-7300, #1180: Add new DamageSource API providing enhanced information about entity damage
By: Doc <nachito94@msn.com>
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
public class EntityEnderPearl extends EntityProjectileThrowable {
|
||||
|
||||
public EntityEnderPearl(EntityTypes<? extends EntityEnderPearl> entitytypes, World world) {
|
||||
@@ -54,23 +61,36 @@
|
||||
@@ -54,23 +61,34 @@
|
||||
EntityPlayer entityplayer = (EntityPlayer) entity;
|
||||
|
||||
if (entityplayer.connection.isAcceptingMessages() && entityplayer.level() == this.level() && !entityplayer.isSleeping()) {
|
||||
@@ -56,15 +56,13 @@
|
||||
- entity.hurt(this.damageSources().fall(), 5.0F);
|
||||
+ entityplayer.connection.teleport(teleEvent.getTo());
|
||||
+ entity.resetFallDistance();
|
||||
+ CraftEventFactory.entityDamage = this;
|
||||
+ entity.hurt(this.damageSources().fall(), 5.0F);
|
||||
+ CraftEventFactory.entityDamage = null;
|
||||
+ entity.hurt(this.damageSources().fall().customCausingEntity(this), 5.0F); // CraftBukkit
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level().playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), SoundEffects.PLAYER_TELEPORT, SoundCategory.PLAYERS);
|
||||
}
|
||||
} else if (entity != null) {
|
||||
@@ -100,7 +120,7 @@
|
||||
@@ -100,7 +118,7 @@
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
Entity entity = this.getOwner();
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
|
||||
@@ -129,7 +129,9 @@
|
||||
@@ -129,7 +129,7 @@
|
||||
|
||||
if (entityliving.isAlive() && !entityliving.isInvulnerable() && entityliving != entityliving1) {
|
||||
if (entityliving1 == null) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = this; // CraftBukkit
|
||||
entityliving.hurt(this.damageSources().magic(), 6.0F);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = null; // CraftBukkit
|
||||
- entityliving.hurt(this.damageSources().magic(), 6.0F);
|
||||
+ entityliving.hurt(this.damageSources().magic().customCausingEntity(this), 6.0F); // CraftBukkit
|
||||
} else {
|
||||
if (entityliving1.isAlliedTo((Entity) entityliving)) {
|
||||
return;
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/projectile/EntityFireworks.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityFireworks.java
|
||||
@@ -28,6 +28,8 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
+
|
||||
public class EntityFireworks extends IProjectile implements ItemSupplier {
|
||||
|
||||
public static final DataWatcherObject<ItemStack> DATA_ID_FIREWORKS_ITEM = DataWatcher.defineId(EntityFireworks.class, DataWatcherRegistry.ITEM_STACK);
|
||||
@@ -143,7 +145,7 @@
|
||||
@@ -143,7 +143,7 @@
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity);
|
||||
|
||||
if (!this.noPhysics) {
|
||||
@@ -18,7 +9,7 @@
|
||||
this.hasImpulse = true;
|
||||
}
|
||||
|
||||
@@ -158,7 +160,11 @@
|
||||
@@ -158,7 +158,11 @@
|
||||
}
|
||||
|
||||
if (!this.level().isClientSide && this.life > this.lifetime) {
|
||||
@@ -31,7 +22,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -174,7 +180,11 @@
|
||||
@@ -174,7 +178,11 @@
|
||||
protected void onHitEntity(MovingObjectPositionEntity movingobjectpositionentity) {
|
||||
super.onHitEntity(movingobjectpositionentity);
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -44,7 +35,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +194,11 @@
|
||||
@@ -184,7 +192,11 @@
|
||||
|
||||
this.level().getBlockState(blockposition).entityInside(this.level(), blockposition, this);
|
||||
if (!this.level().isClientSide() && this.hasExplosion()) {
|
||||
@@ -57,23 +48,3 @@
|
||||
}
|
||||
|
||||
super.onHitBlock(movingobjectpositionblock);
|
||||
@@ -210,7 +224,9 @@
|
||||
|
||||
if (f > 0.0F) {
|
||||
if (this.attachedToEntity != null) {
|
||||
+ CraftEventFactory.entityDamage = this; // CraftBukkit
|
||||
this.attachedToEntity.hurt(this.damageSources().fireworks(this, this.getOwner()), 5.0F + (float) (nbttaglist.size() * 2));
|
||||
+ CraftEventFactory.entityDamage = null; // CraftBukkit
|
||||
}
|
||||
|
||||
double d0 = 5.0D;
|
||||
@@ -237,7 +253,9 @@
|
||||
if (flag) {
|
||||
float f1 = f * (float) Math.sqrt((5.0D - (double) this.distanceTo(entityliving)) / 5.0D);
|
||||
|
||||
+ CraftEventFactory.entityDamage = this; // CraftBukkit
|
||||
entityliving.hurt(this.damageSources().fireworks(this, this.getOwner()), f1);
|
||||
+ CraftEventFactory.entityDamage = null; // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user