Jump to content

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


T-10a

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

    • rftoolsbuilder:shielding_cutout (from lostcities-1.19-6.0.24.jar),rftoolsstorage:crafting_manager (from lostcities-1.19-6.0.24.jar),deepresonance:dense_glass (from lostcities-1.19-6.0.24.jar),restrictions:oneway (from lostcities-1.19-6.0.24.jar),restrictions:oneway_wall (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_complete (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_pane_complete (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_mossy (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_pane_mossy (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_broken (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_pane_broken (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_broken_mossy (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_pane_broken_mossy (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_vines (from lostcities-1.19-6.0.24.jar),lostruins:glassgray3x2_pane_vines (from lostcities-1.19-6.0.24.jar)[13:50:17] [main/INFO] [minecraft/RecipeManager]: Skipping loading recipe supplementaries:inspirations/blackboard_clear as it's serializer returned null[13:50:17] [main/INFO] [minecraft/RecipeManager]: Skipping loading recipe supplementaries:inspirations/flag_dye as it's serializer returned null[13:50:17] [main/INFO] [minecraft/RecipeManager]: Skipping loading recipe supplementaries:inspirations/flag_clear as it's serializer returned null[13:50:17] [main/INFO] [minecraft/RecipeManager]: Loaded 36 recipes[13:50:17] [main/INFO] [Spartan Weaponry/]: Adding Diamond Weapons to the End City Treasure Loot Table![13:50:17] [main/INFO] [Spartan Weaponry/]: Adding Longbow and Heavy Crossbow related loot to the Village Fletcher Loot Table![13:50:18] [main/INFO] [Spartan Weaponry/]: Adding Iron Weapons to the Village Weaponsmith Loot Table![13:50:18] [main/ERROR] [minecraft/ServerFunctionLibrary]: Failed to load function watching:checkjava.util.concurrent.CompletionException: java.lang.IllegalArgumentException: Whilst parsing command on line 1: Unknown or incomplete command, see below for error at position 0: <--[HERE]at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) ~[?:?] {re:mixin}at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320) ~[?:?] {re:mixin}at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1770) ~[?:?] {}at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760) ~[?:?] {}at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] {}at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] {}at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] {re:computing_frames}at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] {re:computing_frames}at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] {}Caused by: java.lang.IllegalArgumentException: Whilst parsing command on line 1: Unknown or incomplete command, see below for error at position 0: <--[HERE]at net.minecraft.commands.CommandFunction.m_77984_(CommandFunction.java:63) ~[server-1.19.2-20220805.130853-srg.jar%23299!/:?] {re:classloading}at net.minecraft.server.ServerFunctionLibrary.m_214320_(ServerFunctionLibrary.java:85) ~[server-1.19.2-20220805.130853-srg.jar%23299!/:?] {re:classloading}at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?] {}... 6 more[13:50:18] [main/INFO] [quark/]: [Automatic Recipe Unlock] Removed 3712 recipe advancements[13:50:18] [main/INFO] [minecraft/AdvancementList]: Loaded 684 advancements[13:50:18] [main/INFO] [at.dy.se.ItemLightLevels/]: Clearing item tag to light level mapping cache[13:50:18] [main/INFO] [sl.ma.fl.tr.FluidContainerTransferManager/]: Loaded 0 dynamic modifiers in 0.246528 ms[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:husbandry/wax_on with 2 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:adventure/kill_a_mob with 3 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:husbandry/bred_all_animals with 3 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:adventure/kill_all_mobs with 3 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:husbandry/make_a_sign_glow with 1 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:husbandry/balanced_diet with 3 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:husbandry/plant_seed with 1 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:nether/all_effects with 2 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:husbandry/wax_off with 2 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:adventure/adventuring_time with 1 patches[13:50:18] [main/INFO] [quark/]: Modified advancement minecraft:nether/all_potions with 1 patches[13:50:18] [main/INFO] [supplementaries/]: Loaded 8 flute songs[13:50:20] [main/INFO] [Spartan Weaponry/]: Finished initialising Weapon Traits & Attributes! Took 11.202781ms[13:50:20] [main/INFO] [supplementaries/]: Finished additional setup in 103 ms[13:50:20] [main/WARN] [minecraft/DedicatedServerProperties]: Failed to parse level-type biomesoplenty, defaulting to minecraft:normal[13:50:20] [Server thread/INFO] [minecraft/DedicatedServer]: Starting minecraft server version 1.19.2[13:50:20] [Server thread/INFO] [minecraft/DedicatedServer]: Loading properties[13:50:20] [Server thread/INFO] [minecraft/DedicatedServer]: Default game type: SURVIVAL[13:50:20] [Server thread/INFO] [minecraft/MinecraftServer]: Generating keypair[13:50:21] [Server thread/INFO] [minecraft/DedicatedServer]: Starting Minecraft server on :::25983[13:50:21] [Server thread/INFO] [minecraft/ServerConnectionListener]: Using epoll channel type[13:50:21] [Thread-0/INFO] [de.ca.ca.CaveDweller/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.ca.CaveDweller/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.st.SteveDweller/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.st.SteveDweller/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.sk.Skinstalker/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.sk.SkinwalkerOverhaul/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.sk.SkinwalkerOverhaul/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.go.Goatman/]: Server configuration has been reloaded[13:50:21] [Thread-0/INFO] [de.ca.go.Goatman/]: Server configuration has been reloaded[13:50:21] [Server thread/INFO] [at.dy.se.mo.PlayerSelfLightSource/]: item config parser identified itemstack 1 torch[13:50:21] [Server thread/INFO] [at.dy.se.mo.PlayerSelfLightSource/]: item config parser identified itemstack 1 glowstone[13:50:21] [Server thread/INFO] [at.dy.se.mo.PlayerSelfLightSource/]: item config parser finished, item count: 2[13:50:21] [Server thread/INFO] [at.dy.se.mo.PlayerSelfLightSource/]: item config parser identified itemstack 1 torch[13:50:21] [Server thread/INFO] [at.dy.se.mo.PlayerSelfLightSource/]: item config parser finished, item count: 1[13:50:21] [Server thread/INFO] [at.dy.se.mo.DroppedItemsLightSource/]: item config parser identified itemstack 1 torch[13:50:21] [Server thread/INFO] [at.dy.se.mo.DroppedItemsLightSource/]: item config parser identified itemstack 1 glowstone[13:50:21] [Server thread/INFO] [at.dy.se.mo.DroppedItemsLightSource/]: item config parser finished, item count: 2[13:50:21] [Server thread/INFO] [at.dy.se.mo.DroppedItemsLightSource/]: item config parser identified itemstack 1 torch[13:50:21] [Server thread/INFO] [at.dy.se.mo.DroppedItemsLightSource/]: item config parser finished, item count: 1[13:50:21] [Server thread/INFO] [Framework/]: Loading server configs...[13:50:22] [Server thread/INFO] [terrablender/]: Initialized TerraBlender biomes for level stem minecraft:overworld[13:50:22] [Server thread/INFO] [terrablender/]: Initialized TerraBlender biomes for level stem minecraft:the_nether[13:50:22] [Server thread/INFO] [minecraft/DedicatedServer]: Preparing level "world"[13:50:35] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing start region for dimension minecraft:overworld[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:40] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:41] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:41] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 0%[13:50:42] [Worker-Main-1/INFO] [minecraft/LoggerChunkProgressListener]: Preparing spawn area: 17%[13:50:42] [Server thread/INFO] [minecraft/LoggerChunkProgressListener]: Time elapsed: 7618 ms[13:50:42] [Server thread/INFO] [minecraft/DedicatedServer]: Done (21.501s)! For help, type "help"[13:50:42] [Server thread/INFO] [minecraft/DedicatedServer]: Starting GS4 status listener[13:50:42] [Server thread/INFO] [minecraft/GenericThread]: Thread Query Listener started[13:50:42] [Query Listener #1/INFO] [minecraft/QueryThreadGs4]: Query running on :::25983[13:50:42] [Server thread/INFO] [ne.mi.se.pe.PermissionAPI/]: Successfully initialized permission handler forge:default_handler
    • Visit WEB:  https://www.strongspellcaster.us.com New York City, NY's love spells +27732318372 *To Get Back Ex Lover* Black magic cleansing.  
    • +27732318372 MOST GIFTED VOODOO MAGIC LOST LOVE SPELLS TO BRING BACK AN EX LOVER << USA CANADA USA .. >> visit website (https://www.strongspellcaster.us.com) s.
    • The conflict arises from discrepancies between different versions of GSON. My suggestion would be to remove your dependency on GSON 2.8.6 and opt for a different approach. Instead of using the static method JsonParser.parseString, you can create a JsonParser object and then use the parse method.   JsonParser jsonParser = new JsonParser(); jsonParser.parse(jsonString)  
  • Topics

×
×
  • Create New...

Important Information

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