Something went wrong. Try again.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839package net.lupeydev.firstforge.block;
import net.lupeydev.firstforge.FirstForge;import net.lupeydev.firstforge.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.SoundType;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, FirstForge.MOD_ID);
public static final RegistryObject<Block> KULCS_BLOCK = registerBlock("kulcs_block", () -> new Block(BlockBehaviour.Properties.of() .strength(4f).requiresCorrectToolForDrops().sound(SoundType.GLASS)));
public 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> void registerBlockItem(String name, RegistryObject<T> block){ ModItems.ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties())); }
public static void register(IEventBus eventBus){ BLOCKS.register(eventBus); }}