Add EntityEquipment API. Adds BUKKIT-3103
Adds: - Getting/Setting equipment - getting/setting drop rates - getting/setting ability to pick up items -- As an added feature, players with this flag start off with a canceled PlayerPickupItemEvent
This commit is contained in:
@@ -370,6 +370,7 @@ public class EntityArrow extends Entity implements IProjectile {
|
||||
EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
|
||||
|
||||
PlayerPickupItemEvent event = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.world.getServer(), this, item), 0);
|
||||
event.setCancelled(!entityhuman.canPickUpLoot);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
|
||||
@@ -204,6 +204,7 @@ public class EntityItem extends Entity {
|
||||
if (this.pickupDelay <= 0 && canHold > 0) {
|
||||
this.itemStack.count = canHold;
|
||||
PlayerPickupItemEvent event = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
|
||||
event.setCancelled(!entityhuman.canPickUpLoot);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
this.itemStack.count = canHold + remaining;
|
||||
|
||||
|
||||
@@ -82,11 +82,11 @@ public abstract class EntityLiving extends Entity {
|
||||
private ChunkCoordinates bP = new ChunkCoordinates(0, 0, 0);
|
||||
private float bQ = -1.0F;
|
||||
private ItemStack[] equipment = new ItemStack[5];
|
||||
protected float[] dropChances = new float[5];
|
||||
public float[] dropChances = new float[5]; // CraftBukkit - protected -> public
|
||||
private ItemStack[] bS = new ItemStack[5];
|
||||
public boolean bp = false;
|
||||
public int bq = 0;
|
||||
protected boolean canPickUpLoot = false;
|
||||
public boolean canPickUpLoot = false; // CraftBukkit - protected -> public
|
||||
public boolean persistent = !this.bj(); // CraftBukkit - private -> public, change value
|
||||
protected int bs;
|
||||
protected double bt;
|
||||
|
||||
Reference in New Issue
Block a user