- 1,007
- 36
- 206
Создал свой EntityItem, но игра не даёт мне выбросить предмет(он сразу засасывается в инвентарь), если ставлю delay, то после дропа не могу его поднять.
Класс предмета:
@Override
public boolean hasCustomEntity( final ItemStack stack )
{
return true;
}
@Override
public Entity createEntity(final World world, final Entity location, final ItemStack itemstack )
{
final EntityKeyItem egc = new EntityKeyItem(world, location.posX, location.posY, location.posZ, itemstack);
egc.motionX = location.motionX;
egc.motionY = location.motionY;
egc.motionZ = location.motionZ;
return egc;
}
Класс энтити:
public EntityKeyItem(World worldIn) {
super(worldIn);
}
public EntityKeyItem( final World w, final double x, final double y, final double z, final ItemStack is) {
super( w, x, y, z, is );
}
@Override
public void onUpdate() {
super.onUpdate();
if(!this.world.isRemote) {
AxisAlignedBB aabb = new AxisAlignedBB(this.posX - 0.5D, this.posY - 0.5D, this.posZ - 0.5D, this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D);
List list = this.world.getEntitiesWithinAABB(EntityItem.class, aabb);
Iterator iterator = list.iterator();
EntityItem near = null;
while (iterator.hasNext()) {
near = (EntityItem) iterator.next();
if (near == this) continue;
ItemStack crate = near.getItem();
if (crate.getItem() == LootMod.RandomCrate) {
this.world.spawnParticle(EnumParticleTypes.CRIT, this.posX, this.posY, this.posZ, 0, 0.5F, 0);
near.setDead;
}
}
}
}