Posted August 7, 20214 yr I'm creating a cactus plant for a custom desert biome. I'm having trouble with the blocks that sustain the plant. I'm trying to override the "canSustainPlant" method, but, in the game, the cactus could only be planted in normal sand. Other trouble I have is with the model of the cacti. My code: Spoiler public class DenseCactus extends CactusBlock { public DenseCactus(Properties p_i48435_1_) { super(p_i48435_1_); } @Override public boolean canSustainPlant(BlockState state, IBlockReader world, BlockPos pos, Direction facing, IPlantable plantable) { BlockState plant = plantable.getPlant(world, pos.relative(facing)); if (plant.getBlock() instanceof DenseCactus) { return BlockTags.SAND.contains(state.getBlock()) || state.getBlock() instanceof DenseCactus; } return super.canSustainPlant(state, world, pos, facing, plantable); } @Override public BlockState getPlant(IBlockReader world, BlockPos pos) { return defaultBlockState(); } } And my actual cactus model: Spoiler
August 7, 20214 yr 12 hours ago, LuccaPossamai said: I'm trying to override the "canSustainPlant" method, but, in the game, the cactus could only be planted in normal sand. Have you tried stepping through your code with the debugger? I'd set a breakpoint at the beginning of the canSustainPlant method and step through it to see what's going down.
August 7, 20214 yr 13 hours ago, LuccaPossamai said: Other trouble I have is with the model of the cacti. your model is a full block (in pixel 16*16*16) but the texture is of the cactus is not a full block (in pixel 14*16*14) take a look at the vanilla cactus model, simple copy the model and change the texture
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.