|
| 1 | +package com.robotgryphon.compactcrafting.core; |
| 2 | + |
| 3 | +import com.robotgryphon.compactcrafting.CompactCrafting; |
| 4 | +import net.minecraft.block.Block; |
| 5 | +import net.minecraft.block.material.Material; |
| 6 | +import net.minecraft.item.Item; |
| 7 | +import net.minecraft.tileentity.TileEntityType; |
| 8 | +import net.minecraftforge.common.ToolType; |
| 9 | +import net.minecraftforge.eventbus.api.IEventBus; |
| 10 | +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; |
| 11 | +import net.minecraftforge.registries.DeferredRegister; |
| 12 | +import net.minecraftforge.registries.ForgeRegistries; |
| 13 | + |
| 14 | +import java.util.function.Supplier; |
| 15 | + |
| 16 | +import static com.robotgryphon.compactcrafting.CompactCrafting.MOD_ID; |
| 17 | + |
| 18 | +public class Registration { |
| 19 | + // ================================================================================================================ |
| 20 | + // REGISTRIES |
| 21 | + // ================================================================================================================ |
| 22 | + private static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MOD_ID); |
| 23 | + private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MOD_ID); |
| 24 | + private static final DeferredRegister<TileEntityType<?>> TILES_ENTITIES = DeferredRegister.create(ForgeRegistries.TILE_ENTITIES, MOD_ID); |
| 25 | + // private static final DeferredRegister<Dimension> DIMENSIONS = DeferredRegister.create(ForgeRegistries.WORLD_CARVERS, MODID);; |
| 26 | + |
| 27 | + // ================================================================================================================ |
| 28 | + // PROPERTIES |
| 29 | + // ================================================================================================================ |
| 30 | + private static Block.Properties MACHINE_BLOCK_PROPS = Block.Properties |
| 31 | + .create(Material.IRON) |
| 32 | + .hardnessAndResistance(8.0F, 20.0F) |
| 33 | + .setLightLevel(state -> 1) |
| 34 | + .harvestLevel(1) |
| 35 | + .harvestTool(ToolType.PICKAXE) |
| 36 | + .setRequiresTool(); |
| 37 | + |
| 38 | + private static Supplier<Item.Properties> BASIC_ITEM_PROPS = () -> new Item.Properties() |
| 39 | + .group(CompactCrafting.ITEM_GROUP); |
| 40 | + |
| 41 | + // ================================================================================================================ |
| 42 | + // BLOCKS |
| 43 | + // ================================================================================================================ |
| 44 | +// public static final RegistryObject<Block> MACHINE_BLOCK_TINY = BLOCKS.register("machine_tiny", () -> |
| 45 | +// new BlockCompactMachine(EnumMachineSize.TINY, MACHINE_BLOCK_PROPS)); |
| 46 | + |
| 47 | + // ================================================================================================================ |
| 48 | + // TILE ENTITIES |
| 49 | + // ================================================================================================================ |
| 50 | +// public static final RegistryObject<TileEntityType<CompactMachineTile>> MACHINE_TILE_ENTITY = TILES_ENTITIES.register("compact_machine", () -> |
| 51 | +// TileEntityType.Builder.create(CompactMachineTile::new, |
| 52 | +// MACHINE_BLOCK_TINY.get(), MACHINE_BLOCK_SMALL.get(), MACHINE_BLOCK_NORMAL.get(), |
| 53 | +// MACHINE_BLOCK_NORMAL.get(), MACHINE_BLOCK_GIANT.get(), MACHINE_BLOCK_MAXIMUM.get()) |
| 54 | +// .build(null)); |
| 55 | + |
| 56 | + // ================================================================================================================ |
| 57 | + // INITIALIZATION |
| 58 | + // ================================================================================================================ |
| 59 | + public static void init() { |
| 60 | + IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus(); |
| 61 | + |
| 62 | + BLOCKS.register(eventBus); |
| 63 | + ITEMS.register(eventBus); |
| 64 | + TILES_ENTITIES.register(eventBus); |
| 65 | + } |
| 66 | +} |
0 commit comments