Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.dreaminginsanity.buildhelper;
- import net.minecraft.block.Block;
- import net.minecraft.client.settings.KeyBinding;
- import net.minecraft.item.BlockItem;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemGroup;
- import net.minecraftforge.client.event.InputEvent;
- import net.minecraftforge.client.event.InputEvent.KeyInputEvent;
- import net.minecraftforge.common.MinecraftForge;
- import net.minecraftforge.event.RegistryEvent;
- import net.minecraftforge.eventbus.api.EventPriority;
- import net.minecraftforge.eventbus.api.SubscribeEvent;
- import net.minecraftforge.fml.DistExecutor;
- import net.minecraftforge.fml.common.Mod;
- import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
- import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
- import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
- import org.apache.logging.log4j.LogManager;
- import org.apache.logging.log4j.Logger;
- import com.dreaminginsanity.buildhelper.blocks.HologramBlock;
- import com.dreaminginsanity.buildhelper.blocks.ModBlocks;
- import com.dreaminginsanity.buildhelper.setup.ClientProxy;
- import com.dreaminginsanity.buildhelper.setup.IProxy;
- import com.dreaminginsanity.buildhelper.setup.ModSetup;
- // The value here should match an entry in the META-INF/mods.toml file
- @Mod("buildhelper")
- public class BuildHelper
- {
- public static IProxy proxy = new DistExecutor.runForDist(() -> () -> () -> new ClientProxy(), () -> () -> () -> new ServerProxy());
- private static final Logger LOGGER = LogManager.getLogger();
- public static ModSetup setup = new ModSetup();
- public BuildHelper() {
- FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
- MinecraftForge.EVENT_BUS.register(this);
- }
- private void setup(final FMLCommonSetupEvent event)
- {
- setup.init();
- proxy.init();
- LOGGER.info("HERE IN SETUP!");
- }
- @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
- public static class RegistryEvents {
- @SubscribeEvent
- public static void onBlocksRegistry(final RegistryEvent.Register<Block> event) {
- event.getRegistry().registerAll(
- new HologramBlock()
- );
- LOGGER.info("Blocks Registered!");
- }
- @SubscribeEvent
- public static void onItemsRegistry(final RegistryEvent.Register<Item> event) {
- event.getRegistry().registerAll(
- new BlockItem(ModBlocks.HOLOGRAM, new Item.Properties().group(ItemGroup.MISC)).setRegistryName(ModBlocks.HOLOGRAM.getRegistryName())
- );
- LOGGER.info("Items Registered!");
- }
- @SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
- public void onEvent(KeyInputEvent event) {
- KeyBinding[] keyBindings = ClientProxy.keyBindings;
- if (keyBindings[0].isPressed())
- {
- LOGGER.info("Key binding ="+keyBindings[0].getKeyDescription());
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment