mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-29 19:33:51 -07:00
[Bleeding] Implement ProjectileSource API. Addresses BUKKIT-1038, BUKKIT-1156
This commit is contained in:
committed by
Nate Mortensen
parent
ac53442e7e
commit
8a5ad89a68
@@ -49,7 +49,10 @@ final class DispenseBehaviorFireball extends DispenseBehaviorItem {
|
||||
}
|
||||
}
|
||||
|
||||
world.addEntity(new EntitySmallFireball(world, d0, d1, d2, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ()));
|
||||
EntitySmallFireball entitysmallfireball = new EntitySmallFireball(world, d0, d1, d2, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
|
||||
entitysmallfireball.projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource((TileEntityDispenser) isourceblock.getTileEntity());
|
||||
|
||||
world.addEntity(entitysmallfireball);
|
||||
// itemstack.a(1); // Handled during event processing
|
||||
// CraftBukkit end
|
||||
|
||||
|
@@ -42,6 +42,7 @@ public abstract class DispenseBehaviorProjectile extends DispenseBehaviorItem {
|
||||
}
|
||||
|
||||
iprojectile.shoot(event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.b(), this.a());
|
||||
((Entity) iprojectile).projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource((TileEntityDispenser) isourceblock.getTileEntity());
|
||||
// CraftBukkit end
|
||||
|
||||
world.addEntity((Entity) iprojectile);
|
||||
|
@@ -109,6 +109,7 @@ public abstract class Entity {
|
||||
public UUID uniqueID; // CraftBukkit - protected -> public
|
||||
public EnumEntitySize at;
|
||||
public boolean valid; // CraftBukkit
|
||||
public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
|
@@ -3,6 +3,7 @@ package net.minecraft.server;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
// CraftBukkit end
|
||||
@@ -41,6 +42,7 @@ public class EntityArrow extends Entity implements IProjectile {
|
||||
super(world);
|
||||
this.k = 10.0D;
|
||||
this.shooter = entityliving;
|
||||
this.projectileSource = (LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit
|
||||
if (entityliving instanceof EntityHuman) {
|
||||
this.fromPlayer = 1;
|
||||
}
|
||||
@@ -69,6 +71,7 @@ public class EntityArrow extends Entity implements IProjectile {
|
||||
super(world);
|
||||
this.k = 10.0D;
|
||||
this.shooter = entityliving;
|
||||
this.projectileSource = (LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit
|
||||
if (entityliving instanceof EntityHuman) {
|
||||
this.fromPlayer = 1;
|
||||
}
|
||||
|
@@ -42,6 +42,7 @@ public abstract class EntityFireball extends Entity {
|
||||
public EntityFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) {
|
||||
super(world);
|
||||
this.shooter = entityliving;
|
||||
this.projectileSource = (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit
|
||||
this.a(1.0F, 1.0F);
|
||||
this.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch);
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
|
@@ -25,6 +25,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
|
||||
public EntityProjectile(World world, EntityLiving entityliving) {
|
||||
super(world);
|
||||
this.shooter = entityliving;
|
||||
this.projectileSource = (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit
|
||||
this.a(0.25F, 0.25F);
|
||||
this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.getHeadHeight(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
|
||||
this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
|
||||
|
Reference in New Issue
Block a user