public class BlockRedstoneOre extends Block
{
private boolean glowing;
public BlockRedstoneOre(int i, int j, boolean flag)
{
super(i, j, Material.rock);
if(flag)
{
setTickOnLoad(true);
}
glowing = flag;
}
public int tickRate()
{
return 30;
}
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer entityplayer)
{
func_320_h(world, i, j, k);
super.onBlockClicked(world, i, j, k, entityplayer);
}
public void onEntityWalking(World world, int i, int j, int k, Entity entity)
{
func_320_h(world, i, j, k);
super.onEntityWalking(world, i, j, k, entity);
}
public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
{
func_320_h(world, i, j, k);
return super.blockActivated(world, i, j, k, entityplayer);
}
private void func_320_h(World world, int i, int j, int k)
{
func_319_i(world, i, j, k);
if(blockID == Block.oreRedstone.blockID)
{
world.setBlockWithNotify(i, j, k, Block.oreRedstoneGlowing.blockID);
}
}
public void updateTick(World world, int i, int j, int k, Random random)
{
if(blockID == Block.oreRedstoneGlowing.blockID)
{
world.setBlockWithNotify(i, j, k, Block.oreRedstone.blockID);
}
}
public int idDropped(int i, Random random, int j)
{
return Item.redstone.shiftedIndex;
}
public int func_40198_a(int i, Random random)
{
return quantityDropped(random) + random.nextInt(i + 1);
}
public int quantityDropped(Random random)
{
return 4 + random.nextInt(2);
}
public void randomDisplayTick(World world, int i, int j, int k, Random random)
{
if(glowing)
{
func_319_i(world, i, j, k);
}
}
private void func_319_i(World world, int i, int j, int k)
{
Random random = world.rand;
double d = 0.0625D;
for(int l = 0; l < 6; l++)
{
double d1 = (float)i + random.nextFloat();
double d2 = (float)j + random.nextFloat();
double d3 = (float)k + random.nextFloat();
if(l == 0 && !world.isBlockOpaqueCube(i, j + 1, k))
{
d2 = (double)(j + 1) + d;
}
if(l == 1 && !world.isBlockOpaqueCube(i, j - 1, k))
{
d2 = (double)(j + 0) - d;
}
if(l == 2 && !world.isBlockOpaqueCube(i, j, k + 1))
{
d3 = (double)(k + 1) + d;
}
if(l == 3 && !world.isBlockOpaqueCube(i, j, k - 1))
{
d3 = (double)(k + 0) - d;
}
if(l == 4 && !world.isBlockOpaqueCube(i + 1, j, k))
{
d1 = (double)(i + 1) + d;
}
if(l == 5 && !world.isBlockOpaqueCube(i - 1, j, k))
{
d1 = (double)(i + 0) - d;
}
if(d1 < (double)i || d1 > (double)(i + 1) || d2 < 0.0D || d2 > (double)(j + 1) || d3 < (double)k || d3 > (double)(k + 1))
{
world.spawnParticle("reddust", d1, d2, d3, 0.0D, 0.0D, 0.0D);
}
}
}
public void onBlockDestroyedByPlayer(World world, int i, int j, int k, int l)
{
Random generator = new Random();
int roll = generator.nextInt(99) + 1;
int l1 = generator.nextInt(5) + 1;
if(roll < 50){
world.entityJoinedWorld(new EntityXPOrb(world, i, j, k, l1));
System.out.println("----------");
System.out.println(l1 + " XP GIVEN");
}
}
protected ItemStack func_41049_c_(int i)
{
return new ItemStack(Block.oreRedstone);
}
}
package net.minecraft.src;
import java.util.Random;
// Referenced classes of package net.minecraft.src:
// Block, Material, Item
public class BlockOre extends Block
{
public BlockOre(int i, int j)
{
super(i, j, Material.rock);
}
public int idDropped(int i, Random random, int j)
{
if(blockID == Block.oreCoal.blockID)
{
return Item.coal.shiftedIndex;
}
if(blockID == Block.oreDiamond.blockID)
{
return Item.diamond.shiftedIndex;
}
if(blockID == Block.oreLapis.blockID)
{
return Item.dyePowder.shiftedIndex;
} else
{
return blockID;
}
}
public int quantityDropped(Random random)
{
if(blockID == Block.oreLapis.blockID)
{
return 4 + random.nextInt(5);
} else
{
return 1;
}
}
public void onBlockDestroyedByPlayer(World world, int i, int j, int k, int l)
{
Random generator = new Random();
int roll = generator.nextInt(99) + 1;
if(blockID == Block.oreDiamond.blockID && roll < 50){
world.entityJoinedWorld(new EntityXPOrb(world, i, j, k, 10));
System.out.println("----------");
System.out.println("10 XP GIVEN FROM DIAMOND");
System.out.println("----------");
} else{
System.out.println("----------");
System.out.println("0 XP GIVEN");
System.out.println("----------");
}
if(blockID == Block.oreCoal.blockID && roll < 50){
world.entityJoinedWorld(new EntityXPOrb(world, i, j, k, 1));
System.out.println("----------");
System.out.println("1 XP GIVEN FROM COAL");
System.out.println("----------");
} else{
System.out.println("----------");
System.out.println("0 XP GIVEN");
System.out.println("----------");
}
if(blockID == Block.oreLapis.blockID && roll < 50){
world.entityJoinedWorld(new EntityXPOrb(world, i, j, k, 3));
System.out.println("----------");
System.out.println("3 XP GIVEN FROM LAPIS");
System.out.println("----------");
} else{
System.out.println("----------");
System.out.println("0 XP GIVEN");
System.out.println("----------");
}
}
public int func_40198_a(int i, Random random)
{
if(i > 0 && blockID != idDropped(0, random, i))
{
int j = random.nextInt(i + 2) - 1;
if(j < 0)
{
j = 0;
}
return quantityDropped(random) * (j + 1);
} else
{
return quantityDropped(random);
}
}
protected int damageDropped(int i)
{
return blockID != Block.oreLapis.blockID ? 0 : 4;
}
}
package net.minecraft.src;
import java.util.Random;
// Referenced classes of package net.minecraft.src:
// Block, Material
public class BlockStone extends Block
{
public BlockStone(int i, int j)
{
super(i, j, Material.rock);
}
public int idDropped(int i, Random random, int j)
{
return Block.cobblestone.blockID;
}
public void onBlockDestroyedByPlayer(World world, int i, int j, int k, int l)
{
Random generator = new Random();
int roll = generator.nextInt(99) + 1;
if(roll < 20){
world.entityJoinedWorld(new EntityXPOrb(world, i, j, k, 1));
world.entityJoinedWorld(new EntityPig(world));
System.out.println("----------");
System.out.println("1 XP GIVEN");
}
/* if(roll < 10){
world.entityJoinedWorld(new EntityXPOrb(world, i, j, k, 3));
System.out.println("2 XP GIVEN");
System.out.println("----------");
} else{
System.out.println("0 XP GIVEN");
System.out.println("----------");
}
*/
}
}