Jump to content

Recommended Posts

Posted

I am trying to register a new Block but in 1.20.4 there seems to be no BlockBehaviour.Properties.copy() anymore, and i have no clue how to use BlockBehaviour.Properties.of() and can't find a documentation for it (other sources stated i can but Material.STONE in it but that doesnt work either). Here is the part where i'm stuck:

public static final RegistryObject<Block> RADIO= registerBlock("radio", () -> new Block(BlockBehaviour.Properties.of()

and this is my whole class yet:
 

package de.groupxyz.radiomod.block; import de.groupxyz.radiomod.RadioMod; import de.groupxyz.radiomod.item.ModItems; 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.state.BlockBehaviour; 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, RadioMod.MODID); public static final RegistryObject<Block> RADIO= registerBlock("radio", () -> new Block(BlockBehaviour.Properties.of() private static <T extends Block> RegistryObject<T> registerBlock(String name, Supplier<T> block) { RegistryObject<T> toReturn = BLOCKS.register(name, block); registerBlockItem(name, toReturn); return toReturn; } private static <T extends Block>RegistryObject<Item> registerBlockItem(String name, RegistryObject<T> block) { return ModItems.ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties())); } public static void register(IEventBus eventBus) { BLOCKS.register(eventBus); } }

Thanks for any help!

  • 1 month later...
Posted

Yes, it is quite annoying how there are not any very handy ways to find ways to fix errors, however you can just simply use 

.of()

and specify the properties, here is it used in a example peice of code for a mod I am creating

public static final RegistryObject<Block> HYPER_ORE = registerBlock("hyper_ore",
            () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.METAL).instrument(NoteBlockInstrument.IRON_XYLOPHONE).requiresCorrectToolForDrops().strength(5.0F, 6.0F).sound(SoundType.METAL)));

Hope this helped for your 1.20.4 mod!

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.

Announcements



×
×
  • Create New...

Important Information

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