Jump to content

Braydongem

Members
  • Posts

    3
  • Joined

  • Last visited

Converted

  • Gender
    Male

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Braydongem's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. Could this have anything to do with it?
  2. Hello, 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) { super(Properties.create(Material.PLANTS).doesNotBlockMovement().sound(SoundType.PLANT)); this.setRegistryName(XLFoodMod.MOD_ID, name); this.setDefaultState(this.stateContainer.getBaseState().with(this.getAgeProperty(), Integer.valueOf(0))); } @OnlyIn(Dist.CLIENT) protected IItemProvider getSeedsItem() { return ItemListXL.TOMATO_SEEDS; } @OnlyIn(Dist.CLIENT) 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) { builder.add(TOMATO_PLANT_AGE); } } Edit: fixed. I forgot to add .tickRandomly() in properties.
×
×
  • Create New...

Important Information

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