geforkt von Mirrors/Paper
[Bleeding] Allow CraftItem to be backed by non-EntityItems. Fixes BUKKIT-1351
Dieser Commit ist enthalten in:
Ursprung
bdccfd29ec
Commit
c16bf07e85
@ -3,7 +3,6 @@ package net.minecraft.server;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
||||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||||
@ -215,7 +214,7 @@ public class EntityArrow extends Entity {
|
|||||||
if (movingobjectposition.entity.damageEntity(damagesource, l)) {
|
if (movingobjectposition.entity.damageEntity(damagesource, l)) {
|
||||||
if (this.isBurning() && (!(movingobjectposition.entity instanceof EntityPlayer) || this.world.pvpMode)) { // CraftBukkit - abide by pvp setting if destination is a player.
|
if (this.isBurning() && (!(movingobjectposition.entity instanceof EntityPlayer) || this.world.pvpMode)) { // CraftBukkit - abide by pvp setting if destination is a player.
|
||||||
EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
|
EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
|
||||||
Bukkit.getPluginManager().callEvent(combustEvent);
|
org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
|
||||||
|
|
||||||
if (!combustEvent.isCancelled()) {
|
if (!combustEvent.isCancelled()) {
|
||||||
movingobjectposition.entity.setOnFire(combustEvent.getDuration());
|
movingobjectposition.entity.setOnFire(combustEvent.getDuration());
|
||||||
@ -345,11 +344,11 @@ public class EntityArrow extends Entity {
|
|||||||
public void a_(EntityHuman entityhuman) {
|
public void a_(EntityHuman entityhuman) {
|
||||||
if (!this.world.isStatic) {
|
if (!this.world.isStatic) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
ItemStack itemstack = new ItemStack(Item.ARROW, 1);
|
ItemStack itemstack = new ItemStack(Item.ARROW);
|
||||||
if (this.inGround && this.fromPlayer && this.shake <= 0 && entityhuman.inventory.canHold(itemstack) > 0) {
|
if (this.inGround && this.fromPlayer && this.shake <= 0 && entityhuman.inventory.canHold(itemstack) > 0) {
|
||||||
net.minecraft.server.EntityItem item = new net.minecraft.server.EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
|
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(), item), 0);
|
PlayerPickupItemEvent event = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.world.getServer(), this, item), 0);
|
||||||
this.world.getServer().getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.bukkit.craftbukkit.entity;
|
package org.bukkit.craftbukkit.entity;
|
||||||
|
|
||||||
|
import net.minecraft.server.Entity;
|
||||||
import net.minecraft.server.EntityItem;
|
import net.minecraft.server.EntityItem;
|
||||||
|
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
@ -11,9 +12,13 @@ import org.bukkit.craftbukkit.CraftServer;
|
|||||||
public class CraftItem extends CraftEntity implements Item {
|
public class CraftItem extends CraftEntity implements Item {
|
||||||
private EntityItem item;
|
private EntityItem item;
|
||||||
|
|
||||||
public CraftItem(CraftServer server, EntityItem entity) {
|
public CraftItem(CraftServer server, Entity entity, EntityItem item) {
|
||||||
super(server, entity);
|
super(server, entity);
|
||||||
this.item = entity;
|
this.item = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CraftItem(CraftServer server, EntityItem entity) {
|
||||||
|
this(server, entity, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getItemStack() {
|
public ItemStack getItemStack() {
|
||||||
@ -32,11 +37,6 @@ public class CraftItem extends CraftEntity implements Item {
|
|||||||
item.pickupDelay = delay;
|
item.pickupDelay = delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EntityItem getHandle() {
|
|
||||||
return (EntityItem) entity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "CraftItem";
|
return "CraftItem";
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren