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

    • I think my save file was potentially corrupted (based on what I have been reading online). The world has loaded and saved perfectly fine for weeks. Today I added about 6 new mods and updated 3 mod libraries, and then encountered the following error: "Errors in currently selected data packs prevented the world from loading. You can either try to load it with only the vanilla data pack ("safe mode"), or go back to the title screen and fix it manually." I have tried changing to a newer Forge version, reverting the updated mods back to original versions, removing the new mods, removing and readding all mods, removing my world file and loading the forge profile and adding it back, renaming the level.dat_old file as level.dat... Nothing has worked yet. Forge loads fine and I don't want to risk trying to reload the world in "safe mode" in case I end up losing mod-related content. Not sure how that works. I am having trouble reading the output log to determine what is causing the error. Any advice is better than none!! Thank you!     Info: Minecraft 1.20.1 Forge 47.1.3 Mod list (includes which mods are disabled, newly added before this error, and any changes I found after the error) : https://pastebin.com/nquXY1Hj Latest log: https://pastebin.com/U4fD0kAt
    • It all began with a chance encounter with a testimonial shared by Olivia, a fellow traveler on the winding road of cryptocurrency. Her words spoke of a miraculous recovery orchestrated by Wizard Web Recovery, a beacon of hope in the murky waters of online fraud. Intrigued by her story, I reached out to Wizard Web Recovery, hoping they could work their magic on my blocked crypto recovery. With bated breath, I shared my plight, providing evidence of my dilemma and praying for a solution. To my astonishment, a prompt response came, swift and reassuring. Wizard Web Recovery wasted no time in assessing my situation, guiding me through the process with patience and expertise. and then like a ray of sunshine breaking through the clouds, came the news I had longed for – a new private key had been generated, restoring my precious bitcoins. It was a moment of jubilation, a triumph over adversity that filled me with newfound hope. At that moment, I realized the true power of Wizard Web Recovery, not just as skilled technicians, but as guardians of trust in the digital realm. With their assistance, I reclaimed what was rightfully mine, turning despair into determination and paving the way for a brighter future. But their capabilities did not end there. Delving deeper into their expertise, I discovered that Wizard Web Recovery possessed a wealth of knowledge in reclaiming lost stolen cryptocurrency, and even exposing fraudulent investment schemes. So to all those who find themselves entangled in the web of online fraud, take heart. With the guidance of Wizard Web Recovery, there is a path to redemption.     Write Mail; ( Wizard webrecovery AT  vprogrammer. net ) 
    • It all began with a chance encounter with a testimonial shared by Olivia, a fellow traveler on the winding road of cryptocurrency. Her words spoke of a miraculous recovery orchestrated by Wizard Web Recovery, a beacon of hope in the murky waters of online fraud. Intrigued by her story, I reached out to Wizard Web Recovery, hoping they could work their magic on my blocked crypto recovery. With bated breath, I shared my plight, providing evidence of my dilemma and praying for a solution. To my astonishment, a prompt response came, swift and reassuring. Wizard Web Recovery wasted no time in assessing my situation, guiding me through the process with patience and expertise. and then like a ray of sunshine breaking through the clouds, came the news I had longed for – a new private key had been generated, restoring my precious bitcoins. It was a moment of jubilation, a triumph over adversity that filled me with newfound hope. At that moment, I realized the true power of Wizard Web Recovery, not just as skilled technicians, but as guardians of trust in the digital realm. With their assistance, I reclaimed what was rightfully mine, turning despair into determination and paving the way for a brighter future. But their capabilities did not end there. Delving deeper into their expertise, I discovered that Wizard Web Recovery possessed a wealth of knowledge in reclaiming lost stolen cryptocurrency, and even exposing fraudulent investment schemes. So to all those who find themselves entangled in the web of online fraud, take heart. With the guidance of Wizard Web Recovery, there is a path to redemption.    
    • How can I add drops when killing an entity? Now there are no drops. How can I add an @override to change the attack speed to 1.6 and show "when in main hand...attack damage,...attack speed"? also, how can I make the item enchantable? 
    • Ok. Thanks. by the way, will this crash in any circumstances? public boolean onLeftClickEntity(ItemStack stack, Player player, Entity entity) { if (entity instanceof LivingEntity){ LivingEntity victim = (LivingEntity) entity; if(!victim.isDeadOrDying() && victim.getHealth()>0){ victim.setHealth(0); return true; } } return false; }  
  • Topics

×
×
  • Create New...

Important Information

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