Posted May 9, 20241 yr Made a block, copies exactly the soul campfire. But when I start Minecraft, it starts, and right before it goes into full screen, it errors out. That's when I get 2 of these: Caused by: java.lang.IllegalArgumentException: Cannot get property BooleanProperty{name=lit, clazz=class java.lang.Boolean, values=[true, false]} as it does not exist in Block{minecraft:air} And 2 of these: Caused by: java.lang.NullPointerException: Registry Object not present: revive:block_campfire Thanks!
May 9, 20241 yr Can you post your ModBlocks class where you've registered the block, as well as which version of Minecraft you are using?
May 10, 20241 yr Author Oh yea, 1.20.6 forge 50.0.5 package net.Red4X.Revive; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; import java.util.function.Supplier; public class ModBlocks { public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, TheRevival.MODID); public static final RegistryObject<Block> BLOCK_CAMPFIRE = registerBlock( () -> new Block(BlockBehaviour.Properties.ofFullCopy(Blocks.SOUL_CAMPFIRE))); private static <T extends Block> RegistryObject<T> registerBlock(Supplier<T> block) { RegistryObject<T> toReturn = BLOCKS.register("block_campfire", block); registerBlockItem(toReturn); return toReturn; } private static <T extends Block> RegistryObject<Item> registerBlockItem(RegistryObject<T> block) { return ModItems.ITEMS.register("block_campfire", () -> new BlockItem(block.get(), new Item.Properties())); } public static void register(IEventBus EventBus){ BLOCKS.register(EventBus); } }
May 10, 20241 yr Ah; you can't just copy the properties, you need to use the same block class as the soul campfire.
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.