Guest User

main

a guest
Aug 20th, 2015
9
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.vladan899.main;
  2.  
  3. import net.minecraftforge.common.MinecraftForge;
  4. import net.minecraftforge.fml.common.FMLCommonHandler;
  5. import net.minecraftforge.fml.common.Mod;
  6. import net.minecraftforge.fml.common.Mod.EventHandler;
  7. import net.minecraftforge.fml.common.Mod.Instance;
  8. import net.minecraftforge.fml.common.SidedProxy;
  9. import net.minecraftforge.fml.common.event.FMLInitializationEvent;
  10. import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
  11. import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
  12. import net.minecraftforge.fml.common.network.IGuiHandler;
  13. import net.minecraftforge.fml.common.network.NetworkRegistry;
  14. import net.minecraftforge.fml.common.registry.GameRegistry;
  15.  
  16. import com.vladan899.MachinesRecpie.SmasherRecpie;
  17. import com.vladan899.achievements.achievementLists;
  18. import com.vladan899.blocks.BlockList;
  19. import com.vladan899.handler.FuelSmasher;
  20. import com.vladan899.handler.GuiHandler;
  21. import com.vladan899.items.ItemList;
  22. import com.vladan899.recipes.CraftingManager;
  23. import com.vladan899.recipes.RecipesRemoval;
  24. import com.vladan899.recipes.SmeltingRegistry;
  25. import com.vladan899.tileentity.TileEntitySmasher;
  26. import com.vladan899.worldGen.WorldRegster;
  27. @Mod(modid = Main.modID, name = Main.Name,version= Main.Version)
  28. public class Main {
  29.  
  30.    
  31.     public static final String modID = "xxxx";
  32.     public static final String Name = "xxxx";
  33.     public static final String Version = "Alpha 0.0.5";
  34.     public static final String ClientProxy = "com.vladan899.main.ClientProxy";
  35.     public static final String ServerProxy = "com.vladan899.main.ServerProxy";
  36.    
  37.     @SidedProxy(clientSide = Main.ClientProxy, serverSide = Main.ServerProxy)
  38.     public static ServerProxy proxy;
  39.    
  40.     @Instance(modID)
  41.     public static Main instance;
  42.    
  43.    
  44.     @EventHandler
  45.     public void PreLoad(FMLPreInitializationEvent PreEvent){
  46.         ItemList.MainRegistry();
  47.         BlockList.MainRegistry();
  48.         WorldRegster.MainRegistry();
  49.        
  50.     }
  51.    
  52.     @EventHandler
  53.     public void Load(FMLInitializationEvent Event){
  54.         RecipesRemoval.RecpieRemover();
  55.         CraftingManager.registerCrafting();        
  56.         achievementLists.MainRegistry();
  57.         new GuiHandler();
  58.        
  59.         GameRegistry.registerTileEntity(TileEntitySmasher.class, "TileEntityGrinder");
  60.        
  61.         //FuelHandlers
  62.         GameRegistry.registerFuelHandler(new FuelSmasher());
  63.        
  64.         proxy.RegisterRender();
  65.     }
  66.    
  67.     @EventHandler
  68.     public void PostLoad(FMLPostInitializationEvent PostEvent){
  69.        
  70.     }
  71. }
  72. [/code]
  73.  
  74. GuiHandler
  75. [code]package com.vladan899.handler;
  76.  
  77.  
  78.  
  79. import com.vladan899.blocks.BlockList;
  80. import com.vladan899.blocks.Gui.GuiOreSmasher;
  81. import com.vladan899.container.ContainerOreSmasher;
  82. import com.vladan899.main.Main;
  83. import com.vladan899.tileentity.TileEntitySmasher;
  84.  
  85. import net.minecraft.entity.player.EntityPlayer;
  86. import net.minecraft.tileentity.TileEntity;
  87. import net.minecraft.util.BlockPos;
  88. import net.minecraft.world.World;
  89. import net.minecraftforge.fml.common.network.IGuiHandler;
  90. import net.minecraftforge.fml.common.network.NetworkRegistry;
  91.  
  92. public class GuiHandler implements IGuiHandler{
  93.  
  94.     public GuiHandler(){
  95.         NetworkRegistry.INSTANCE.registerGuiHandler(Main.instance, this);
  96.     }
  97.    
  98.     @Override
  99.     public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
  100.        
  101.         BlockPos pos = new BlockPos(x,y,z);
  102.         TileEntity entity = world.getTileEntity(pos);
  103.         if(entity != null){
  104.         switch (ID){
  105.             case BlockList.GuiIDSmasher:
  106.                 entity = world.getTileEntity(pos);
  107.                 if(entity instanceof TileEntitySmasher){
  108.                     return new ContainerOreSmasher(player.inventory,(TileEntitySmasher)entity);
  109.                 }
  110.                 return null;
  111.             }
  112.         }
  113.         return null;
  114.     }
  115.  
  116.     @Override
  117.     public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
  118.         BlockPos pos = new BlockPos(x,y,z);
  119.         TileEntity entity = world.getTileEntity(pos);
  120.         if(entity != null){
  121.         switch (ID){
  122.             case BlockList.GuiIDSmasher:
  123.                 entity = world.getTileEntity(pos);
  124.                 if(entity instanceof TileEntitySmasher){
  125.                     return new GuiOreSmasher(player.inventory,(TileEntitySmasher)entity);
  126.                 }
  127.                 return null;
  128.             }
  129.         }
  130.         return null;
  131.     }
  132.  
  133. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×