2025-05-09 08:46:18 -05:00
|
|
|
package us.minecraftchest2.hdm_mod.block;
|
|
|
|
|
|
|
|
import net.minecraft.block.AbstractBlock;
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.block.material.Material;
|
|
|
|
import net.minecraft.item.BlockItem;
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
import net.minecraftforge.eventbus.api.IEventBus;
|
|
|
|
import net.minecraftforge.fml.RegistryObject;
|
|
|
|
import net.minecraftforge.registries.DeferredRegister;
|
|
|
|
import net.minecraftforge.registries.ForgeRegistries;
|
|
|
|
import us.minecraftchest2.hdm_mod.Hdm_mod;
|
|
|
|
import us.minecraftchest2.hdm_mod.item.ModItems;
|
|
|
|
import us.minecraftchest2.hdm_mod.item.ModItemGroup;
|
|
|
|
|
|
|
|
import java.util.function.Supplier;
|
|
|
|
|
|
|
|
public class ModBlocks {
|
|
|
|
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, Hdm_mod.MOD_ID);
|
|
|
|
|
|
|
|
|
2025-05-09 08:59:57 -05:00
|
|
|
public static final RegistryObject<Block> DUST_BLOCK = registerBlock("block_of_dust",
|
2025-05-09 08:46:18 -05:00
|
|
|
() -> new Block(AbstractBlock.Properties.create(Material.ROCK).doesNotBlockMovement().harvestLevel(0)
|
2025-05-09 09:32:54 -05:00
|
|
|
.hardnessAndResistance(5f)));
|
2025-05-09 08:46:18 -05:00
|
|
|
|
|
|
|
|
2025-05-09 08:59:57 -05:00
|
|
|
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;
|
2025-05-09 08:46:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
private static <T extends Block> void registerBlockItem(String name, RegistryObject<T> block) {
|
|
|
|
ModItems.ITEMS.register(name, () -> new BlockItem(block.get(),
|
|
|
|
new Item.Properties().group(ModItemGroup.HDM_BLOCK_GROUP)));
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void register(IEventBus eventBus){
|
|
|
|
BLOCKS.register(eventBus);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|