Advertisement
Guest User

MC Forge Block drop gem

a guest
Jul 24th, 2014
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.74 KB | None | 0 0
  1. package com.kerowin.greaterWorld.Blocks;
  2.  
  3. import net.minecraft.block.Block;
  4. import net.minecraft.block.material.Material;
  5. import net.minecraft.entity.item.EntityItem;
  6. import net.minecraft.item.ItemStack;
  7. import net.minecraft.world.World;
  8.  
  9. import com.kerowin.greaterWorld.GreaterWorld;
  10.  
  11. public class BlockGlowingShardOre extends Block {
  12.  
  13.     public BlockGlowingShardOre(Material material) {
  14.         super(material);
  15.         // TODO Auto-generated constructor stub
  16.                
  17.         setBlockName("BlockGlowingShardOre");
  18.         setBlockTextureName("gw:stone");
  19.         setCreativeTab(GreaterWorld.tabGraterWorldBlocks);
  20.        
  21.         setResistance(15.0F);
  22.         setHardness(3.0F);
  23.        
  24.         setLightOpacity(50);
  25.         setLightLevel(5.0F);
  26.     }
  27.    
  28.     protected void dropBlockAsItem(World p_149642_1_, int p_149642_2_, int p_149642_3_, int p_149642_4_, ItemStack p_149642_5_)
  29.     {
  30.         if (!p_149642_1_.isRemote && p_149642_1_.getGameRules().getGameRuleBooleanValue("doTileDrops"))
  31.         {
  32.             if (captureDrops.get())
  33.             {
  34.                 capturedDrops.get().add(new ItemStack(GreaterWorld.itemGlowingShard));
  35.                 return;
  36.             }
  37.             float f = 0.7F;
  38.             double d0 = (double)(p_149642_1_.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
  39.             double d1 = (double)(p_149642_1_.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
  40.             double d2 = (double)(p_149642_1_.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
  41.             EntityItem entityitem = new EntityItem(p_149642_1_, (double)p_149642_2_ + d0, (double)p_149642_3_ + d1, (double)p_149642_4_ + d2, new ItemStack(GreaterWorld.itemGlowingShard));
  42.             entityitem.delayBeforeCanPickup = 10;
  43.             p_149642_1_.spawnEntityInWorld(entityitem);
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement