package ovh.glitchlabs.ornamentum.blocks; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.level.BlockGetter; 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.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; import net.neoforged.bus.api.IEventBus; import net.neoforged.neoforge.registries.DeferredBlock; import net.neoforged.neoforge.registries.DeferredRegister; import ovh.glitchlabs.ornamentum.Ornamentum; import ovh.glitchlabs.ornamentum.items.ModItems; import java.util.function.Supplier; public class ModBlocks { public static final DeferredRegister.Blocks BLOCKS = DeferredRegister.createBlocks(Ornamentum.MODID); //GRATES public static final DeferredBlock IRON_GRATE = registerBlock("iron_grate", () -> new GrateBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.COPPER_GRATE) .strength(5.0f, 6.0f) .noOcclusion() )); public static final DeferredBlock GOLD_GRATE = registerBlock("gold_grate", () -> new GrateBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.COPPER_GRATE) .strength(3.0f, 4.0f) .noOcclusion() )); public static final DeferredBlock DIAMOND_GRATE = registerBlock("diamond_grate", () -> new GrateBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.COPPER_GRATE) .strength(5.0f, 6.0f) .noOcclusion() )); public static final DeferredBlock NETHERITE_GRATE = registerBlock("netherite_grate", () -> new GrateBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.COPPER_GRATE) .strength(6.0f, 7.0f) .noOcclusion() .explosionResistance(1200.0f) )); public static final DeferredBlock AMETHYST_GRATE = registerBlock("amethyst_grate", () -> new GrateBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.COPPER_GRATE) .strength(3.0f, 4.0f) .noOcclusion() )); public static final DeferredBlock OBSIDIAN_GRATE = registerBlock("obsidian_grate", () -> new GrateBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.COPPER_GRATE) .strength(50.0f, 1200.0f) .noOcclusion() .explosionResistance(1200.0f) )); //GLOW BLOCK public static final DeferredBlock LIME_GLOW_BLOCK = registerBlock("lime_glow_block", () -> new Block(BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK) .emissiveRendering(((blockState, blockGetter, blockPos) -> true)) .lightLevel(blockstate -> 15) .noOcclusion()) ); public static final DeferredBlock WHITE_GLOW_BLOCK = registerBlock("white_glow_block", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_BLOCK.get()))); public static final DeferredBlock LIGHT_GRAY_GLOW_BLOCK = registerBlock("light_gray_glow_block", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_BLOCK.get()))); public static final DeferredBlock GRAY_GLOW_BLOCK = registerBlock("gray_glow_block", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_BLOCK.get()))); public static final DeferredBlock BLACK_GLOW_BLOCK = registerBlock("black_glow_block", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_BLOCK.get()))); public static final DeferredBlock BROWN_GLOW_BLOCK = registerBlock("brown_glow_block", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_BLOCK.get()))); public static final DeferredBlock RED_GLOW_BLOCK = registerBlock("red_glow_block", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_BLOCK.get()))); public static final DeferredBlock ORANGE_GLOW_BLOCK = registerBlock("orange_glow_block", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_BLOCK.get()))); public static final DeferredBlock YELLOW_GLOW_BLOCK = registerBlock("yellow_glow_block", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_BLOCK.get()))); public static final DeferredBlock GREEN_GLOW_BLOCK = registerBlock("green_glow_block", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_BLOCK.get()))); public static final DeferredBlock CYAN_GLOW_BLOCK = registerBlock("cyan_glow_block", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_BLOCK.get()))); public static final DeferredBlock LIGHT_BLUE_GLOW_BLOCK = registerBlock("light_blue_glow_block", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_BLOCK.get()))); public static final DeferredBlock BLUE_GLOW_BLOCK = registerBlock("blue_glow_block", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_BLOCK.get()))); public static final DeferredBlock PURPLE_GLOW_BLOCK = registerBlock("purple_glow_block", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_BLOCK.get()))); public static final DeferredBlock MAGENTA_GLOW_BLOCK = registerBlock("magenta_glow_block", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_BLOCK.get()))); public static final DeferredBlock PINK_GLOW_BLOCK = registerBlock("pink_glow_block", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_BLOCK.get()))); //GlowGlass public static final DeferredBlock LIME_GLOW_STAINED_GLASS = registerBlock("lime_glow_stained_glass", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS) .emissiveRendering(((blockState, blockGetter, blockPos) -> true)) .lightLevel(blockstate -> 13) .noOcclusion() .hasPostProcess((bs, br, bp) -> true)) ); public static final DeferredBlock WHITE_GLOW_STAINED_GLASS = registerBlock("white_glow_stained_glass", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_STAINED_GLASS.get()))); public static final DeferredBlock LIGHT_GRAY_GLOW_STAINED_GLASS = registerBlock("light_gray_glow_stained_glass", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_STAINED_GLASS.get()))); public static final DeferredBlock GRAY_GLOW_STAINED_GLASS = registerBlock("gray_glow_stained_glass", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_STAINED_GLASS.get()))); public static final DeferredBlock BLACK_GLOW_STAINED_GLASS = registerBlock("black_glow_stained_glass", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_STAINED_GLASS.get()))); public static final DeferredBlock BROWN_GLOW_STAINED_GLASS = registerBlock("brown_glow_stained_glass", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_STAINED_GLASS.get()))); public static final DeferredBlock RED_GLOW_STAINED_GLASS = registerBlock("red_glow_stained_glass", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_STAINED_GLASS.get()))); public static final DeferredBlock ORANGE_GLOW_STAINED_GLASS = registerBlock("orange_glow_stained_glass", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_STAINED_GLASS.get()))); public static final DeferredBlock YELLOW_GLOW_STAINED_GLASS = registerBlock("yellow_glow_stained_glass", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_STAINED_GLASS.get()))); public static final DeferredBlock GREEN_GLOW_STAINED_GLASS = registerBlock("green_glow_stained_glass", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_STAINED_GLASS.get()))); public static final DeferredBlock CYAN_GLOW_STAINED_GLASS = registerBlock("cyan_glow_stained_glass", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_STAINED_GLASS.get()))); public static final DeferredBlock LIGHT_BLUE_GLOW_STAINED_GLASS = registerBlock("light_blue_glow_stained_glass", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_STAINED_GLASS.get()))); public static final DeferredBlock BLUE_GLOW_STAINED_GLASS = registerBlock("blue_glow_stained_glass", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_STAINED_GLASS.get()))); public static final DeferredBlock PURPLE_GLOW_STAINED_GLASS = registerBlock("purple_glow_stained_glass", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_STAINED_GLASS.get()))); public static final DeferredBlock MAGENTA_GLOW_STAINED_GLASS = registerBlock("magenta_glow_stained_glass", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_STAINED_GLASS.get()))); public static final DeferredBlock PINK_GLOW_STAINED_GLASS = registerBlock("pink_glow_stained_glass", () -> new GlowGlassBlock(BlockBehaviour.Properties.ofFullCopy(LIME_GLOW_STAINED_GLASS.get()))); private static DeferredBlock registerBlock(String name, Supplier block) { DeferredBlock toReturn = BLOCKS.register(name, block); registerBlockItem(name, toReturn); return toReturn; } private static void registerBlockItem(String name, DeferredBlock block) { ModItems.ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties())); } public static void register(IEventBus eventBus) { BLOCKS.register(eventBus); } }