Guest User

Untitled

a guest
Jan 1st, 2017
108
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package mod.mcreator;
  2.  
  3. import net.minecraftforge.fml.relauncher.SideOnly;
  4. import net.minecraftforge.fml.relauncher.Side;
  5. import net.minecraftforge.fml.common.registry.GameRegistry;
  6. import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
  7. import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
  8. import net.minecraftforge.fml.common.event.FMLInitializationEvent;
  9.  
  10. import net.minecraft.world.gen.feature.WorldGenMinable;
  11. import net.minecraft.world.World;
  12. import net.minecraft.world.IBlockAccess;
  13. import net.minecraft.world.Explosion;
  14. import net.minecraft.util.math.BlockPos;
  15. import net.minecraft.util.math.AxisAlignedBB;
  16. import net.minecraft.util.EnumParticleTypes;
  17. import net.minecraft.util.EnumHand;
  18. import net.minecraft.util.EnumFacing;
  19. import net.minecraft.util.BlockRenderLayer;
  20. import net.minecraft.item.ItemStack;
  21. import net.minecraft.item.Item;
  22. import net.minecraft.entity.player.EntityPlayer;
  23. import net.minecraft.entity.Entity;
  24. import net.minecraft.client.renderer.block.model.ModelResourceLocation;
  25. import net.minecraft.client.Minecraft;
  26. import net.minecraft.block.state.IBlockState;
  27. import net.minecraft.block.material.Material;
  28. import net.minecraft.block.SoundType;
  29. import net.minecraft.block.Block;
  30.  
  31. import java.util.Random;
  32.  
  33. public class mcreator_nauseOre {
  34.  
  35. public mcreator_nauseOre() {
  36. }
  37.  
  38. public static BlockNauseOre block;
  39.  
  40. public static Object instance;
  41.  
  42. public int addFuel(ItemStack fuel) {
  43. return 0;
  44. }
  45.  
  46. public void serverLoad(FMLServerStartingEvent event) {
  47. }
  48.  
  49. public void preInit(FMLPreInitializationEvent event) {
  50. }
  51.  
  52. public void registerRenderers() {
  53. }
  54.  
  55. public void load(FMLInitializationEvent event) {
  56. if (event.getSide() == Side.CLIENT) {
  57. Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
  58. .register(Item.getItemFromBlock(block), 0, new ModelResourceLocation("TestEnvironmentMod:NauseOre", "inventory"));
  59. }
  60. }
  61.  
  62. static {
  63.  
  64. block = (BlockNauseOre) (new BlockNauseOre().setHardness(8.0F).setResistance(12.5F).setLightLevel(5.5F).setUnlocalizedName("NauseOre")
  65. .setLightOpacity(126).setCreativeTab(mcreator_mergingWorldTab.tab));
  66. block.setHarvestLevel("pickaxe", 3);
  67. }
  68.  
  69. public void generateSurface(World world, java.util.Random rand, int chunkX, int chunkZ) {
  70. for (int i = 0; i < 6; i++) {
  71. int randPosX = chunkX + rand.nextInt(16);
  72. int randPosY = rand.nextInt(128) + 0;
  73. int randPosZ = chunkZ + rand.nextInt(16);
  74. (new WorldGenMinable(mcreator_nauseOre.block.getDefaultState(), 8)).generate(world, rand, new BlockPos(randPosX, randPosY, randPosZ));
  75. }
  76. }
  77.  
  78. public void generateNether(World world, Random random, int chunkX, int chunkZ) {
  79. }
  80.  
  81. static class BlockNauseOre extends Block {
  82.  
  83. int a1 = 0, a2 = 0, a3 = 0, a4 = 0, a5 = 0, a6 = 0;
  84.  
  85. boolean red = false;
  86.  
  87. protected BlockNauseOre() {
  88. super(Material.IRON);
  89.  
  90. GameRegistry.registerBlock(this, "NauseOre");
  91. setSoundType(SoundType.STONE);
  92.  
  93. }
  94.  
  95. @Override
  96. public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
  97. int i = pos.getX();
  98. int j = pos.getY();
  99. int k = pos.getZ();
  100. EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
  101. world.scheduleUpdate(new BlockPos(i, j, k), this, this.tickRate(world));
  102.  
  103. }
  104.  
  105. @Override
  106. public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
  107. return red ? 15 : 0;
  108. }
  109.  
  110. @Override
  111. public int getStrongPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
  112. return red ? 15 : 0;
  113. }
  114.  
  115. @Override
  116. public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock) {
  117. int i = pos.getX();
  118. int j = pos.getY();
  119. int k = pos.getZ();
  120. EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
  121. if (world.isBlockIndirectlyGettingPowered(new BlockPos(i, j, k)) > 0) {
  122.  
  123. if (true) {
  124. world.createExplosion((Entity) null, i, j, k, 8F, true);
  125. }
  126.  
  127. }
  128. }
  129.  
  130. @Override
  131. public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random random) {
  132. EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
  133. int i = pos.getX();
  134. int j = pos.getY();
  135. int k = pos.getZ();
  136. World par1World = world;
  137. int par2 = i;
  138. int par3 = j;
  139. int par4 = k;
  140. Random par5Random = random;
  141. if (true)
  142. for (int l = 0; l < 22; ++l) {
  143. double d0 = (double) ((float) par2 + par5Random.nextFloat());
  144. double d1 = (double) ((float) par3 + par5Random.nextFloat());
  145. double d2 = (double) ((float) par4 + par5Random.nextFloat());
  146. double d3 = 0.0D;
  147. double d4 = 0.0D;
  148. double d5 = 0.0D;
  149. int i1 = par5Random.nextInt(2) * 2 - 1;
  150. d3 = ((double) par5Random.nextFloat() - 0.5D) * 0.49999999850988386D;
  151. d4 = ((double) par5Random.nextFloat() - 0.5D) * 0.49999999850988386D;
  152. d5 = ((double) par5Random.nextFloat() - 0.5D) * 0.49999999850988386D;
  153. par1World.spawnParticle(EnumParticleTypes.CRIT_MAGIC, d0, d1, d2, d3, d4, d5);
  154. }
  155.  
  156. }
  157.  
  158. @Override
  159. public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state) {
  160. EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
  161. int i = pos.getX();
  162. int j = pos.getY();
  163. int k = pos.getZ();
  164. if ((Math.random() * 100) <= 50) {
  165. world.createExplosion((Entity) null, i, j, k, 4F, true);
  166. }
  167.  
  168. }
  169.  
  170. @Override
  171. public void onBlockDestroyedByExplosion(World world, BlockPos pos, Explosion e) {
  172. EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
  173. int i = pos.getX();
  174. int j = pos.getY();
  175. int k = pos.getZ();
  176. if (true) {
  177. world.createExplosion((Entity) null, i, j, k, 2F, true);
  178. }
  179.  
  180. }
  181.  
  182. @Override
  183. public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
  184. int i = pos.getX();
  185. int j = pos.getY();
  186. int k = pos.getZ();
  187. if (true) {
  188. world.createExplosion((Entity) null, i, j, k, 4F, true);
  189. }
  190.  
  191. }
  192.  
  193. @Override
  194. public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entity, EnumHand hand, ItemStack heldItem,
  195. EnumFacing side, float hitX, float hitY, float hitZ) {
  196. int i = pos.getX();
  197. int j = pos.getY();
  198. int k = pos.getZ();
  199. if (true) {
  200. world.createExplosion((Entity) null, i, j, k, 4F, true);
  201. }
  202.  
  203. return true;
  204. }
  205.  
  206. @SideOnly(Side.CLIENT)
  207. @Override
  208. public BlockRenderLayer getBlockLayer() {
  209. return BlockRenderLayer.SOLID;
  210. }
  211.  
  212. @Override
  213. public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
  214. return new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
  215. }
  216.  
  217. @Override
  218. public int tickRate(World world) {
  219. return 10;
  220. }
  221.  
  222. @Override
  223. public int quantityDropped(Random par1Random) {
  224. return 1;
  225. }
  226.  
  227. }
  228. }
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.

×