После изменения состояния блока тайл, отвечающий за все эти блоки забывает всю информацию, которую он имел. shouldRefresh не помог.

Версия Minecraft
1.7.10
API
Forge
Java:
package mods.betterwithpatches.block.tile;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;

import mods.betterwithpatches.BWPRegistry;
import mods.betterwithpatches.block.CampfireBlock;
import mods.betterwithpatches.craft.CampFireCraftingManager;

import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;

import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;

import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;

import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;


public class CampfireTileEntity extends TileEntity
{
    private static final int CAMPFIRE_BURN_TIME_MULTIPLIER = 8;

    private static final int TIME_TO_COOK = (400 * CAMPFIRE_BURN_TIME_MULTIPLIER * 3 / 2 ); // this line represents efficiency relative to furnace cooking

    private static final int MAX_BURN_TIME = (5 * 1200);

    private static final int INITIAL_BURN_TIME = (50 * 4 * CAMPFIRE_BURN_TIME_MULTIPLIER * 2); // 50 is the furnace burn time of a shaft

    private static final int WARMUP_TIME = (10 * 20);
    private static final int REVERT_TO_SMALL_TIME = (20 * 20);
    private static final int BLAZE_TIME = (INITIAL_BURN_TIME * 3 / 2 );

    private static final int SMOULDER_TIME = (5 * 1200); // used to be 2 minutes

    private static final int TIME_TO_BURN_FOOD = (TIME_TO_COOK / 2 );

    private static final float CHANCE_OF_FIRE_SPREAD = 0.05F;
    private static final float CHANCE_OF_GOING_OUT_FROM_RAIN = 0.01F;

    private ItemStack spitStack = null;
    private ItemStack cookStack = null;

    private int burnTimeCountdown = 0;
    private int burnTimeSinceLit = 0;
    private int cookCounter = 0;
    private int smoulderCounter = 0;
    private int cookBurningCounter = 0;

    public CampfireTileEntity()
    {
        super();
    }


    private static final String INV_SPIT_TAG = "InventorySpit";
    private static final String INV_COOK_TAG = "InventoryCook";

    /**
     * Данный метод вызывается при записи данных Tile Entity в чанк. Мы не рекомендуем удалять вызов родительского метода,
     * так как это может привести к ошибке загрузки данных Tile Entity.
     *
     * @param nbt данные NBT в которых будет храниться информация о Tile Entity.
     */
    @Override
    public void writeToNBT(NBTTagCompound nbt) {
        super.writeToNBT(nbt);

        writeExtendedData(nbt);
        writeExtendedData2(nbt);


        nbt.setInteger("fcBurnCounter", burnTimeCountdown);
        nbt.setInteger("fcBurnTime", burnTimeSinceLit);
        nbt.setInteger("fcCookCounter", cookCounter);
        nbt.setInteger("fcSmoulderCounter", smoulderCounter);
        nbt.setInteger("fcCookBurning", cookBurningCounter);
    }

    @Override
    public void readFromNBT(NBTTagCompound nbt) {
        super.readFromNBT(nbt);

        readExtendedData2(nbt);

        readExtendedData(nbt);

        if ( nbt.hasKey( "fcBurnCounter" ) )
        {
            burnTimeCountdown = nbt.getInteger("fcBurnCounter");
        }

        if ( nbt.hasKey( "fcBurnTime" ) )
        {
            burnTimeSinceLit = nbt.getInteger("fcBurnTime");
        }

        if ( nbt.hasKey( "fcCookCounter" ) )
        {
            cookCounter = nbt.getInteger("fcCookCounter");
        }

        if ( nbt.hasKey( "fcSmoulderCounter" ) )
        {
            smoulderCounter = nbt.getInteger("fcSmoulderCounter");
        }

        if ( nbt.hasKey( "fcCookBurning" ) )
        {
            cookBurningCounter = nbt.getInteger("fcCookBurning");
        }



    }
    private void writeExtendedData(NBTTagCompound nbt) {
        if (cookStack != null) {
            NBTTagCompound inventoryTag = new NBTTagCompound();
            cookStack.writeToNBT(inventoryTag);
            nbt.setTag(INV_COOK_TAG, inventoryTag);
        }
    }
    private void writeExtendedData2(NBTTagCompound nbt) {
        if (spitStack != null) {
            NBTTagCompound inventoryTag = new NBTTagCompound();
            spitStack.writeToNBT(inventoryTag);
            nbt.setTag(INV_SPIT_TAG, inventoryTag);
        }
    }
    private void readExtendedData(NBTTagCompound nbt) {
        if (nbt.hasKey(INV_COOK_TAG, Constants.NBT.TAG_COMPOUND)) {
            NBTTagCompound inventoryTag = nbt.getCompoundTag(INV_COOK_TAG);
            cookStack = ItemStack.loadItemStackFromNBT(inventoryTag);
        }
    }
    private void readExtendedData2(NBTTagCompound nbt) {
        if (nbt.hasKey(INV_SPIT_TAG, Constants.NBT.TAG_COMPOUND)) {
            NBTTagCompound inventoryTag = nbt.getCompoundTag(INV_SPIT_TAG);
            spitStack = ItemStack.loadItemStackFromNBT(inventoryTag);
        }
    }

    @Override
    public Packet getDescriptionPacket() {
        NBTTagCompound nbt = new NBTTagCompound();
        writeExtendedData(nbt);
        return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, nbt);
    }
    @Override
    public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
        TileEntity tile = worldObj.getTileEntity(packet.func_148856_c(), packet.func_148855_d(), packet.func_148854_e());
        if (tile instanceof CampfireTileEntity) {
            ((CampfireTileEntity) tile).readExtendedData(packet.func_148857_g());
        }
    }

@Override
public boolean shouldRefresh(Block oldBlock, Block newBlock, int oldMeta, int newMeta, World world, int x, int y, int z)
{
    if (oldBlock != newBlock) {
        System.out.println("refreshin'");
        return true;
    }
    else return false;
}



    @Override
    public void updateEntity()
    {
        super.updateEntity();

        if ( !worldObj.isRemote )
        {
            int iCurrentFireLevel = getCurrentFireLevel();

            if ( iCurrentFireLevel > 0 )
            {
              //  if ( iCurrentFireLevel > 1 && worldObj.rand.nextFloat() <= CHANCE_OF_FIRE_SPREAD)
              //  {
              //      FireBlock.checkForFireSpreadFromLocation(worldObj, xCoord, yCoord, zCoord, worldObj.rand, 0);
               // }

                burnTimeSinceLit++;

                if (burnTimeCountdown > 0 )
                {
                    burnTimeCountdown--;

                    if ( iCurrentFireLevel == 3 )
                    {
                        // blaze burns extra fast

                        burnTimeCountdown--;
                    }

                }

                iCurrentFireLevel = validateFireLevel();

                if ( iCurrentFireLevel > 0 )
                {
                    updateCookState();

                    if (worldObj.rand.nextFloat() <= CHANCE_OF_GOING_OUT_FROM_RAIN && isRainingOnCampfire() )
                    {
                        extinguishFire(false);
                    }
                }
            }
            else if (smoulderCounter > 0 )
            {
                smoulderCounter--;

                if (smoulderCounter == 0 || worldObj.rand.nextFloat() <= CHANCE_OF_GOING_OUT_FROM_RAIN && isRainingOnCampfire() )
                {
                    stopSmouldering();
                }
            }
        }
    }




    //------------- Class Specific Methods ------------//

    public void setSpitStack(ItemStack stack)
    {
        if ( stack != null )
        {
            spitStack = stack.copy();

            spitStack.stackSize = 1;
        }
        else
        {
            spitStack = null;
        }

        worldObj.markBlockForUpdate( xCoord, yCoord, zCoord );
    }

    public ItemStack getSpitStack()
    {
        return spitStack;
    }

    public void setCookStack(ItemStack stack)
    {

            if (stack != null) {
                cookStack = stack.copy();

                cookStack.stackSize = 1;


            } else {
                cookStack = null;

                cookBurningCounter = 0;


            }

            cookCounter = 0;

        worldObj.markBlockForUpdate( xCoord, yCoord, zCoord );
    }

    public ItemStack getCookStack()
    {
        return cookStack;
    }

    public void ejectContents()
    {
        if (spitStack != null )
        {
            if (!worldObj.isRemote) {
                worldObj.spawnEntityInWorld(new EntityItem(worldObj, xCoord, yCoord, zCoord, new ItemStack(spitStack.getItem())));

            }
            spitStack = null;
        }

        if (cookStack != null )
        {
            if (!worldObj.isRemote) {
                worldObj.spawnEntityInWorld(new EntityItem(worldObj, xCoord, yCoord, zCoord, new ItemStack(cookStack.getItem())));
            }
            cookStack = null;

        }

    }

    public void addBurnTime(int iBurnTime)
    {
        burnTimeCountdown += iBurnTime * CAMPFIRE_BURN_TIME_MULTIPLIER * 2;

        if (burnTimeCountdown > MAX_BURN_TIME)
        {
            burnTimeCountdown = MAX_BURN_TIME;
        }

        validateFireLevel();
    }

    public void onFirstLit()
    {
        burnTimeCountdown = INITIAL_BURN_TIME;
        burnTimeSinceLit = 0;
    }

    public int validateFireLevel()
    {
        System.out.print(burnTimeCountdown);
        int iCurrentFireLevel = getCurrentFireLevel();

        if ( iCurrentFireLevel > 0 )
        {
           // int iFuelState = FCBetterThanWolves.fcBlockCampfireUnlit.GetFuelState( worldObj, xCoord, yCoord, zCoord );

            if (burnTimeCountdown <= 0 )
            {
                extinguishFire(true);
            System.out.println("extinguished fire");

                return 0;
            }
            else
            {

                int iDesiredFireLevel = 2;

                if (burnTimeSinceLit < WARMUP_TIME || burnTimeCountdown < REVERT_TO_SMALL_TIME)
                {
                    System.out.println("changing to 1");
                    iDesiredFireLevel = 1;
                }
                else if (burnTimeCountdown > BLAZE_TIME)
                {
                    iDesiredFireLevel = 3;
                }

                if ( iDesiredFireLevel != iCurrentFireLevel )
                {
                    changeFireLevel(iDesiredFireLevel);

                    if ( iDesiredFireLevel == 1 && iCurrentFireLevel == 2 )
                    {
                        worldObj.playAuxSFX(10, xCoord, yCoord, zCoord, 1 );
                    }

                    return iDesiredFireLevel;
                }
            }

        }
        else // iCurrenFireLevel == 0
        {
            if (burnTimeCountdown > 0 &&
                    BWPRegistry.unlitCampfire.getFuelState(worldObj, xCoord, yCoord, zCoord) == CampfireBlock.CAMPFIRE_FUEL_STATE_SMOULDERING)
            {
                relightSmouldering();

                return 1;
            }
        }

        return iCurrentFireLevel;
    }

    private void extinguishFire(boolean bSmoulder)
    {
        if ( bSmoulder )
        {
            smoulderCounter = SMOULDER_TIME;
        }
        else
        {
            smoulderCounter = 0;
        }

        cookCounter = 0; // reset cook counter in case fire is relit later
        cookBurningCounter = 0;

        CampfireBlock block = (CampfireBlock)(worldObj.getBlock( xCoord, yCoord, zCoord ));

        block.extinguishFire(worldObj, xCoord, yCoord, zCoord, bSmoulder);
    }

    private void changeFireLevel(int iNewLevel)
    {
        CampfireBlock block = (CampfireBlock)(worldObj.getBlock( xCoord, yCoord, zCoord ));

        block.changeFireLevel(worldObj, xCoord, yCoord, zCoord, iNewLevel, worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
    }

    private int getCurrentFireLevel()
    {
        CampfireBlock block = (CampfireBlock)(worldObj.getBlock( xCoord, yCoord, zCoord ));

        return block.fireLevel;
    }





    private void updateCookState()
    {
        if (cookStack != null )
        {
            int iFireLevel = getCurrentFireLevel();

            if ( iFireLevel >= 2 )
            {
                ItemStack cookResult = CampFireCraftingManager.instance.getRecipeResult(cookStack.getItem());

                if ( cookResult != null )
                {
                    cookCounter++;

                    if (cookCounter >= TIME_TO_COOK)
                    {
                        setCookStack(cookResult);

                        cookCounter = 0;

                        // don't reset burn counter here, as the food can still burn after cooking
                    }
                }

                if ( iFireLevel >= 3 && cookStack.getItem() != BWPRegistry.itemShaft ) // gonna replace w burned meat
                {
                    cookBurningCounter++;

                    if (cookBurningCounter >= TIME_TO_BURN_FOOD)
                    {
                        setCookStack(new ItemStack(BWPRegistry.itemShaft)); // gonna replace w burned meat

                        cookCounter = 0;
                        cookBurningCounter = 0;
                    }
                }
            }
        }
    }

    public boolean getIsCooking()
    {
        if (cookStack != null && getCurrentFireLevel() >= 2 )
        {
            ItemStack cookResult = CampFireCraftingManager.instance.getRecipeResult(cookStack.getItem());

            if ( cookResult != null )
            {
                return true;
            }
        }

        return false;
    }

    public boolean getIsFoodBurning()
    {
        if (cookStack != null && getCurrentFireLevel() >= 3 && cookStack.getItem() != BWPRegistry.itemShaft ) // gonna replace w burned meat
        {
            return true;
        }

        return false;
    }

    public boolean isRainingOnCampfire()
    {
        CampfireBlock block = (CampfireBlock)(worldObj.getBlock( xCoord, yCoord, zCoord ));

        return block.isRainingOnCampfire(worldObj, xCoord, yCoord, zCoord);
    }

    private void stopSmouldering()
    {
        smoulderCounter = 0;

        CampfireBlock block = (CampfireBlock)(worldObj.getBlock( xCoord, yCoord, zCoord ));

        block.stopSmouldering(worldObj, xCoord, yCoord, zCoord);
    }

    private void relightSmouldering()
    {
        burnTimeSinceLit = 0;

        CampfireBlock block = (CampfireBlock)(worldObj.getBlock( xCoord, yCoord, zCoord ));

        block.relightFire(worldObj, xCoord, yCoord, zCoord);
    }






}

Java:
package mods.betterwithpatches.block;




import betterwithmods.BWRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mods.betterwithpatches.BWPRegistry;
import mods.betterwithpatches.block.tile.CampfireTileEntity;
import mods.betterwithpatches.craft.CampFireCraftingManager;
import mods.betterwithpatches.proxy.ClientProxy;
import mods.betterwithpatches.util.BWMaterials;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
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;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.block.Block;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.fluids.BlockFluidBase;

import java.util.Random;



public class CampfireBlock extends BlockContainer
{

    public final int fireLevel;

    public static final int CAMPFIRE_FUEL_STATE_NORMAL = 0;
    public static final int CAMPFIRE_FUEL_STATE_BURNED_OUT = 1;
    public static final int CAMPFIRE_FUEL_STATE_SMOULDERING = 2;
    public static CampfireBlock[] fireLevelBlockArray = new CampfireBlock[4];

    public static boolean campfireChangingState = false; // temporarily true when block is being changed from one block ID to another

    private static final float SPIT_THICKNESS = (1F / 16F );
    private static final float HALF_SPIT_THICKNESS = (SPIT_THICKNESS / 2F );
    private static final float SPIT_HEIGHT = (12F / 16F );
    private static final float SPIT_MIN_Y = (SPIT_HEIGHT - HALF_SPIT_THICKNESS);
    private static final float SPIT_MAX_Y = (SPIT_MIN_Y + SPIT_THICKNESS);

    private static final float SPIT_SUPPORT_WIDTH = (1F / 16F );
    private static final float HALF_SPIT_SUPPORT_WIDTH = (SPIT_SUPPORT_WIDTH / 2F );
    private static final float SPIT_SUPPORT_BORDER = (0.5F / 16F );

    private static final float SPIT_FORK_WIDTH = (1F / 16F );
    private static final float SPIT_FORK_HEIGHT = (3F / 16F );
    private static final float SPIT_FORK_HEIGHT_OFFSET = (1F / 16F );
    private static final float SPIT_FORK_MIN_Y = (SPIT_MIN_Y - SPIT_FORK_HEIGHT_OFFSET);
    private static final float SPIT_FORK_MAX_Y = (SPIT_FORK_MIN_Y + SPIT_FORK_HEIGHT);

    private static final double SPIT_COLLISION_HEIGHT = (SPIT_HEIGHT + 1.5D / 16D );
    private static final double SPIT_COLLISION_WIDTH = (3D / 16D );
    private static final double SPIT_COLLISION_HALF_WIDTH = (SPIT_COLLISION_WIDTH / 2D );

    public CampfireBlock(int iFireLevel )
    {
        super(  Material.circuits );
        fireLevel = iFireLevel;
        fireLevelBlockArray[iFireLevel] = this;
        setHardness( 0.1F );
        setStepSound( soundTypeWood );
        setBlockName( "bwm:fcBlockCampfire" );

    }

    @Override
    public Item getItemDropped( int meta, Random random, int fortune )
    {
        if (fireLevel != 0 || getFuelState(meta) != CAMPFIRE_FUEL_STATE_NORMAL)
        {
            return null;
        }

        return super.getItemDropped( meta, random, fortune );
    }

    @Override
    public TileEntity createNewTileEntity(World worldIn, int meta )
    {
        return new CampfireTileEntity();
    }

    @Override
    public void breakBlock( World worldIn, int x, int y, int z, Block blockBroken, int meta )
    {
        if ( !campfireChangingState)
        {
            CampfireTileEntity tileEntity = (CampfireTileEntity)worldIn.getTileEntity(x, y, z );


                tileEntity.ejectContents();


            // only called when not changing state as super kills the tile entity
            super.breakBlock( worldIn, x, y, z, worldIn.getBlock(x,y,z), meta );
        }
    }

    @Override
    public boolean isOpaqueCube()
    {
        return false;
    }

    @Override
    public boolean renderAsNormalBlock()
    {
        return false;
    }

    @Override
    public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k )
    {
        return null;
    }

    @Override
    protected boolean canSilkHarvest()
    {
        return false;
    }



    @Override
    public int onBlockPlaced( World world, int i, int j, int k, int iFacing, float fClickX, float fClickY, float fClickZ, int iMetadata )
    {
        return setIAligned(iMetadata, isFacingIAligned(iFacing));
    }




    @Override
    public int tickRate( World world )
    {
        return 2;
    }




    public boolean getCanBeSetOnFireDirectly(IBlockAccess blockAccess, int i, int j, int k)
    {
        return fireLevel == 0 && getFuelState(blockAccess, i, j, k) == CAMPFIRE_FUEL_STATE_NORMAL;
    }


    public boolean setOnFireDirectly(World world, int i, int j, int k)
    {
        if ( getCanBeSetOnFireDirectly(world, i, j, k) )
        {
            if ( !isRainingOnCampfire(world, i, j, k) )
            {
                changeFireLevel(world, i, j, k, 1, world.getBlockMetadata(i, j, k));

                CampfireTileEntity tileEntity = (CampfireTileEntity)world.getTileEntity(
                        i, j, k );

                tileEntity.onFirstLit();

                world.playSoundEffect( i + 0.5D, j + 0.5D, k + 0.5D,
                        "mob.ghast.fireball", 1F, world.rand.nextFloat() * 0.4F + 0.8F );

                if ( !Blocks.portal.func_150000_e( world, i, j, k ) )
                {
                    // FCTODO: A bit hacky here.  Should probably be a general way to start a
                    // bigger fire atop flammable blocks

                    Block iBlockBelowID = world.getBlock( i, j - 1, k );

                    if ( iBlockBelowID == Blocks.netherrack) //|| iBlockBelowID ==  BTWBlocks.fallingNetherrack.blockID )
                    {
                        world.setBlock( i, j, k, Blocks.fire);
                    }
                }
            }
            else
            {
                world.playAuxSFX( 10, i, j, k, 0 );
            }

            return true;
        }

        return false;
    }


    public int getChanceOfFireSpreadingDirectlyTo(IBlockAccess blockAccess, int i, int j, int k)
    {
        if (fireLevel == 0 && getFuelState(blockAccess, i, j, k) == CAMPFIRE_FUEL_STATE_NORMAL)
        {
            return 60; // same chance as leaves and other highly flammable objects
        }

        return 0;
    }



    @Override
    public boolean onBlockActivated( World world, int i, int j, int k, EntityPlayer player, int iFacing, float fXClick, float fYClick, float fZClick )
    {
        ItemStack stack = player.getCurrentEquippedItem();
        CampfireTileEntity tileEntityNew =
                (CampfireTileEntity)world.getTileEntity( i, j, k );
        ItemStack nocrash = tileEntityNew.getSpitStack();

        if ( stack != null )
        {
            Item item = stack.getItem();

            if ( !getHasSpit(world, i, j, k) )
            {
                if ( item == BWPRegistry.itemPointyStick)
                {
                    setHasSpit(world, i, j, k, true);

                    CampfireTileEntity tileEntity =
                            (CampfireTileEntity)world.getTileEntity( i, j, k );

                    tileEntity.setSpitStack(stack);

                    stack.stackSize--;

                    return true;
                }
            }
            else
            {
                CampfireTileEntity tileEntity =
                        (CampfireTileEntity)world.getTileEntity( i, j, k );

                ItemStack cookStack = tileEntity.getCookStack();

                if ( cookStack == null )
                {
                    if ( isValidCookItem(stack) && nocrash != null )
                    {
                        ItemStack spitStack = tileEntity.getSpitStack();

                        if ( spitStack.getItemDamage() == 0 )
                        {
                            tileEntity.setCookStack(stack);
                        }
                        else
                        {
                            // break the damaged spit when the player attempts to place an item on it
                            // this is to discourage early game exploits involving half damaged sticks.

                            tileEntity.setSpitStack(null);

                            setHasSpit(world, i, j, k, false);


                                ItemStack ejectStack = stack.copy();

                                ejectStack.stackSize = 1;
                            if ( !world.isRemote ) {
                                world.spawnEntityInWorld(new EntityItem(world, i, j, k, ejectStack));


                                world.playAuxSFX(10,
                                        i, j, k, 0);
                            }
                        }

                        stack.stackSize--;

                        return true;
                    }
                }
                else if ( cookStack.getItem() == stack.getItem() &&
                        stack.stackSize < stack.getMaxStackSize() )
                {
                    player.worldObj.playSoundAtEntity( player, "random.pop", 0.2F, 2F );

                    stack.stackSize++;

                    tileEntity.setCookStack(null);

                    return true;
                }
            }
            if (item == Items.flint_and_steel){
                if (fireLevel == 0){
                    stack.damageItem(2, player);
                    double a = Math.random()*4;
                    if (a >= 3.0) {
                        setOnFireDirectly(world, i, j, k);
                    }
                    return true;

                }
            }
            if (item == BWPRegistry.itemOakBark){
                if (world.isRemote) {
                    System.out.print(tileEntityNew.getCookStack());
                    System.out.print(tileEntityNew.getSpitStack() + "spit");
                }
                    return true;

            }

            if (fireLevel > 0 || getFuelState(world, i, j, k) == CAMPFIRE_FUEL_STATE_SMOULDERING)
            {





                if ( getCanBeFedDirectlyIntoCampfire( stack) )
                {

                    {
                        CampfireTileEntity tileEntity = (CampfireTileEntity)world.getTileEntity( i, j, k );

                        world.playSoundEffect( i + 0.5D, j + 0.5D, k + 0.5D, "mob.ghast.fireball",
                                0.2F + world.rand.nextFloat() * 0.1F,
                                world.rand.nextFloat() * 0.25F + 1.25F );

                        tileEntity.addBurnTime(getCampfireBurnTime(stack));
                    }

                    stack.stackSize--;

                    return true;
                }

            }
        }
        else // empty hand
        {
            CampfireTileEntity tileEntity =
                    (CampfireTileEntity)world.getTileEntity( i, j, k );

            ItemStack cookStack = tileEntity.getCookStack();

            if ( cookStack != null  )
            {
                if (!world.isRemote) {
                    world.spawnEntityInWorld(new EntityItem(world, i, j, k, new ItemStack(cookStack.getItem())));
                }


                tileEntity.setCookStack(null);

                return true;
            }
            else
            {
                ItemStack spitStack = tileEntity.getSpitStack();

                if ( spitStack != null )
                {
                    if (!world.isRemote) {

                        world.spawnEntityInWorld(new EntityItem(world, i, j, k, spitStack));
                    }
                        setHasSpit(world, i, j, k, false);
                        tileEntity.setSpitStack(null);


                        return true;

                }
            }
        }

        return false;
    }



    public int getCampfireBurnTime(ItemStack iItemDamage)
    {
        return 4800;
    }
    public boolean getCanItemBeSetOnFireOnUse(int iItemDamage)
    {
        return false;
    }

    public boolean getCanItemStartFireOnUse(int iItemDamage)
    {
        return false;
    }

    public boolean getCanBeFedDirectlyIntoCampfire( ItemStack itemstack) //ill leave it like this for now, going to change it soon
    {
        if (itemstack.getItem() == BWPRegistry.itemShaft || itemstack.getItem() == BWRegistry.bark || itemstack.equals(BWMaterials.getMaterial(BWMaterials.SAWDUST))){
            return true;
        }
            return false;
    }



    @Override
    public void onEntityCollidedWithBlock( World world, int i, int j, int k, Entity entity )
    {
        if ( !world.isRemote && entity.isEntityAlive() && (fireLevel > 0 || getFuelState(world, i, j, k) == CAMPFIRE_FUEL_STATE_SMOULDERING) )
        {
            if ( entity instanceof EntityItem)
            {
                EntityItem entityItem = (EntityItem)entity;
                ItemStack targetStack = entityItem.getEntityItem();
                Item item = targetStack.getItem();
                int iBurnTime = getCampfireBurnTime(targetStack);

                if ( iBurnTime > 0  && getCanBeFedDirectlyIntoCampfire(targetStack))
                {
                    iBurnTime *= targetStack.stackSize;

                    CampfireTileEntity tileEntity =
                            (CampfireTileEntity)world.getTileEntity( i, j, k );

                    world.playSoundEffect( i + 0.5D, j + 0.5D, k + 0.5D, "mob.ghast.fireball",
                            world.rand.nextFloat() * 0.1F + 0.2F,
                            world.rand.nextFloat() * 0.25F + 1.25F );

                    tileEntity.addBurnTime(iBurnTime);

                    entity.setDead();
                }
            }
        }
    }


    public boolean getDoesFireDamageToEntities(World world, int i, int j, int k, Entity entity)
    {
        return fireLevel > 2 || (fireLevel == 2 && entity instanceof EntityLiving );
    }


    public boolean getCanBlockLightItemOnFire(IBlockAccess blockAccess, int i, int j, int k)
    {

        return fireLevel > 0;
    }


    public void onFluidFlowIntoBlock(World world, int i, int j, int k, BlockFluidBase newBlock)
    {
        if (fireLevel > 0 )
        {
            world.playAuxSFX(10, i, j, k, 0 );
        }


    }


    //------------- Class Specific Methods ------------//

    public void setIAligned(World world, int i, int j, int k, boolean bIAligned)
    {
        int iMetadata = setIAligned(world.getBlockMetadata(i, j, k), bIAligned);

        world.setBlockMetadataWithNotify( i, j, k, iMetadata,2 );
    }

    public int setIAligned(int iMetadata, boolean bIAligned)
    {
        if ( bIAligned )
        {
            iMetadata |= 1;
        }
        else
        {
            iMetadata &= (~1);
        }

        return iMetadata;
    }

    public boolean getIsIAligned(IBlockAccess blockAccess, int i, int j, int k)
    {
        return getIsIAligned(blockAccess.getBlockMetadata(i, j, k));
    }

    public boolean getIsIAligned(int iMetadata)
    {
        return ( iMetadata & 1 ) != 0;
    }

    public boolean isFacingIAligned(int iFacing)
    {
        return iFacing >= 4;
    }

    public void setHasSpit(World world, int i, int j, int k, boolean bHasSpit)
    {
        int iMetadata = setHasSpit(world.getBlockMetadata(i, j, k), bHasSpit);

        world.setBlockMetadataWithNotify( i, j, k, iMetadata,2 );
    }

    public int setHasSpit(int iMetadata, boolean bHasSpit)
    {
        if ( bHasSpit )
        {
            iMetadata |= 2;
        }
        else
        {
            iMetadata &= (~2);
        }

        return iMetadata;
    }

    public boolean getHasSpit(IBlockAccess blockAccess, int i, int j, int k)
    {
        return getHasSpit(blockAccess.getBlockMetadata(i, j, k));
    }

    public boolean getHasSpit(int iMetadata)
    {
        return ( iMetadata & 2 ) != 0;
    }

    public void setFuelState(World world, int i, int j, int k, int iCampfireState)
    {
        int iMetadata = setFuelState(world.getBlockMetadata(i, j, k), iCampfireState);

        world.setBlockMetadataWithNotify( i, j, k, iMetadata,2 );
    }

    public int setFuelState(int iMetadata, int iCampfireState)
    {
        iMetadata &= ~12; // filter out old state

        return iMetadata | ( iCampfireState << 2 );
    }

    public int getFuelState(IBlockAccess blockAccess, int i, int j, int k)
    {
        return getFuelState(blockAccess.getBlockMetadata(i, j, k));
    }

    public int getFuelState(int iMetadata)
    {
        return ( iMetadata & 12 ) >> 2;
    }

    public boolean isValidCookItem(ItemStack stack)
    {
        if (CampFireCraftingManager.instance.getRecipeResult(stack.getItem()) != null )
        {
            return true;
        }

        return false;
    }

    public void extinguishFire(World world, int i, int j, int k, boolean bSmoulder)
    {
        int iMetadata = world.getBlockMetadata( i, j, k );

        if ( bSmoulder )
        {
            iMetadata = setFuelState(iMetadata, CAMPFIRE_FUEL_STATE_SMOULDERING);
        }
        else
        {
            iMetadata = setFuelState(iMetadata, CAMPFIRE_FUEL_STATE_BURNED_OUT);
        }

        changeFireLevel(world, i, j, k, 0, iMetadata);

        if ( !world.isRemote )
        {
            world.playAuxSFX( 10, i, j, k, 1 );
        }
    }

    public void relightFire(World world, int i, int j, int k)
    {
        changeFireLevel(world, i, j, k, 1, setFuelState(world.getBlockMetadata(i, j, k), CAMPFIRE_FUEL_STATE_NORMAL));
    }

    public void stopSmouldering(World world, int i, int j, int k)
    {
        setFuelState(world, i, j, k, CAMPFIRE_FUEL_STATE_BURNED_OUT);
    }

    public void changeFireLevel(World world, int i, int j, int k, int iFireLevel, int iMetadata)
    {

        CampfireBlock.campfireChangingState = true;
        world.setBlock( i, j, k, CampfireBlock.fireLevelBlockArray[iFireLevel], iMetadata, 2 );
        CampfireBlock.campfireChangingState = false;
    }


    public boolean isRainingAtPos(World world, int i, int j, int k)
    {
        if ( world.isRaining() && world.canBlockSeeTheSky( i, j, k ) &&
                j >= world.getPrecipitationHeight( i, k )  )
        {
            BiomeGenBase biome = world.getBiomeGenForCoords( i, k );

            return biome.canSpawnLightningBolt();
        }

        return false;
    }

    public boolean isRainingOnCampfire(World world, int i, int j, int k)
    {
        return isRainingAtPos(world, i, j, k);
    }



    @Override
    public void updateTick(World worldIn, int x, int y, int z, Random random){
        if (!World.doesBlockHaveSolidTopSurface(worldIn, x, y - 1, z)){
            if (fireLevel > 0 )
            {
                worldIn.playAuxSFX( 10, x, y, z, 1 );
            }

            dropBlockAsItem( worldIn, x, y, z, worldIn.getBlockMetadata( x, y, z ), 0 );

            worldIn.setBlockToAir( x, y, z );
        }

    }

    @Override
    public void onNeighborBlockChange(World worldIn, int x, int y, int z, Block neighbor) {
        if (!World.doesBlockHaveSolidTopSurface(worldIn, x, y - 1, z)){
            if (fireLevel > 0 )
            {
                worldIn.playAuxSFX( 10, x, y, z, 1 );
            }

            dropBlockAsItem( worldIn, x, y, z, worldIn.getBlockMetadata( x, y, z ), 0 );

            worldIn.setBlockToAir( x, y, z );
        }
    }

    //----------- Client Side Functionality -----------//


    @SideOnly(Side.CLIENT)
    public IIcon[] icons;






    @Override
    public void registerBlockIcons( IIconRegister reg )
    { this.icons = new IIcon[7];
        this.icons[0] = reg.registerIcon( "fcBlockCampfire" );
        this.icons[1] = reg.registerIcon("fcBlockCampfire_spit");
        this.icons[2] = reg.registerIcon("fcBlockCampfire_support");
        this.icons[3] = reg.registerIcon("fcBlockCampfire_burned");
        this.icons[4] = reg.registerIcon("fcOverlayEmbers");
    }

    @Override
    public IIcon getIcon(int side,int meta ) {

        return this.icons[1];
    }
    @Override

    public boolean shouldSideBeRendered( IBlockAccess blockAccess, int iNeighborI, int iNeighborJ, int iNeighborK, int iSide )
    {
        return true;
    }

    @Override
    public int getRenderType() {
        return ClientProxy.renderBlockCampfire;
    }






    @Override
    @SideOnly(Side.CLIENT)
    public void randomDisplayTick( World world, int i, int j, int k, Random rand )
    {
        if (fireLevel > 1 )
        {
            for (int iTempCount = 0; iTempCount < fireLevel; iTempCount++ )
            {
                double xPos = i + rand.nextFloat();
                double yPos = j + 0.5F + ( rand.nextFloat() * 0.5F );
                double zPos = k + rand.nextFloat();

                world.spawnParticle( "smoke", xPos, yPos, zPos, 0D, 0D, 0D );
            }

            CampfireTileEntity tileEntity =
                    (CampfireTileEntity)world.getTileEntity( i, j, k );

            if ( tileEntity.getIsFoodBurning() )
            {
                for ( int iTempCount = 0; iTempCount < 1; ++iTempCount )
                {
                    double xPos = i + 0.375F + rand.nextFloat() * 0.25F;
                    double yPos = j + 0.5F + rand.nextFloat() * 0.5F;
                    double zPos = k + 0.375F + rand.nextFloat() * 0.25F;

                    world.spawnParticle( "largesmoke", xPos, yPos, zPos, 0D, 0D, 0D );
                }
            }
            else if ( tileEntity.getIsCooking() )
            {
                for ( int iTempCount = 0; iTempCount < 1; ++iTempCount )
                {
                    double xPos = i + 0.375F + rand.nextFloat() * 0.25F;
                    double yPos = j + 0.5F + rand.nextFloat() * 0.5F;
                    double zPos = k + 0.375F + rand.nextFloat() * 0.25F;

                    world.spawnParticle( "fcwhitesmoke", xPos, yPos, zPos, 0D, 0D, 0D );
                }
            }
        }
        else if (fireLevel == 1 || getFuelState(world, i, j, k) == CAMPFIRE_FUEL_STATE_SMOULDERING)
        {
            double xPos = (double)i + 0.375D + ( rand.nextDouble() * 0.25D );
            double yPos = (double)j + 0.25D + ( rand.nextDouble() * 0.25D );
            double zPos = (double)k + 0.375D + ( rand.nextDouble() * 0.25D );

            world.spawnParticle( "smoke", xPos, yPos, zPos, 0D, 0D, 0D );
        }

        if (fireLevel > 0 )
        {
            if ( rand.nextInt(24) == 0 )
            {
                float fVolume = (fireLevel * 0.25F ) + rand.nextFloat();

                world.playSound( i + 0.5D, j + 0.5D, k + 0.5D, "fire.fire",
                        fVolume, rand.nextFloat() * 0.7F + 0.3F, false );
            }
        }
    }
}
Ну а что, собственно ещё писать, после смены блока ( с незажжёного костра на зажжёный ) тайл забывает всю информацию, которая в нём хранилась ( еда, наличие палки на которой еда готовится, время горени, и.т.п.) Попытался спасти это при помощи оверрайда shouldRefresh, но ничего не изменилось... Может кто-нибудь подсказать, что я могу предпринять?
 
Не знаю как ты меняешь блок статы, мне не удобно читать код с телефона
Но на 1.12.2 блок статы переключается так: world.setBlockState(newState, 3);
Флаги обязательны, флаг:3 отправляет клиенту пакет что BlockState изменился и что-то ещё, не помню
У меня все работает
 
Назад
Сверху