• Recently Browsing

    No registered users viewing this page.

  • Posts

    • Alright after checking the lilypad item I finally got it working. Thanks so much guys.   And for everyone who has the same question:   This was the right solution for the CustomCrop class: @Override protected boolean isValidGround(BlockState state, IBlockReader worldIn, BlockPos pos) { FluidState fluidstate = worldIn.getFluidState(pos); FluidState fluidstate1 = worldIn.getFluidState(pos.up()); return (fluidstate.getFluid() == Fluids.WATER || state.getMaterial() == Material.ICE) && fluidstate1.getFluid() == Fluids.EMPTY; }   And this for the CustomSeed class: /** * Called when this item is used when targetting a Block */ public ActionResultType onItemUse(ItemUseContext context) { return ActionResultType.PASS; } /** * Called to trigger the item's "innate" right click behavior. To handle when this item is used on a Block, see * {@link #onItemUse}. */ public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { BlockRayTraceResult blockraytraceresult = rayTrace(worldIn, playerIn, RayTraceContext.FluidMode.SOURCE_ONLY); BlockRayTraceResult blockraytraceresult1 = blockraytraceresult.withPosition(blockraytraceresult.getPos().up()); ActionResultType actionresulttype = super.onItemUse(new ItemUseContext(playerIn, handIn, blockraytraceresult1)); return new ActionResult<>(actionresulttype, playerIn.getHeldItem(handIn)); }  
    • First, thanks for your help! 😃   The reason why I used isIn() was because nether warts use this to check if it is soulsand: protected boolean isValidGround(BlockState state, IBlockReader worldIn, BlockPos pos) { return state.isIn(Blocks.SOUL_SAND); }   I checked how it is done with lilypads before and that didn't do anything either.   So checking if the State at the position is water and the position above is empty would be:   public class BelladonnaCrop extends CropsBlock { private static final VoxelShape[] SHAPES = new VoxelShape[]{Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D), Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 4.0D, 16.0D), Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 6.0D, 16.0D), Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D), Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 10.0D, 16.0D), Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 12.0D, 16.0D), Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 14.0D, 16.0D), Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 16.0D, 16.0D)}; public BelladonnaCrop(Properties builder) { super(builder); } @Override protected IItemProvider getSeedsItem() { return ItemRegister.BELLADONNA_SEEDS.get(); } @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { return SHAPES[state.get(this.getAgeProperty())]; } @Override public boolean canSustainPlant(BlockState state, IBlockReader world, BlockPos pos, Direction facing, IPlantable plantable) { return super.canSustainPlant(state, world, pos, facing, plantable); } @Override protected boolean isValidGround(BlockState state, IBlockReader worldIn, BlockPos pos) { FluidState fluidstate = worldIn.getFluidState(pos); FluidState fluidstate1 = worldIn.getFluidState(pos.up()); return (fluidstate.getFluid() == Fluids.WATER || state.getMaterial() == Material.ICE) && fluidstate1.getFluid() == Fluids.EMPTY; } }   Weird thing about it is that it still works on farmland even though I have overridden the isValidGround function. 😅   Could it be that I need to create a custom event for rightclicking with the seeds as soon as I dont use farmland?    
    • After you have your crop block, then look into how the lilypad item works.
    • the whole point of the Data Generators is for the dev to not waste time writing (copying and pasting) repetitive json it automates the whole process of generating data. sometimes it is better to write the json by hand, but if the project is quite big, looking into Data Generators is definetelly the way to go, not only for loot tables, but for everything that uses json erally, such as block and item models, blockstates, lang files, recipe files and tags. it does save a lot of time, I can guarantee that
    • I just reimported my gradle project and now it works.
  • Topics

  • Who's Online (See full list)