Guest User

Untitled

a guest
Jan 25th, 2019
457
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package fr.kiwiofficiel.sumaria.common;
  2.  
  3. import net.minecraft.world.gen.feature.WorldGenMinable;
  4. import net.minecraft.world.World;
  5. import net.minecraft.world.IBlockAccess;
  6. import net.minecraft.util.MathHelper;
  7. import net.minecraft.util.IIcon;
  8. import net.minecraft.item.ItemStack;
  9. import net.minecraft.item.Item;
  10. import net.minecraft.init.Items;
  11. import net.minecraft.entity.player.EntityPlayer;
  12. import net.minecraft.creativetab.CreativeTabs;
  13. import net.minecraft.client.renderer.texture.IIconRegister;
  14. import net.minecraft.client.Minecraft;
  15. import net.minecraft.block.material.Material;
  16. import net.minecraft.block.Block;
  17.  
  18. import java.util.Random;
  19.  
  20. import cpw.mods.fml.relauncher.SideOnly;
  21. import cpw.mods.fml.relauncher.Side;
  22. import cpw.mods.fml.common.registry.GameRegistry;
  23. import cpw.mods.fml.common.event.FMLServerStartingEvent;
  24. import cpw.mods.fml.common.event.FMLPreInitializationEvent;
  25.  
  26. public class adamine_ore {
  27.  
  28. public adamine_ore() {}
  29.  
  30. public static final String MODID = "sumariamod";
  31. public static Blockadamine_ore block;
  32. public static Object instance;
  33.  
  34. public int addFuel(ItemStack fuel) {
  35. return 0;
  36. }
  37.  
  38. public void serverLoad(FMLServerStartingEvent event) {
  39. }
  40.  
  41. public void preInit(FMLPreInitializationEvent event) {
  42.  
  43. GameRegistry.registerBlock(block, "adamine_ore");
  44. }
  45.  
  46. public void registerRenderers() {
  47. }
  48.  
  49. public void load() {
  50. }
  51.  
  52. static {
  53.  
  54. block = (Blockadamine_ore) (new Blockadamine_ore().setHardness(6.0F).setResistance(15.0F).setLightLevel(0.0F)
  55. .setBlockName("adamine_ore").setLightOpacity(0).setStepSound(Block.soundTypeStone).setCreativeTab(sumariatabs.tab))
  56. .setBlockTextureName(MODID + ":adamine_ore");
  57.  
  58. block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
  59. Block.blockRegistry.addObject(700, "adamine_ore", block);
  60. block.setHarvestLevel("pickaxe", 0);
  61. }
  62.  
  63. public void generateSurface(World world, java.util.Random rand, int chunkX, int chunkZ) {
  64. for (int i = 0; i < 5; i++) {
  65. int randPosX = chunkX + rand.nextInt(16);
  66. int randPosY = rand.nextInt(12) + 0;
  67. int randPosZ = chunkZ + rand.nextInt(16);
  68. (new WorldGenMinable(adamine_ore.block, 4)).generate(world, rand, randPosX, randPosY, randPosZ);
  69. }
  70. }
  71.  
  72. public void generateNether(World world, Random random, int chunkX, int chunkZ) {
  73. }
  74.  
  75. static class Blockadamine_ore extends Block {
  76.  
  77.  
  78. int a1 = 0, a2 = 0, a3 = 0, a4 = 0, a5 = 0, a6 = 0;
  79.  
  80. Random field_149942_b = new Random();
  81.  
  82. IIcon gor = null, dol = null, st1 = null, st2 = null, st3 = null, st4 = null;
  83.  
  84. boolean red = false;
  85.  
  86. public Blockadamine_ore() {
  87. super(Material.rock);
  88.  
  89. }
  90.  
  91. public void onBlockAdded(World world, int i, int j, int k) {
  92. EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
  93. if (entity != null && world != null) {
  94. int le = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
  95. world.setBlockMetadataWithNotify(i, j, k, le, 2);
  96. }
  97.  
  98. world.scheduleBlockUpdate(i, j, k, this, this.tickRate(world));
  99.  
  100. }
  101.  
  102. public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
  103. return red ? 1 : 0;
  104. }
  105.  
  106. @SideOnly(Side.CLIENT)
  107. @Override
  108. public IIcon getIcon(int i, int par2) {
  109.  
  110. if (i == 0)
  111. return gor;
  112.  
  113. else if (i == 1)
  114. return dol;
  115.  
  116. else if (i == 2)
  117. return st1;
  118.  
  119. else if (i == 3)
  120. return st2;
  121.  
  122. else if (i == 4)
  123. return st4;
  124.  
  125. else if (i == 5)
  126. return st3;
  127.  
  128. else
  129. return gor;
  130.  
  131. }
  132.  
  133. @SideOnly(Side.CLIENT)
  134. @Override
  135. public void registerBlockIcons(IIconRegister reg) {
  136. this.gor = reg.registerIcon("adamine_ore");
  137. this.dol = reg.registerIcon("adamine_ore");
  138. this.st1 = reg.registerIcon("adamine_ore");
  139. this.st2 = reg.registerIcon("adamine_ore");
  140. this.st3 = reg.registerIcon("adamine_ore");
  141. this.st4 = reg.registerIcon("adamine_ore");
  142. }
  143.  
  144. public int getRenderType() {
  145. return 0;
  146. }
  147.  
  148. @Override
  149. public int tickRate(World world) {
  150. return 12;
  151. }
  152.  
  153. public int quantityDropped(Random par1Random) {
  154. return 1;
  155. }
  156.  
  157. public Item getItemDropped(int par1, Random par2Random, int par3) {
  158. return adamine.block;
  159. }
  160. }
  161. }
RAW Paste Data