Advertisement
hassansyyid

CommonProxy

Nov 12th, 2015
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.71 KB | None | 0 0
  1. package io.github.hsyyid.wilsonsmp.proxies;
  2.  
  3. import io.github.hsyyid.wilsonsmp.armor.DivingArmor;
  4. import io.github.hsyyid.wilsonsmp.blocks.BlockReadableBookshelf;
  5. import io.github.hsyyid.wilsonsmp.blocks.IceBlock;
  6. import io.github.hsyyid.wilsonsmp.blocks.SnowBlock;
  7. import io.github.hsyyid.wilsonsmp.creativetabs.WilsonSMPMiscCreativeTab;
  8. import io.github.hsyyid.wilsonsmp.eventhandlers.BlockPlaceEventHandler;
  9. import io.github.hsyyid.wilsonsmp.eventhandlers.EntityInteractEventHandler;
  10. import io.github.hsyyid.wilsonsmp.eventhandlers.LivingFallEventHandler;
  11. import io.github.hsyyid.wilsonsmp.eventhandlers.PlayerInteractEventHandler;
  12. import io.github.hsyyid.wilsonsmp.eventhandlers.ServerTickEventHandler;
  13. import io.github.hsyyid.wilsonsmp.items.ItemBandage;
  14. import io.github.hsyyid.wilsonsmp.items.ItemHomestone;
  15. import io.github.hsyyid.wilsonsmp.items.ItemSignalGun;
  16. import io.github.hsyyid.wilsonsmp.items.ItemSignalRounds;
  17. import io.github.hsyyid.wilsonsmp.tileentities.TileEntityReadableBookshelf;
  18. import net.minecraft.block.Block;
  19. import net.minecraft.creativetab.CreativeTabs;
  20. import net.minecraft.init.Items;
  21. import net.minecraft.item.Item;
  22. import net.minecraft.item.ItemArmor.ArmorMaterial;
  23. import net.minecraft.item.ItemStack;
  24. import net.minecraftforge.common.MinecraftForge;
  25. import net.minecraftforge.fml.common.FMLCommonHandler;
  26. import net.minecraftforge.fml.common.event.FMLInitializationEvent;
  27. import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
  28. import net.minecraftforge.fml.common.registry.ExistingSubstitutionException;
  29. import net.minecraftforge.fml.common.registry.GameRegistry;
  30. import net.minecraftforge.oredict.OreDictionary;
  31.  
  32. public class CommonProxy
  33. {
  34.     public static CreativeTabs wilsonSMPMisc;
  35.  
  36.     public static Item itemHomestone;
  37.     public static Item itemDivingHelmet;
  38.     public static Item itemSignalGun;
  39.     public static Item itemSignalRounds;
  40.     public static Item itemBandage;
  41.  
  42.     public static Block snowBlock;
  43.     public static Block iceBlock;
  44.     public static Block readableBookshelf;
  45.  
  46.     public void intializeCreativeTabs(FMLPreInitializationEvent event)
  47.     {
  48.         wilsonSMPMisc = new WilsonSMPMiscCreativeTab(CreativeTabs.getNextID(), "wilsonSMPMiscCreativeTab");
  49.     }
  50.  
  51.     public void registerItemsAndBlocks(FMLPreInitializationEvent event)
  52.     {
  53.         itemHomestone = new ItemHomestone().setUnlocalizedName("itemHomestone").setCreativeTab(wilsonSMPMisc);
  54.         itemDivingHelmet = new DivingArmor(ArmorMaterial.DIAMOND, 0, 0).setUnlocalizedName("itemDivingHelmet");
  55.         itemSignalRounds = new ItemSignalRounds().setUnlocalizedName("itemSignalRounds").setCreativeTab(wilsonSMPMisc);
  56.         itemSignalGun = new ItemSignalGun(itemSignalRounds).setUnlocalizedName("itemSignalGun").setCreativeTab(wilsonSMPMisc);
  57.         itemBandage = new ItemBandage().setUnlocalizedName("itemBandage").setCreativeTab(wilsonSMPMisc);
  58.  
  59.         snowBlock = new SnowBlock();
  60.         iceBlock = new IceBlock();
  61.         readableBookshelf = new BlockReadableBookshelf().setUnlocalizedName("blockReadableBookshelf").setCreativeTab(wilsonSMPMisc);
  62.  
  63.         GameRegistry.registerItem(itemHomestone, "itemHomestone");
  64.         GameRegistry.registerItem(itemDivingHelmet, "itemDivingHelmet");
  65.         GameRegistry.registerItem(itemSignalRounds, "itemSignalRounds");
  66.         GameRegistry.registerItem(itemSignalGun, "itemSignalGun");
  67.         GameRegistry.registerItem(itemBandage, "itemBandage");
  68.  
  69.         GameRegistry.registerBlock(readableBookshelf, "blockReadableBookshelf");
  70.     }
  71.  
  72.     public void registerCraftingRecipies(FMLPreInitializationEvent event)
  73.     {
  74.         GameRegistry.addShapelessRecipe(new ItemStack(itemHomestone, 1), new ItemStack(Items.ender_pearl, 1), new ItemStack(itemHomestone, 1, OreDictionary.WILDCARD_VALUE));
  75.     }
  76.  
  77.     public void registerRenderers(FMLInitializationEvent event)
  78.     {
  79.         ;
  80.     }
  81.  
  82.     public void registerSubstitutedBlocks(FMLInitializationEvent event)
  83.     {
  84.         try
  85.         {
  86.             GameRegistry.addSubstitutionAlias("minecraft:snow", GameRegistry.Type.BLOCK, snowBlock);
  87.             GameRegistry.addSubstitutionAlias("minecraft:ice", GameRegistry.Type.BLOCK, iceBlock);
  88.         }
  89.         catch (ExistingSubstitutionException e)
  90.         {
  91.             System.out.println("Failed to replace ice block");
  92.             e.printStackTrace();
  93.         }
  94.     }
  95.  
  96.     public void registerEventHandlers(FMLInitializationEvent event)
  97.     {
  98.         MinecraftForge.EVENT_BUS.register(new PlayerInteractEventHandler());
  99.         MinecraftForge.EVENT_BUS.register(new LivingFallEventHandler());
  100.         MinecraftForge.EVENT_BUS.register(new EntityInteractEventHandler());
  101.         MinecraftForge.EVENT_BUS.register(new BlockPlaceEventHandler());
  102.         FMLCommonHandler.instance().bus().register(new ServerTickEventHandler());
  103.     }
  104.  
  105.     public void registerTileEntities(FMLInitializationEvent event)
  106.     {
  107.         GameRegistry.registerTileEntity(TileEntityReadableBookshelf.class, "tileEntityReadableBookshelf");
  108.     }
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement