EntityItem пропадает при спавне

Версия Minecraft
1.7.10
При попадании на блок предмет должен заменяться другим согласно рецепту.
Все вроде бы нормально, но предмет на выходе просто пропадает, вернее видно как он появляется но он тут же пропадает.
И при первом заходе, первый раз кинув все срабатывает, результат корректно спавниться, а потом все перестает нормально работать.
Действую я так:
Получаем предметы сверху блока
Проверяем есть ли с ним/ними рецепт
Если есть, то убиваем предмет и спавним результат

Java:
package com.greedycat.techno.tile;



import java.util.List;

import com.greedycat.techno.recipes.Recipe;
import com.greedycat.techno.recipes.Recipes;

import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;

public class EnergyInfuserTile extends TileEntity{
    @Override
    public void updateEntity() {
        super.updateEntity();
        //класс для работы со списком рецептов
        Recipes recipes = Recipes.getInstance();
       //получаю предметы над блоком
        List<EntityItem> items =  worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1.5d, zCoord + 1));
        //и циклом прохожусь по ним
        for(EntityItem item:items) {
           
            if(item.isDead)
                continue;
            ItemStack stack = item.getEntityItem();
            //возвращает null если нет рецепта и объект Recipe если есть рецепт
            Recipe recipe = recipes.recipeExistsFor(stack.getItem());
           
            if(stack!=null && recipe.getNeededItemStack().getItem() == stack.getItem()) {
                if(recipe!=null) {         
                    if(!worldObj.isRemote) {
                        stack.stackSize--;
                        if(stack.stackSize == 0)
                            item.setDead();
                     EntityItem entityItem = new EntityItem(worldObj, xCoord+0.5D, yCoord+1.5D, zCoord+0.5D, recipe.getResult());
                     worldObj.spawnEntityInWorld(entityItem);
   
                    }
                }
            }
        }
    }
}
 
2,505
81
397
Что значит "перестает нормально работать"?

Вынеси проверку !worldObj.isRemote) в самое начало метода, а не где-то внутри цикла.
Проверка stack!=null вставлена слишком поздно. Ты еще до нее делаешь stack.getItem().
Проверка recipe!=null аналогично.
 
5,018
47
783
Апдейт энтити работает постоянно, а collidedWithBlock в блоке работает только тогда, когда предмет его касается.
 
586
32
136
Java:
   @Override
    public void updateEntity() {
        super.updateEntity();
        if (!worldObj.isRemote) {
            //класс для работы со списком рецептов
            Recipes recipes = Recipes.getInstance();
            //получаю предметы над блоком
            List<EntityItem> items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1.5d, zCoord + 1));
            //и циклом прохожусь по ним
            for (Entity item : items) {
                if (item.isDead)
                    continue;
                if (!(item instanceof EntityItem))
                    contitnue;
                ItemStack stack = item.getEntityItem();
                if (stack == null)
                    continue;
                //возвращает null если нет рецепта и объект Recipe если есть рецепт
                Recipe recipe = recipes.recipeExistsFor(stack.getItem());

                if (recipe.getNeededItemStack().getItem() == stack.getItem()) {
                    if (recipe != null) {
                        stack.stackSize--;
                        if (stack.stackSize == 0)
                            item.setDead();
                        EntityItem entityItem = new EntityItem(worldObj, xCoord + 0.5D, yCoord + 1.5D, zCoord + 0.5D, recipe.getResult().copy());
                        worldObj.spawnEntityInWorld(entityItem);
                    }
                }
            }
        }
    }
Немного поправил твой код.
 
Сверху