Guest User

Untitled

a guest
Jul 25th, 2014
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.32 KB | None | 0 0
  1. package lavaInfusionBlocks;
  2.  
  3. import java.util.Random;
  4.  
  5. import lavaInfusionMain.Base;
  6. import lavaInfusionTileEntity.TileEntityStonePedestal;
  7. import net.minecraft.block.BlockContainer;
  8. import net.minecraft.block.material.Material;
  9. import net.minecraft.init.Blocks;
  10. import net.minecraft.tileentity.TileEntity;
  11. import net.minecraft.world.World;
  12.  
  13. public class StonePedestal extends BlockContainer
  14. {
  15.     public StonePedestal()
  16.     {
  17.         super(Material.rock);
  18.        
  19.         this.setBlockName(Base.MODID + "_" + "stonePedestal");
  20.         this.setBlockTextureName(Base.MODID + ":" + "stonePedestal");
  21.        
  22.         this.setHardness(15.0F);
  23.         this.setTickRandomly(true);
  24.        
  25.         this.setCreativeTab(Base.tabLavaInfused);
  26.        
  27.         this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.8F, 0.75F);
  28.     }
  29.    
  30.     //Updates block randomly, used to create Pulsating Obsidian
  31.     @Override
  32.     public void updateTick(World world, int x, int y, int z, Random rand)
  33.     {
  34.         super.updateTick(world, x, y, z, rand);
  35.  
  36.         //Slows it down
  37.         if(rand.nextInt(15) == 0)
  38.         {
  39.             if(world.getBlock(x, y - 1, z) == Base.pulsatingObsidian)
  40.             {
  41.                 createMagmaFoundation(world, x, y, z);
  42.             }
  43.         }
  44.     }
  45.    
  46.     //Process to create the magma foundation once the updateTick sends
  47.     public void createMagmaFoundation(World world, int x, int y, int z)
  48.     {
  49.         //Sets lower block to obsidian
  50.         world.setBlock(x, y - 1, z, Blocks.obsidian);
  51.        
  52.         Random rand = new Random();
  53.         float f = (float)x + rand.nextFloat();
  54.         float f1 = (float)(y + 0.5) + rand.nextFloat() * 0.001F;
  55.         float f2 = (float)z + rand.nextFloat();
  56.        
  57.         //Fancifys
  58.         world.playSoundEffect((double)x + 0.5D, (double)y + 0.5D, (double)z + 0.5D, "random.explode", 1.0F, world.rand.nextFloat() * 0.1F + 0.9F);
  59.         for(int j = 0; j < 20; j++)
  60.         {
  61.             world.spawnParticle("largeexplode", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
  62.         }
  63.        
  64.         //Sets to stone pedestal to magma foundation
  65.         world.setBlock(x, y, z, Base.magmaFoundation);
  66.     }
  67.    
  68.     @Override
  69.     public TileEntity createNewTileEntity(World world, int par2)
  70.     {
  71.         return new TileEntityStonePedestal();
  72.     }
  73.    
  74.     @Override
  75.     public int getRenderType()
  76.     {
  77.         return -1;
  78.     }
  79.    
  80.     @Override
  81.     public boolean isOpaqueCube()
  82.     {
  83.         return false;
  84.     }
  85.    
  86.     @Override
  87.     public boolean renderAsNormalBlock()
  88.     {
  89.         return false;
  90.     }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment