Guest User

Classe principale

a guest
Aug 6th, 2017
27
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package fr.lavapower.harmonia.common;
  2.  
  3. import java.awt.Color;
  4.  
  5. import org.lwjgl.opengl.Display;
  6.  
  7. import cpw.mods.fml.common.FMLCommonHandler;
  8. import cpw.mods.fml.common.Mod;
  9. import cpw.mods.fml.common.Mod.EventHandler;
  10. import cpw.mods.fml.common.Mod.Instance;
  11. import cpw.mods.fml.common.SidedProxy;
  12. import cpw.mods.fml.common.event.FMLInitializationEvent;
  13. import cpw.mods.fml.common.event.FMLPostInitializationEvent;
  14. import cpw.mods.fml.common.event.FMLPreInitializationEvent;
  15. import cpw.mods.fml.common.registry.EntityRegistry;
  16. import cpw.mods.fml.common.registry.GameRegistry;
  17. import fr.lavapower.harmonia.client.TickClientHandlerEvent;
  18. import fr.lavapower.harmonia.common.blocks.OrtieBlock;
  19. import fr.lavapower.harmonia.common.blocks.SimpleBlock;
  20. import fr.lavapower.harmonia.common.blocks.StatueBlock;
  21. import fr.lavapower.harmonia.common.entity.EntityDynamite;
  22. import fr.lavapower.harmonia.common.entity.EntityMannequin;
  23. import fr.lavapower.harmonia.common.entity.TileEntityStatue;
  24. import fr.lavapower.harmonia.common.items.ItemCheatArmor;
  25. import fr.lavapower.harmonia.common.items.ItemDynamite;
  26. import fr.lavapower.harmonia.common.items.ItemExplosiveArrow;
  27. import fr.lavapower.harmonia.common.items.ItemExplosiveBow;
  28. import fr.lavapower.harmonia.common.items.ItemHeal;
  29. import fr.lavapower.harmonia.common.items.ItemLongueVue;
  30. import fr.lavapower.harmonia.common.items.ItemMannequin;
  31. import fr.lavapower.harmonia.common.items.ItemTutoPickaxe;
  32. import fr.lavapower.harmonia.common.items.ItemTutoSword;
  33. import fr.lavapower.harmonia.proxy.CommonProxy;
  34. import net.minecraft.block.Block;
  35. import net.minecraft.block.material.Material;
  36. import net.minecraft.creativetab.CreativeTabs;
  37. import net.minecraft.entity.EntityList;
  38. import net.minecraft.init.Blocks;
  39. import net.minecraft.init.Items;
  40. import net.minecraft.item.Item;
  41. import net.minecraft.item.Item.ToolMaterial;
  42. import net.minecraft.item.ItemArmor.ArmorMaterial;
  43. import net.minecraft.item.ItemFood;
  44. import net.minecraft.item.ItemStack;
  45. import net.minecraftforge.common.MinecraftForge;
  46. import net.minecraftforge.common.util.EnumHelper;
  47.  
  48. @Mod(modid = "harmonia", name = "Harmonia Mod", version = "0.2.0")
  49. public class ModHarmonia
  50. {
  51. @Instance("harmonia")
  52. public static ModHarmonia instance;
  53. public static final String MODID = "harmonia";
  54.  
  55. public static boolean zoom;
  56.  
  57. @SidedProxy(clientSide = "fr.lavapower.harmonia.proxy.ClientProxy", serverSide = "fr.lavapower.harmonia.proxy.CommonProxy")
  58. public static CommonProxy proxy;
  59.  
  60. public static Item itemMannequin, longueVue, epeeCheat, piocheCheat, viandeMoutoncru, viandeMoutoncuit, dynamite, explosiveBow, explosiveArrow, bandage, pensement, medikit, helmetCheat, plastronCheat, leggingsCheat, bootsCheat;
  61. public static Block ortie, sugarcaneBlock, charcoalBlock, flintBlock, sugarBlock, statueLP, statueDa, statueDi;
  62. WorldGeneration worldgeneration = new WorldGeneration();
  63.  
  64. public static CreativeTabs HarmoniaCreativeTabs = new HarmoniaCreativeTabs("harmonia_creative_tabs");
  65. public static ArmorMaterial armorCheat = EnumHelper.addArmorMaterial("armorCheat", 50, new int[] {10, 10, 10, 10}, 50);
  66. public static ToolMaterial toolCheat = EnumHelper.addToolMaterial("toolTuto", 3, 99999, 30.0F, 36.0F, 50);
  67.  
  68.  
  69. @EventHandler
  70. public void preInit(FMLPreInitializationEvent event)
  71. {
  72. Display.setTitle("Harmonia 0.2.0");
  73. GameRegistry.registerWorldGenerator(worldgeneration, 0);
  74. viandeMoutoncru = new ItemFood(3, 0.3F, true).setUnlocalizedName("viandeMoutoncru").setTextureName("harmonia:mouton_cru");
  75. viandeMoutoncuit = new ItemFood(8, 0.8F, true).setUnlocalizedName("viandeMoutoncuit").setTextureName("harmonia:mouton_cuit");
  76. dynamite = new ItemDynamite("dynamite").setUnlocalizedName("dynamite").setTextureName("harmonia:dynamite");
  77. explosiveBow = new ItemExplosiveBow("explosiveBow").setCreativeTab(HarmoniaCreativeTabs).setUnlocalizedName("explosiveBow").setTextureName("harmonia:explosive_bow");
  78. explosiveArrow = new ItemExplosiveArrow("explosiveArrow").setUnlocalizedName("explosiveArrow").setTextureName("harmonia:explosive_arrow");
  79. sugarcaneBlock = new SimpleBlock(Material.wood).setBlockName("sugarcaneBlock").setBlockTextureName("harmonia:sugarcane_block");
  80. charcoalBlock = new SimpleBlock(Material.rock).setBlockName("charcoalBlock").setBlockTextureName("harmonia:charcoal_block");
  81. flintBlock = new SimpleBlock(Material.rock).setBlockName("flintBlock").setBlockTextureName("harmonia:flint_block");
  82. sugarBlock = new SimpleBlock(Material.rock).setBlockName("sugarBlock").setBlockTextureName("harmonia:sugar_block");
  83. statueLP = new StatueBlock(Material.rock, "lavapower").setBlockName("statueLP").setBlockTextureName("harmonia:statue_all");
  84. statueDa = new StatueBlock(Material.rock, "damata").setBlockName("statueDa").setBlockTextureName("harmonia:statue_all");
  85. statueDi = new StatueBlock(Material.rock, "dingding").setBlockName("statueDi").setBlockTextureName("harmonia:statue_all");
  86. bandage = new ItemHeal("bandage", 4F).setUnlocalizedName("bandage").setTextureName("harmonia:bandage");
  87. pensement = new ItemHeal("pensement", 8F).setUnlocalizedName("pensement").setTextureName("harmonia:pansement");
  88. medikit = new ItemHeal("medikit", 16F).setUnlocalizedName("medikit").setTextureName("harmonia:medikit");
  89. helmetCheat = new ItemCheatArmor(armorCheat, 0).setCreativeTab(HarmoniaCreativeTabs).setUnlocalizedName("helmetCheat").setTextureName(MODID + ":helmet_cheat");
  90. plastronCheat = new ItemCheatArmor(armorCheat, 1).setCreativeTab(HarmoniaCreativeTabs).setUnlocalizedName("plastronCheat").setTextureName(MODID + ":chestplate_cheat");
  91. leggingsCheat = new ItemCheatArmor(armorCheat, 2).setCreativeTab(HarmoniaCreativeTabs).setUnlocalizedName("leggingsCheat").setTextureName(MODID + ":leggings_cheat");
  92. bootsCheat = new ItemCheatArmor(armorCheat, 3).setCreativeTab(HarmoniaCreativeTabs).setUnlocalizedName("bootsCheat").setTextureName(MODID + ":boots_cheat");
  93. epeeCheat = new ItemTutoSword(toolCheat).setCreativeTab(HarmoniaCreativeTabs).setUnlocalizedName("epeeCheat").setTextureName(MODID + ":sword_cheat");
  94. piocheCheat = new ItemTutoPickaxe(toolCheat).setCreativeTab(HarmoniaCreativeTabs).setUnlocalizedName("piocheCheat").setTextureName(MODID + ":pickaxe_cheat");
  95. longueVue = new ItemLongueVue("longvue").setUnlocalizedName("longueVue").setTextureName(MODID + ":longue_vue");
  96. itemMannequin = new ItemMannequin("mannequin").setUnlocalizedName("mannequin").setTextureName(MODID + ":mannequin");
  97. ortie = new OrtieBlock(Material.leaves).setBlockName("ortie").setBlockTextureName("harmonia:ortie");
  98.  
  99. GameRegistry.registerItem(viandeMoutoncru, "viandeMoutoncru");
  100. GameRegistry.registerItem(viandeMoutoncuit, "viandeMoutoncuit");
  101. GameRegistry.registerItem(dynamite, "dynamite");
  102. GameRegistry.registerItem(explosiveBow, "ironBow");
  103. GameRegistry.registerItem(explosiveArrow, "explosiveArrow");
  104. GameRegistry.registerBlock(sugarcaneBlock, "sugarcaneBlock");
  105. GameRegistry.registerBlock(charcoalBlock, "charcoalBlock");
  106. GameRegistry.registerBlock(flintBlock, "flintBlock");
  107. GameRegistry.registerBlock(sugarBlock, "sugarBlock");
  108. GameRegistry.registerBlock(ortie, "ortie");
  109. GameRegistry.registerBlock(statueLP, "statueLP");
  110. GameRegistry.registerBlock(statueDa, "statueDa");
  111. GameRegistry.registerBlock(statueDi, "statueDi");
  112. GameRegistry.registerItem(bandage, "bandage");
  113. GameRegistry.registerItem(pensement, "pensement");
  114. GameRegistry.registerItem(medikit, "medikit");
  115. GameRegistry.registerItem(helmetCheat, "helmetCheat");
  116. GameRegistry.registerItem(plastronCheat, "plastronCheat");
  117. GameRegistry.registerItem(leggingsCheat, "leggingsCheat");
  118. GameRegistry.registerItem(bootsCheat, "bootsCheat");
  119. GameRegistry.registerItem(epeeCheat, "epeeCheat");
  120. GameRegistry.registerItem(piocheCheat, "piocheCheat");
  121. GameRegistry.registerItem(longueVue, "longueVue");
  122. GameRegistry.registerItem(itemMannequin, "mannequin");
  123. GameRegistry.registerTileEntity(TileEntityStatue.class, "harmonia:statue");
  124.  
  125. if(event.getSide().isClient())
  126. {
  127. FMLCommonHandler.instance().bus().register(new TickClientHandlerEvent());
  128. MinecraftForge.EVENT_BUS.register(new TickClientHandlerEvent());
  129. }
  130. }
  131.  
  132. @EventHandler
  133. public void init(FMLInitializationEvent event)
  134. {
  135. proxy.registerRender();
  136. FMLCommonHandler.instance().bus().register(new Event());
  137. MinecraftForge.EVENT_BUS.register(new Event());
  138.  
  139. EntityRegistry.registerGlobalEntityID(EntityMannequin.class, "mannequin", EntityRegistry.findGlobalUniqueEntityId(), new Color(0, 255, 0).getRGB(), new Color(255, 0, 0).getRGB());
  140. EntityRegistry.registerModEntity(EntityMannequin.class, "mannequin", 420, this.instance, 40, 1, true);
  141. EntityRegistry.registerModEntity(EntityDynamite.class, "EntityDynamite", 420, ModHarmonia.instance, 32, 20, false);
  142.  
  143. GameRegistry.addRecipe(new ItemStack(dynamite), new Object[] {"XYX", "XZX", "XXX", 'X', Items.paper, 'Y', Items.string, 'Z', Items.gunpowder});
  144. GameRegistry.addRecipe(new ItemStack(sugarcaneBlock), new Object[] {"XXX", "XXX", "XXX", 'X', Items.reeds});
  145. GameRegistry.addRecipe(new ItemStack(charcoalBlock), new Object[] {"XXX", "XXX", "XXX", 'X', new ItemStack(Items.coal, 1, 1)});
  146. GameRegistry.addRecipe(new ItemStack(sugarBlock), new Object[] {"XXX", "XXX", "XXX", 'X', Items.sugar});
  147. GameRegistry.addRecipe(new ItemStack(flintBlock), new Object[] {"XXX", "XXX", "XXX", 'X', Items.flint});
  148. GameRegistry.addRecipe(new ItemStack(bandage), new Object[] {"XXX", "XYX", "XXX", 'X', Items.string, 'Y', Blocks.wool});
  149. GameRegistry.addRecipe(new ItemStack(medikit), new Object[] {"XXX", "XYX", "XXX", 'X', Items.iron_ingot, 'Y', new ItemStack(pensement)});
  150. GameRegistry.addRecipe(new ItemStack(longueVue), new Object[]{"XYX", "X X","XTX", 'X', Items.iron_ingot,'Y',Blocks.glass,'T',Items.diamond});
  151. GameRegistry.addRecipe(new ItemStack(itemMannequin), new Object[]{"XYX","YYY","XYX",'X', Items.rotten_flesh, 'Y', Items.stick});
  152. GameRegistry.addShapelessRecipe(new ItemStack(pensement), new Object[] {new ItemStack(bandage), new ItemStack(Items.slime_ball)});
  153. GameRegistry.addShapelessRecipe(new ItemStack(explosiveBow, 1), new Object[] {new ItemStack(Items.bow), new ItemStack(Items.gunpowder)});
  154. GameRegistry.addShapelessRecipe(new ItemStack(explosiveArrow, 1), new Object[] {new ItemStack(Items.arrow), new ItemStack(Items.gunpowder)});
  155. GameRegistry.addShapelessRecipe(new ItemStack(Items.reeds, 9), new Object[] {new ItemStack(sugarcaneBlock)});
  156. GameRegistry.addShapelessRecipe(new ItemStack(Items.coal, 9, 1), new Object[] {new ItemStack(charcoalBlock)});
  157. GameRegistry.addShapelessRecipe(new ItemStack(Items.flint, 9), new Object[] {new ItemStack(flintBlock)});
  158. GameRegistry.addShapelessRecipe(new ItemStack(Items.sugar, 9), new Object[] {new ItemStack(sugarBlock)});
  159. GameRegistry.addSmelting(viandeMoutoncru, new ItemStack(viandeMoutoncuit), 0F);
  160. }
  161.  
  162. @EventHandler
  163. public void postInit(FMLPostInitializationEvent event)
  164. {
  165.  
  166. }
  167. }
RAW Paste Data