Jump to content

I'm trying to make a campfire, and idk why, Minecraft's failing


Red4X

Recommended Posts

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!

Link to comment
Share on other sites

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);
    }
}

 

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

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