Jump to content

[1.10.2][SOLVED] Getting TileEntity variables for block to use?


Recommended Posts

Posted

Hello,

After defining a few variables inside a TileEntity, I want the block itself to emit particle effects based on what variables are true or not.

I have this code inside the block's randomDisplayTick so far, but it doesn't do what I want(i.e. it keeps going to the last else case)

[spoiler=randomDisplayTick]

        double d0 = (double)pos.getX() + 0.5D;
        double d1 = (double)pos.getY() + rand.nextDouble() * 6.0D / 16.0D;
        double d2 = (double)pos.getZ() + 0.5D;
        double d3 = rand.nextDouble() * 0.6D - 0.3D;

        if (rand.nextDouble() < 0.3D)
        {
            worldIn.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FIRE_AMBIENT, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
        }

        if(worldIn.isRemote)
        {
            TileEntity tileEntity = worldIn.getTileEntity(pos);
            if (tileEntity instanceof TileEntityBonfire)
            {
                TileEntityBonfire bonfire = (TileEntityBonfire) tileEntity;
                if(bonfire.shardCount > 0)
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.CRIT, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                }
                if(bonfire.ashCount > 0)
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                }
                if(bonfire.blazerodCount > 0)
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    if(rand.nextDouble() > 0.3D)
                    {
                        worldIn.spawnParticle(EnumParticleTypes.LAVA, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    }
                }
                else
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                }
            }
        }

 

If I'm asking a whole bunch of questions, please don't get angry. I'm trying to learn.

Posted

Changed it so it's got more else ifs, however it will still not change the particles spawned when the variables are changed themselves.

Here's the new block code:

[spoiler=Block Code]

package com.t10a.crystalflask.blocks;

import com.t10a.crystalflask.Reference;
import com.t10a.crystalflask.init.ModItems;
import com.t10a.crystalflask.tileentity.TileEntityBonfire;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.util.List;
import java.util.Random;

public class BlockBonfire extends Block implements ITileEntityProvider
{
    //private static final AxisAlignedBB BOUNDING_BOX = new AxisAlignedBB(x1, y1, z1, x2, y2, z2);
    //This sets the hitbox for this block,
    private static final AxisAlignedBB BOUNDING_BOX = new AxisAlignedBB(0.0625 * 3, 0, 0.0625 * 4, 0.0625 * 12, 0.0625 * 15, 0.0625 * 12);

    public BlockBonfire(String name, CreativeTabs tabs)
    {
        super(Material.ROCK);
        //It's a good idea to put the modid into the block's unlocalised name, to prevent conflicts in the en_US.lang.
        setUnlocalizedName(Reference.MOD_ID + "." + name);
        setRegistryName(Reference.MOD_ID, name);
        setCreativeTab(tabs);
        this.setLightLevel(5.0F);
    }

    /*
    * The following are obvious. isFullCube checks if this is a full cube (it isn't), isOpaqueCube checks if this cube is opaque (it isn't a cube, so no),
    * getBlockLayer returns this block is solid, getBoundingBox tells the game the hitbox we defined earlier(?), and addCollisionBoxToList registers the hitbox(?).
    */
    @SuppressWarnings("deprecation")
    @Override
    public boolean isFullCube(IBlockState state) {
        return false;
    }

    @SuppressWarnings("deprecation")
    @Override
    public boolean isOpaqueCube(IBlockState state) {
        return false;
    }

    @Override
    public BlockRenderLayer getBlockLayer() {
        return BlockRenderLayer.SOLID;
    }

    @SuppressWarnings("deprecation")
    @Override
    public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
        return BOUNDING_BOX;
    }

    @SuppressWarnings("deprecation")
    @Override
    public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn) {
        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, BOUNDING_BOX);
    }

    //WIP. Pretty much is responsible for the particle effects this block emits.
    //TODO: Make this emit special particles based on what item is contained.
    @SideOnly(Side.CLIENT)
    @SuppressWarnings("incomplete-switch")
    public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
    {
        double d0 = (double)pos.getX() + 0.5D;
        double d1 = (double)pos.getY() + rand.nextDouble() * 6.0D / 16.0D;
        double d2 = (double)pos.getZ() + 0.5D;
        double d3 = rand.nextDouble() * 0.6D - 0.3D;

        if (rand.nextDouble() < 0.3D)
        {
            worldIn.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FIRE_AMBIENT, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
        }

        if(worldIn.isRemote)
        {
            TileEntity tileEntity = worldIn.getTileEntity(pos);
            if (tileEntity instanceof TileEntityBonfire)
            {
                TileEntityBonfire bonfire = (TileEntityBonfire) tileEntity;
                if(bonfire.shardCount > 0)
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.CRIT, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                }
                else if(bonfire.ashCount > 0)
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                }
                else if(bonfire.blazerodCount > 0)
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    if(rand.nextDouble() > 0.3D)
                    {
                        worldIn.spawnParticle(EnumParticleTypes.LAVA, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    }
                }
                else
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                }
            }
        }
    }


    //This pretty much tells the TileEntity class what to do based on what's right-clicking it.
    @Override
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
        if(!worldIn.isRemote)
        {
            TileEntity tileEntity = worldIn.getTileEntity(pos);
            if(tileEntity instanceof TileEntityBonfire)
            {
                TileEntityBonfire bonfire = (TileEntityBonfire) tileEntity;
                if(heldItem != null)
                {
                    if (heldItem.getItem() == ModItems.estus_shard)
                    {
                        if(bonfire.addShard())
                        {
                            heldItem.stackSize--;
                            return true;
                        }
                    }
                    else if (heldItem.getItem() == ModItems.estus_ash)
                    {
                        if(bonfire.addAsh())
                        {
                            heldItem.stackSize--;
                            return true;
                        }
                    }
                    else if (heldItem.getItem() == ModItems.estus_flask)
                    {
                        bonfire.estusRestock(heldItem);
                        return true;
                    }
                    else if (heldItem.getItem() == Items.BLAZE_ROD)
                    {
                        if(bonfire.addBlazeRod())
                        {
                            heldItem.stackSize--;
                            return true;
                        }
                    }
                    else if(heldItem.getItem() == Items.PRISMARINE_SHARD || (heldItem.getItem() == Items.SKULL && heldItem.getMetadata() == 1))
                    {
                        bonfire.bonfireCraft(heldItem);
                        return true;
                    }
                }
                bonfire.removeShard();
                bonfire.removeAsh();
                bonfire.removeBlazeRod();
            }
        }
        return true;
    }

    //Basically makes a new TileEntity when this is placed.
    @Override
    public TileEntity createNewTileEntity(World worldIn, int meta)
    {
        return new TileEntityBonfire();
    }
}

 

And the TileEntity code:

[spoiler=Tile Entity code]

package com.t10a.crystalflask.tileentity;

import com.t10a.crystalflask.init.ModItems;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;

public class TileEntityBonfire extends TileEntity
{
    //Variables telling the TileEntity what's currently contained.
    public int shardCount = 0;
    public int ashCount = 0;
    public int blazerodCount = 0;

    //This tells the block how to handle adding new Shards.
    public boolean addShard()
    {
        if (shardCount < 1 && ashCount == 0 && blazerodCount == 0)
        {
            shardCount++;
            return true;
        }
        return false;
    }
    //This tells the block how to handle removing a shard.
    public void removeShard()
    {
        if(shardCount > 0)
        {
            worldObj.spawnEntityInWorld(new EntityItem(worldObj, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, new ItemStack(ModItems.estus_shard)));
            shardCount--;
        }
    }
    //addAsh &  removeAsh does the same as addShard & removeShard, but for the Ash item. I COULD unify them under one call, but for now this works.
    public boolean addAsh()
    {
        if(ashCount < 1 && shardCount == 0 && blazerodCount == 0)
        {
            ashCount++;
            return true;
        }
        return false;
    }

    public void removeAsh()
    {
        if(ashCount > 0)
        {
            worldObj.spawnEntityInWorld(new EntityItem(worldObj, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, new ItemStack(ModItems.estus_ash)));
            ashCount--;
        }
    }

    //Same as above, but for blaze rods. I'm definitely going to unify them under 1 call eventually.
    public boolean addBlazeRod()
    {
        if(blazerodCount < 1 && shardCount == 0 && ashCount == 0)
        {
            blazerodCount++;
            return true;
        }
        return false;
    }

    public void removeBlazeRod()
    {
        if(blazerodCount > 0)
        {
            worldObj.spawnEntityInWorld(new EntityItem(worldObj, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, new ItemStack(Items.BLAZE_ROD)));
            blazerodCount--;
        }
    }

    public void bonfireCraft(ItemStack stack)
    {
        //TODO: Delete this, and make a dedicated recipe handler, so it's easier to add recipes to. For both me and addon developers.
        if(stack.getItem() == Items.PRISMARINE_SHARD && blazerodCount > 0)
        {
            worldObj.spawnEntityInWorld(new EntityItem(worldObj, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, new ItemStack(ModItems.estus_shard)));
            stack.stackSize--;
            blazerodCount--;
        }
        else if(stack.getItem() == Items.SKULL && stack.getMetadata() == 1 && blazerodCount > 0)
        {
            worldObj.spawnEntityInWorld(new EntityItem(worldObj, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, new ItemStack(ModItems.estus_ash)));
            stack.stackSize--;
            blazerodCount--;
        }
    }

    //This is a big chunk of code that used  to be on the flask. This handles the restocking the uses, and upgrading of the flask when this is called by BlockBonfire.
    public void estusRestock(ItemStack stack)
    {
        if(stack.getItem() == ModItems.estus_flask)
        {
            NBTTagCompound nbt;

            if (stack.hasTagCompound())
            {
                nbt = stack.getTagCompound();
            }
            else
            {
                nbt = new NBTTagCompound();
            }
            if (nbt.hasKey("Uses"))
            {
                if(shardCount > 0 && nbt.getInteger("Max Uses") < 12)
                {
                    nbt.setInteger("Max Uses", nbt.getInteger("Max Uses") + 1);
                    shardCount--;
                }
                else if(ashCount > 0 && nbt.getInteger("Potency") < 5)
                {
                    nbt.setInteger("Potency", nbt.getInteger("Potency") + 1);
                    ashCount--;
                }
                nbt.setInteger("Uses", nbt.getInteger("Max Uses"));
            }
            else
            {
                nbt.setInteger("Uses", 1);
                nbt.setInteger("Max Uses", 1);
                nbt.setInteger("Potency", 1);
            }
            stack.setTagCompound(nbt);
        }
    }

    //This merely saves the variables defined earlier to NBT.
    @Override
    public NBTTagCompound writeToNBT(NBTTagCompound compound)
    {
        super.writeToNBT(compound);
        compound.setInteger("ShardCount", shardCount);
        compound.setInteger("AshCount", ashCount);

        return compound;
    }

    //Similar to above, but it loads from NBT instead.
    @Override
    public void readFromNBT(NBTTagCompound compound)
    {
        super.readFromNBT(compound);
        this.shardCount = compound.getInteger("ShardCount");
        this.ashCount = compound.getInteger("AshCount");
    }
}

 

If I'm asking a whole bunch of questions, please don't get angry. I'm trying to learn.

Posted
  On 8/29/2016 at 7:15 AM, T-10a said:

Changed it so it's got more else ifs, however it will still not change the particles spawned when the variables are changed themselves.

Here's the new block code:

[spoiler=Block Code]

package com.t10a.crystalflask.blocks;

import com.t10a.crystalflask.Reference;
import com.t10a.crystalflask.init.ModItems;
import com.t10a.crystalflask.tileentity.TileEntityBonfire;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.util.List;
import java.util.Random;

public class BlockBonfire extends Block implements ITileEntityProvider
{
    //private static final AxisAlignedBB BOUNDING_BOX = new AxisAlignedBB(x1, y1, z1, x2, y2, z2);
    //This sets the hitbox for this block,
    private static final AxisAlignedBB BOUNDING_BOX = new AxisAlignedBB(0.0625 * 3, 0, 0.0625 * 4, 0.0625 * 12, 0.0625 * 15, 0.0625 * 12);

    public BlockBonfire(String name, CreativeTabs tabs)
    {
        super(Material.ROCK);
        //It's a good idea to put the modid into the block's unlocalised name, to prevent conflicts in the en_US.lang.
        setUnlocalizedName(Reference.MOD_ID + "." + name);
        setRegistryName(Reference.MOD_ID, name);
        setCreativeTab(tabs);
        this.setLightLevel(5.0F);
    }

    /*
    * The following are obvious. isFullCube checks if this is a full cube (it isn't), isOpaqueCube checks if this cube is opaque (it isn't a cube, so no),
    * getBlockLayer returns this block is solid, getBoundingBox tells the game the hitbox we defined earlier(?), and addCollisionBoxToList registers the hitbox(?).
    */
    @SuppressWarnings("deprecation")
    @Override
    public boolean isFullCube(IBlockState state) {
        return false;
    }

    @SuppressWarnings("deprecation")
    @Override
    public boolean isOpaqueCube(IBlockState state) {
        return false;
    }

    @Override
    public BlockRenderLayer getBlockLayer() {
        return BlockRenderLayer.SOLID;
    }

    @SuppressWarnings("deprecation")
    @Override
    public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
        return BOUNDING_BOX;
    }

    @SuppressWarnings("deprecation")
    @Override
    public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn) {
        super.addCollisionBoxToList(pos, entityBox, collidingBoxes, BOUNDING_BOX);
    }

    //WIP. Pretty much is responsible for the particle effects this block emits.
    //TODO: Make this emit special particles based on what item is contained.
    @SideOnly(Side.CLIENT)
    @SuppressWarnings("incomplete-switch")
    public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
    {
        double d0 = (double)pos.getX() + 0.5D;
        double d1 = (double)pos.getY() + rand.nextDouble() * 6.0D / 16.0D;
        double d2 = (double)pos.getZ() + 0.5D;
        double d3 = rand.nextDouble() * 0.6D - 0.3D;

        if (rand.nextDouble() < 0.3D)
        {
            worldIn.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FIRE_AMBIENT, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
        }

        if(worldIn.isRemote)
        {
            TileEntity tileEntity = worldIn.getTileEntity(pos);
            if (tileEntity instanceof TileEntityBonfire)
            {
                TileEntityBonfire bonfire = (TileEntityBonfire) tileEntity;
                if(bonfire.shardCount > 0)
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.CRIT, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                }
                else if(bonfire.ashCount > 0)
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                }
                else if(bonfire.blazerodCount > 0)
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    if(rand.nextDouble() > 0.3D)
                    {
                        worldIn.spawnParticle(EnumParticleTypes.LAVA, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    }
                }
                else
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                }
            }
        }
    }


    //This pretty much tells the TileEntity class what to do based on what's right-clicking it.
    @Override
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
        if(!worldIn.isRemote)
        {
            TileEntity tileEntity = worldIn.getTileEntity(pos);
            if(tileEntity instanceof TileEntityBonfire)
            {
                TileEntityBonfire bonfire = (TileEntityBonfire) tileEntity;
                if(heldItem != null)
                {
                    if (heldItem.getItem() == ModItems.estus_shard)
                    {
                        if(bonfire.addShard())
                        {
                            heldItem.stackSize--;
                            return true;
                        }
                    }
                    else if (heldItem.getItem() == ModItems.estus_ash)
                    {
                        if(bonfire.addAsh())
                        {
                            heldItem.stackSize--;
                            return true;
                        }
                    }
                    else if (heldItem.getItem() == ModItems.estus_flask)
                    {
                        bonfire.estusRestock(heldItem);
                        return true;
                    }
                    else if (heldItem.getItem() == Items.BLAZE_ROD)
                    {
                        if(bonfire.addBlazeRod())
                        {
                            heldItem.stackSize--;
                            return true;
                        }
                    }
                    else if(heldItem.getItem() == Items.PRISMARINE_SHARD || (heldItem.getItem() == Items.SKULL && heldItem.getMetadata() == 1))
                    {
                        bonfire.bonfireCraft(heldItem);
                        return true;
                    }
                }
                bonfire.removeShard();
                bonfire.removeAsh();
                bonfire.removeBlazeRod();
            }
        }
        return true;
    }

    //Basically makes a new TileEntity when this is placed.
    @Override
    public TileEntity createNewTileEntity(World worldIn, int meta)
    {
        return new TileEntityBonfire();
    }
}

 

And the TileEntity code:

[spoiler=Tile Entity code]

package com.t10a.crystalflask.tileentity;

import com.t10a.crystalflask.init.ModItems;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;

public class TileEntityBonfire extends TileEntity
{
    //Variables telling the TileEntity what's currently contained.
    public int shardCount = 0;
    public int ashCount = 0;
    public int blazerodCount = 0;

    //This tells the block how to handle adding new Shards.
    public boolean addShard()
    {
        if (shardCount < 1 && ashCount == 0 && blazerodCount == 0)
        {
            shardCount++;
            return true;
        }
        return false;
    }
    //This tells the block how to handle removing a shard.
    public void removeShard()
    {
        if(shardCount > 0)
        {
            worldObj.spawnEntityInWorld(new EntityItem(worldObj, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, new ItemStack(ModItems.estus_shard)));
            shardCount--;
        }
    }
    //addAsh &  removeAsh does the same as addShard & removeShard, but for the Ash item. I COULD unify them under one call, but for now this works.
    public boolean addAsh()
    {
        if(ashCount < 1 && shardCount == 0 && blazerodCount == 0)
        {
            ashCount++;
            return true;
        }
        return false;
    }

    public void removeAsh()
    {
        if(ashCount > 0)
        {
            worldObj.spawnEntityInWorld(new EntityItem(worldObj, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, new ItemStack(ModItems.estus_ash)));
            ashCount--;
        }
    }

    //Same as above, but for blaze rods. I'm definitely going to unify them under 1 call eventually.
    public boolean addBlazeRod()
    {
        if(blazerodCount < 1 && shardCount == 0 && ashCount == 0)
        {
            blazerodCount++;
            return true;
        }
        return false;
    }

    public void removeBlazeRod()
    {
        if(blazerodCount > 0)
        {
            worldObj.spawnEntityInWorld(new EntityItem(worldObj, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, new ItemStack(Items.BLAZE_ROD)));
            blazerodCount--;
        }
    }

    public void bonfireCraft(ItemStack stack)
    {
        //TODO: Delete this, and make a dedicated recipe handler, so it's easier to add recipes to. For both me and addon developers.
        if(stack.getItem() == Items.PRISMARINE_SHARD && blazerodCount > 0)
        {
            worldObj.spawnEntityInWorld(new EntityItem(worldObj, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, new ItemStack(ModItems.estus_shard)));
            stack.stackSize--;
            blazerodCount--;
        }
        else if(stack.getItem() == Items.SKULL && stack.getMetadata() == 1 && blazerodCount > 0)
        {
            worldObj.spawnEntityInWorld(new EntityItem(worldObj, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, new ItemStack(ModItems.estus_ash)));
            stack.stackSize--;
            blazerodCount--;
        }
    }

    //This is a big chunk of code that used  to be on the flask. This handles the restocking the uses, and upgrading of the flask when this is called by BlockBonfire.
    public void estusRestock(ItemStack stack)
    {
        if(stack.getItem() == ModItems.estus_flask)
        {
            NBTTagCompound nbt;

            if (stack.hasTagCompound())
            {
                nbt = stack.getTagCompound();
            }
            else
            {
                nbt = new NBTTagCompound();
            }
            if (nbt.hasKey("Uses"))
            {
                if(shardCount > 0 && nbt.getInteger("Max Uses") < 12)
                {
                    nbt.setInteger("Max Uses", nbt.getInteger("Max Uses") + 1);
                    shardCount--;
                }
                else if(ashCount > 0 && nbt.getInteger("Potency") < 5)
                {
                    nbt.setInteger("Potency", nbt.getInteger("Potency") + 1);
                    ashCount--;
                }
                nbt.setInteger("Uses", nbt.getInteger("Max Uses"));
            }
            else
            {
                nbt.setInteger("Uses", 1);
                nbt.setInteger("Max Uses", 1);
                nbt.setInteger("Potency", 1);
            }
            stack.setTagCompound(nbt);
        }
    }

    //This merely saves the variables defined earlier to NBT.
    @Override
    public NBTTagCompound writeToNBT(NBTTagCompound compound)
    {
        super.writeToNBT(compound);
        compound.setInteger("ShardCount", shardCount);
        compound.setInteger("AshCount", ashCount);

        return compound;
    }

    //Similar to above, but it loads from NBT instead.
    @Override
    public void readFromNBT(NBTTagCompound compound)
    {
        super.readFromNBT(compound);
        this.shardCount = compound.getInteger("ShardCount");
        this.ashCount = compound.getInteger("AshCount");
    }
}

 

A couple things on instead of implementing ITileEntityProvider just override hasTileEntity(IBlockState state) and createTileEntity(IBlockAccess(might be World) world, IBlockState state). Next are you sure those particles are not spawning put some printlns in the if else chain.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

I am 100% sure, as I added these to the randomDisplayTick area:

[spoiler=BlockBonfire selection code]

        if(worldIn.isRemote)
        {
            TileEntity tileEntity = worldIn.getTileEntity(pos);
            if (tileEntity instanceof TileEntityBonfire)
            {
                TileEntityBonfire bonfire = (TileEntityBonfire) tileEntity;
                if(bonfire.shardCount == 1 && bonfire.ashCount == 0 && bonfire.blazerodCount ==0)
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.CRIT, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    System.out.println("SPAWNED SHARD PARTICLES");
                }
                else if(bonfire.ashCount == 1 && bonfire.shardCount == 0 && bonfire.blazerodCount == 0)
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    System.out.println("SPAWNED ASH PARTICLES");
                }
                else if(bonfire.blazerodCount == 1 && bonfire.ashCount == 0 && bonfire.shardCount == 0)
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    if(rand.nextDouble() > 0.3D)
                    {
                        worldIn.spawnParticle(EnumParticleTypes.LAVA, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    }
                    System.out.println("SPAWNED BLAZE ROD PARTICLES");
                }
                else
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    System.out.println("SPAWNED DEFAULT PARTICLES");
                }
            }
        }

 

and the log returned this when the world loaded:

[spoiler=Log Snippet]

[17:33:13] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:14] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:14] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:15] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:15] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:15] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:15] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:15] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:16] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:16] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:16] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:17] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:17] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:17] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:17] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:18] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:18] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:18] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:18] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:18] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:18] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:19] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:19] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:19] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:19] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:20] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:20] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:21] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:21] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES

 

I also added your TileEntity suggestions as well.

If I'm asking a whole bunch of questions, please don't get angry. I'm trying to learn.

Posted
  On 8/29/2016 at 7:36 AM, T-10a said:

I am 100% sure, as I added these to the randomDisplayTick area:

[spoiler=BlockBonfire selection code]

        if(worldIn.isRemote)
        {
            TileEntity tileEntity = worldIn.getTileEntity(pos);
            if (tileEntity instanceof TileEntityBonfire)
            {
                TileEntityBonfire bonfire = (TileEntityBonfire) tileEntity;
                if(bonfire.shardCount == 1 && bonfire.ashCount == 0 && bonfire.blazerodCount ==0)
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.CRIT, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    System.out.println("SPAWNED SHARD PARTICLES");
                }
                else if(bonfire.ashCount == 1 && bonfire.shardCount == 0 && bonfire.blazerodCount == 0)
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    System.out.println("SPAWNED ASH PARTICLES");
                }
                else if(bonfire.blazerodCount == 1 && bonfire.ashCount == 0 && bonfire.shardCount == 0)
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    if(rand.nextDouble() > 0.3D)
                    {
                        worldIn.spawnParticle(EnumParticleTypes.LAVA, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    }
                    System.out.println("SPAWNED BLAZE ROD PARTICLES");
                }
                else
                {
                    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1 + d3, d2, 0.0D, 0.0D, 0.0D, 0);
                    System.out.println("SPAWNED DEFAULT PARTICLES");
                }
            }
        }

 

and the log returned this when the world loaded:

[spoiler=Log Snippet]

[17:33:13] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:14] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:14] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:15] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:15] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:15] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:15] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:15] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:16] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:16] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:16] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:17] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:17] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:17] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:17] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:18] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:18] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:18] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:18] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:18] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:18] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:19] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:19] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:19] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:19] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:20] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:20] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:21] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES
[17:33:21] [Client thread/INFO] [sTDOUT/]: [com.t10a.crystalflask.blocks.BlockBonfire:randomDisplayTick:126]: SPAWNED DEFAULT PARTICLES

 

I also added your TileEntity suggestions as well.

Did you add any items? If not well I know your TileEntity is not saving as you have no overriden handleUpdateTag(...) and getDescriptionPacket(...).

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

Okay, I added a function to save & load the NBT:

[spoiler=Tile Entity snippet]

    @Override
    public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt)
    {
        NBTTagCompound tag = pkt.getNbtCompound();
        readUpdateTag(tag);
    }

    @Override
    public SPacketUpdateTileEntity getUpdatePacket()
    {
        NBTTagCompound tag = new NBTTagCompound();
        this.writeUpdateTag(tag);
        return new SPacketUpdateTileEntity(pos, getBlockMetadata(), tag);
    }

    @Override
    public NBTTagCompound getUpdateTag()
    {
        NBTTagCompound tag = super.getUpdateTag();
        writeUpdateTag(tag);
        return tag;
    }

    public void writeUpdateTag(NBTTagCompound tag)
    {
        tag.setInteger("ShardCount", this.shardCount);
        tag.setInteger("AshCount", this.ashCount);
        tag.setInteger("BlazeCount", this.blazerodCount);
    }

    public void readUpdateTag(NBTTagCompound tag)
    {
        this.shardCount = tag.getInteger("ShardCount");
        this.ashCount = tag.getInteger("AshCount");
        this.blazerodCount = tag.getInteger("BlazeCount");
    }

 

Now it does change now, but it only changes when the world is loaded (i.e. entering a world). Weird.

If I'm asking a whole bunch of questions, please don't get angry. I'm trying to learn.

Posted

Now all you need to do I think is call markDirty() in your add/remove methods. You will have an easy time adding more recipes if you use ItemStacks instead of ints BTW.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

Okay, added that marker. It works now! I'll figure out a way to get it so that it uses ItemStacks instead of ints.

If I'm asking a whole bunch of questions, please don't get angry. I'm trying to learn.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I fall into the void if I fly the rocket to the earth, and dying or respawning just brings me back to the moon.   Error Code:  Found matching world (0) for name: Overworld [00:22:40] [Client thread/INFO]:Adding world access to world net.minecraft.client.multiplayer.WorldClient@73fa708 [00:22:41] [CraftPresence/ERROR]:Asset name "overworld" does not exist, attempting to use an alternative icon "galacticscience"... [00:22:41] [CraftPresence/INFO]:To add support for this icon, please request for this icon to be added to the default Client ID or add the icon under the following name: "overworld". [00:22:41] [CraftPresence/INFO]:Fallback icon for "overworld" found! Using a fallback icon with the name "galacticscience"! [00:22:42] [Server thread/INFO]:Server attempting to transfer player IcyBlues9 to dimension 0 [00:22:42] [Server thread/ERROR]:"Silently" catching entity tracking error.   How can i fix it?      
    • If you remove armorchroma does it still crash?
    • Hello everyone!   I’ve launched a Christian Minecraft server today called “Acolyte”. Although it’s a Christian server, it’s open to anyone, but the main goal of me pursuing this was to combine two things that I love and make an area where people can talk about faith and build some cool castles. The server is meant for Java edition, 1.21.5, and has plugins such as land claiming, economy, shops, terrain generation, etc. It’s a survival / smp world, and the server address is: acolyte.mcsrv.pro   There’s a Discord server linked to it as well. It’s a place to hangout, talk about the game, have theological discussions, and hopefully meet some pretty cool people. The invite is available on the Minecraft server. I’m still new to a lot of this, and so please forgive any downtime or tweaks that I make to the server, and please give any feedback or criticism if you come up with some ideas. I truly hope you all enjoy it if you get the chance to join.   - ChedduhCheese   acolyte.mcsrv.pro
    • My Crazy Craft Updated pack for 1.16.5 crashes whenever I use items from Mowzie's Mobs that have animations. Specifically the ones that I have tried are the Ice Crystal and the Axe of a Thousand Metals. The crash only happens when I use the ability of it, aka right click, which triggers the animation. I should note that I added around 50 other mods to the pack, two of which are the Female Gender mod and More Player Models. Could they be the source of the crash? Here is the crash log: https://mclo.gs/ZhsC793
    • Hello, i've tried to make a minecraft server for my friends on old laptop. But im getting this error   ---- Minecraft Crash Report ---- WARNING: coremods are present:   DCLoadingPlugin (DummyCoreUnofficial-2.4.112.3.jar)   HCASM (HammerLib-1.12.2-2.0.6.23.jar) Contact their authors BEFORE contacting forge // I feel sad now Time: 19.06.25 22:26 Description: Exception in server tick loop java.lang.NoClassDefFoundError: net/minecraft/client/Minecraft     at nukeduck.armorchroma.ArmorChroma.<clinit>(ArmorChroma.java:23)     at java.lang.Class.forName0(Native Method)     at java.lang.Class.forName(Class.java:348)     at net.minecraftforge.fml.common.FMLModContainer.constructMod(FMLModContainer.java:539)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:498)     at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)     at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)     at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)     at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)     at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)     at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)     at com.google.common.eventbus.EventBus.post(EventBus.java:217)     at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:219)     at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:197)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:498)     at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)     at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)     at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)     at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)     at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)     at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)     at com.google.common.eventbus.EventBus.post(EventBus.java:217)     at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:136)     at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:595)     at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:98)     at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:333)     at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:125)     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:486)     at java.lang.Thread.run(Thread.java:750) Caused by: java.lang.ClassNotFoundException: net.minecraft.client.Minecraft     at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)     at java.lang.ClassLoader.loadClass(ClassLoader.java:418)     at java.lang.ClassLoader.loadClass(ClassLoader.java:351)     ... 35 more Caused by: net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerException: Exception in class transformer net.minecraftforge.fml.common.asm.transformers.SideTransformer@57fae983 from coremod FMLCorePlugin     at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:260)     at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279)     at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176)     ... 37 more Caused by: java.lang.RuntimeException: Attempted to load class bib for invalid side SERVER     at net.minecraftforge.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:62)     at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:256)     ... 39 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details:     Minecraft Version: 1.12.2     Operating System: Linux (amd64) version 6.8.0-51-generic     Java Version: 1.8.0_452, Private Build     Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Private Build     Memory: 1088926088 bytes (1038 MB) / 1634205696 bytes (1558 MB) up to 4194304000 bytes (4000 MB)     JVM Flags: 2 total; -Xms1024M -Xmx4500M     IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0     FML: MCP 9.42 Powered by Forge 14.23.5.2859 44 mods loaded, 44 mods active     States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored     | State | ID                       | Version            | Source                                        | Signature                                |     |:----- |:------------------------ |:------------------ |:--------------------------------------------- |:---------------------------------------- |     | LC    | minecraft                | 1.12.2             | minecraft.jar                                 | None                                     |     | LC    | mcp                      | 9.42               | minecraft.jar                                 | None                                     |     | LC    | FML                      | 8.0.99.99          | forge-1.12.2-14.23.5.2859.jar                 | e3c3d50c7c986df74c645c0ac54639741c90a557 |     | LC    | forge                    | 14.23.5.2859       | forge-1.12.2-14.23.5.2859.jar                 | e3c3d50c7c986df74c645c0ac54639741c90a557 |     | LC    | codechickenlib           | 3.2.3.358          | CodeChickenLib-1.12.2-3.2.3.358-universal.jar | f1850c39b2516232a2108a7bd84d1cb5df93b261 |     | LC    | ancientwarfare           | 1.12.2-2.7.0.1032  | ancientwarfare-1.12.2-2.7.0.1032.jar          | None                                     |     | LC    | ancientwarfareautomation | 1.12.2-2.7.0.1032  | ancientwarfare-1.12.2-2.7.0.1032.jar          | None                                     |     | LC    | ancientwarfarenpc        | 1.12.2-2.7.0.1032  | ancientwarfare-1.12.2-2.7.0.1032.jar          | None                                     |     | LC    | ancientwarfarestructure  | 1.12.2-2.7.0.1032  | ancientwarfare-1.12.2-2.7.0.1032.jar          | None                                     |     | LC    | ancientwarfarevehicle    | 1.12.2-2.7.0.1032  | ancientwarfare-1.12.2-2.7.0.1032.jar          | None                                     |     | L     | armorchroma              | 1.4-beta           | armorchroma-1.12.2-1.4.jar                    | None                                     |     | L     | baubles                  | 1.5.2              | Baubles-1.12-1.5.2.jar                        | None                                     |     | L     | betterburning            | 0.9.2              | BetterBurning-1.12.2-0.9.2.jar                | None                                     |     | L     | bettercaves              | 1.12.2             | bettercaves-1.12.2-2.0.4.jar                  | None                                     |     | L     | betterinvisibility       | 1.0.1              | betterinvisibility-1.0.1.jar                  | None                                     |     | L     | bettermineshafts         | 1.12.2-2.2         | BetterMineshaftsForge-1.12.2-2.2.jar          | None                                     |     | L     | bookshelf                | 2.3.590            | Bookshelf-1.12.2-2.3.590.jar                  | None                                     |     | L     | collective               | 2.11               | collective-1.12.2-2.11.jar                    | None                                     |     | L     | extendedrenderer         | v1.0               | coroutil-1.12.1-1.2.37.jar                    | None                                     |     | L     | coroutil                 | 1.12.1-1.2.37      | coroutil-1.12.1-1.2.37.jar                    | None                                     |     | L     | configmod                | v1.0               | coroutil-1.12.1-1.2.37.jar                    | None                                     |     | L     | dummycore                | 2.4.112.3.         | DummyCoreUnofficial-2.4.112.3.jar             | None                                     |     | L     | dynamictrees             | 1.12.2-0.9.22      | DynamicTrees-1.12.2-0.9.22.jar                | None                                     |     | L     | thaumcraft               | 6.1.BETA26         | Thaumcraft_1.12.2_6.1.BETA26.jar              | None                                     |     | L     | dynamictreestc           | 1.12.2-1.4.2       | DynamicTreesTC-1.12.2-1.4.2.jar               | None                                     |     | L     | hammercore               | 2.0.6.23           | HammerLib-1.12.2-2.0.6.23.jar                 | None                                     |     | L     | waila                    | 1.8.26             | Hwyla-1.8.26-B41_1.12.2.jar                   | None                                     |     | L     | jei                      | 4.16.1.302         | jei_1.12.2-4.16.1.302.jar                     | None                                     |     | L     | keepinginventory         | 2.4                | KeepingInventory-1.12.2-2.4.jar               | None                                     |     | L     | libraryex                | 1.2.1              | LibraryEx-1.12.2-1.2.1.jar                    | None                                     |     | L     | netherex                 | 2.2.4              | NetherEx-1.12.2-2.2.4.jar                     | None                                     |     | L     | recipehandler            | 0.13               | NoMoreRecipeConflict-0.13(1.12.2).jar         | None                                     |     | L     | nei                      | 2.4.3              | NotEnoughItems-1.12.2-2.4.3.245-universal.jar | None                                     |     | L     | thaumadditions           | 12.6.6             | ThaumicAdditions-1.12.2-12.6.6.jar            | None                                     |     | L     | thaumicbases             | 3.3.500.6r         | thaumicbases-3.3.500.6r.jar                   | None                                     |     | L     | thaumictinkerer          | 1.12.2-5.0-620a0c5 | thaumictinkerer-1.12.2-5.0-620a0c5.jar        | None                                     |     | L     | thaumicwaila             | 1.12.2-0.0.2       | ThaumicWaila-1.12.2-0.0.2.jar                 | None                                     |     | L     | tumbleweed               | 1.12-0.4.7         | tumbleweed-1.12-0.4.7.jar                     | None                                     |     | L     | villagespawnpoint        | 1.5                | villagespawnpoint_1.12.2-1.5.jar              | None                                     |     | L     | wawla                    | 2.6.275            | Wawla-1.12.2-2.6.275.jar                      | None                                     |     | L     | wooltostring             | 1.12.2             | WoolToString-1.12.2-1.0.0.jar                 | None                                     |     | L     | zombieawareness          | 1.12.1-1.11.16     | zombieawareness-1.12.1-1.11.16.jar            | None                                     |     | L     | betteranimalsplus        | 9.0.1              | betteranimalsplus-1.12.2-9.0.1.jar            | None                                     |     | L     | orelib                   | 3.6.0.1            | OreLib-1.12.2-3.6.0.1.jar                     | None                                     |     Loaded coremods (and transformers):  DCLoadingPlugin (DummyCoreUnofficial-2.4.112.3.jar)   DummyCore.ASM.DCASMManager HCASM (HammerLib-1.12.2-2.0.6.23.jar)   com.zeitheron.hammercore.asm.HammerCoreTransformer     Profiler Position: N/A (disabled)     Is Modded: Definitely; Server brand changed to 'fml,forge'     Type: Dedicated Server (map_server.txt)
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.