Jump to content

[FIXED] [1.14.3] Custom crop not growing


Recommended Posts



I've been trying to make my custom crop and I got stuck. The crop can be planted on farmland and growth can be sped up with bone meal but it doesn't want to grow by itself.

Any help is appreciated!


Custom crop class:

package mariot7.xlfoodmod.blocks;

import java.util.Random;

import mariot7.xlfoodmod.XLFoodMod;
import mariot7.xlfoodmod.init.ItemListXL;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.CropsBlock;
import net.minecraft.block.FarmlandBlock;
import net.minecraft.block.IGrowable;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;
import net.minecraft.state.IntegerProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.IItemProvider;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

public class TomatoPlant extends CropsBlock implements IGrowable {
	public static final IntegerProperty TOMATO_PLANT_AGE = BlockStateProperties.AGE_0_7;

    public TomatoPlant(String name)
        this.setRegistryName(XLFoodMod.MOD_ID, name);
        this.setDefaultState(this.stateContainer.getBaseState().with(this.getAgeProperty(), Integer.valueOf(0)));
    protected IItemProvider getSeedsItem()
       return ItemListXL.TOMATO_SEEDS;

    public ItemStack getItem(IBlockReader worldIn, BlockPos pos, BlockState state)
       return new ItemStack(this.getSeedsItem());
    protected boolean isValidGround(BlockState state, IBlockReader worldIn, BlockPos pos)
        return state.getBlock() instanceof FarmlandBlock;
    public IntegerProperty getAgeProperty()
        return TOMATO_PLANT_AGE;

    public int getMaxAge()
    	return 7;
    public boolean canGrow(IBlockReader worldIn, BlockPos pos, BlockState state, boolean isClient)
    	return !this.isMaxAge(state);

    public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, BlockState state)
    	return true;

    public void grow(World worldIn, Random rand, BlockPos pos, BlockState state)
    	this.grow(worldIn, pos, state);

    protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder)



Edit: fixed. I forgot to add .tickRandomly() in properties.

Edited by Braydongem
Issue fixed
  • Like 1
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.

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.


  • Create New...

Important Information

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