Posted July 13, 20232 yr I have been making a double plant block that needs the light level property but I get the error Caused by: java.lang.IllegalArgumentException: Cannot set property EnumProperty{name=half, clazz=class net.minecraft.world.level.block.state.properties.DoubleBlockHalf, values=[upper, lower]} as it does not exist in Block{minecraft:air} and I don't how to fix it. code for the block registry: public static final RegistryObject<Block> TALL_INVERTED_END_FERN = registerBlock("tall_inverted_end_fern", () -> new ModTallInvertedEndFern(BlockBehaviour.Properties.of(Material.REPLACEABLE_PLANT).instabreak() .noCollission().sound(SoundType.GRASS).lightLevel(state -> state.getValue(ModTallInvertedEndFern.LIT) ? 15 : 0)), ModCreativeModeTab.ECHOING_VOID_TAB); code for the block class: package net.XO.echoing_void.blocks.custom; import net.XO.echoing_void.blocks.ModBlocks; import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.DoublePlantBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BooleanProperty; public class ModTallInvertedEndFern extends DoublePlantBlock { public ModTallInvertedEndFern(Properties pProperties) { super(pProperties); } @Override protected boolean mayPlaceOn(BlockState p_55920_, BlockGetter p_55921_, BlockPos p_55922_) { return p_55920_.is(ModBlocks.INVERTED_END_STONE_GRASS_BLOCK.get()) || p_55920_.is(ModBlocks.INVERTED_GREEN_END_STONE_GRASS_BLOCK.get()) || p_55920_.is(ModBlocks.INVERTED_END_DIRT_GRASS_BLOCK.get()) || super.mayPlaceOn(p_55920_, p_55921_, p_55922_); } public static final BooleanProperty LIT = BooleanProperty.create("lit"); @Override protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) { builder.add(LIT); } } Edited July 14, 20232 yr by XsistOrder new issue with the block
July 14, 20232 yr when you override a method, you usually want to call the inherited code with your own being an addition. separate issue, why "lit"? that's a furnace on/off property. don't you want an integer property?
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.