package net.minecraft.src;
import java.util.Random;
public class BlockFerti extends Block
{
public BlockFerti(int i, int j)
{
super(i, j, Material.rock);
Texture1 = ModLoader.addOverride("/terrain.png", "/mod/Texture1F.png");
Texture2 = ModLoader.addOverride("/terrain.png", "/mod/Texture2F.png");
Texture3 = ModLoader.addOverride("/terrain.png", "/mod/Texture3F.png");
Texture4 = ModLoader.addOverride("/terrain.png", "/mod/Texture4F.png");
}
public int idDropped(int i, Random random)
{
return mod_autoFarm.Ferti.blockID;
}
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(i == 0)
{
return Texture2;
}
if(i == 1)
{
return Texture2;
}
if(i == 2)
{
switch(j)
{
case 0: return Texture1;
case 1: return Texture1;
case 2: return Texture3;
case 3: return Texture4;
}
}
if(i == 3)
{
switch(j)
{
case 0: return Texture1;
case 1: return Texture1;
case 2: return Texture4;
case 3: return Texture3;
}
}
if(i == 4)
{
switch(j)
{
case 0: return Texture3;
case 1: return Texture4;
case 2: return Texture1;
case 3: return Texture1;
}
}
else
{
switch(j)
{
case 0: return Texture4;
case 1: return Texture3;
case 2: return Texture1;
case 3: return Texture1;
}
}
return Texture1;
}
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving)
{
int l = MathHelper.floor_double((double)((entityliving.rotationYaw * 4F) / 360F) + 0.5D) & 3;
if(l == 0)
{
world.setBlockMetadataWithNotify(i, j, k, 2);
}
if(l == 1)
{
world.setBlockMetadataWithNotify(i, j, k, 1);
}
if(l == 2)
{
world.setBlockMetadataWithNotify(i, j, k, 3);
}
if(l == 3)
{
world.setBlockMetadataWithNotify(i, j, k, 0);
}
}
public int tickRate()
{
return 4;
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l) {
if (l > 0 && Block.blocksList[l].canProvidePower()) {
boolean flag = world.isBlockIndirectlyGettingPowered(i, j, k)
|| world.isBlockIndirectlyGettingPowered(i, j + 1, k);
if (flag) {
world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
}
}
}
public void updateTick(World world, int i, int j, int k, Random random)
{
if(world.isBlockIndirectlyGettingPowered(i, j, k) || world.isBlockIndirectlyGettingPowered(i, j + 1, k))
{
int m = world.getBlockMetadata(i,j,k);
switch(m)
{
case 0: int i1 = world.getBlockId(i+1, j, k);
if(i1 == Block.sapling.blockID)
{
if(!world.multiplayerWorld)
{
((BlockSapling)Block.sapling).growTree(world, i+1, j, k, world.rand);
}
}
if(i1 == Block.crops.blockID || i1 == mod_autoFarm.BleMarron.blockID)
{
if(!world.multiplayerWorld)
{
((BlockCrops)Block.crops).fertilize(world, i+1, j, k);
}
}
boolean flag = false;
if(i1 == 104)
{
flag = true;
}
else if(i1>=106 && i1<=108)
{
flag = true;
}
if(flag)
{
world.setBlockMetadataWithNotify(i+1,j,k,15);
world.setBlockMetadataWithNotify(i+1,j+1,k,15);
}
break;
case 1: int i2 = world.getBlockId(i-1, j, k);
if(i2 == Block.sapling.blockID)
{
if(!world.multiplayerWorld)
{
((BlockSapling)Block.sapling).growTree(world, i-1, j, k, world.rand);
}
}
if(i2 == Block.crops.blockID || i2 == mod_autoFarm.BleMarron.blockID)
{
if(!world.multiplayerWorld)
{
((BlockCrops)Block.crops).fertilize(world, i-1, j, k);
}
}
boolean flag2 = false;
if(i2 == 104)
{
flag2 = true;
}
else if(i2>=106 && i2<=108)
{
flag2 = true;
}
if(flag2)
{
world.setBlockMetadataWithNotify(i-1,j,k,15);
world.setBlockMetadataWithNotify(i-1,j+1,k,15);
}
break;
case 2: int i3 = world.getBlockId(i, j, k+1);
if(i3 == Block.sapling.blockID)
{
if(!world.multiplayerWorld)
{
((BlockSapling)Block.sapling).growTree(world, i, j, k+1, world.rand);
}
}
if(i3 == Block.crops.blockID || i3 == mod_autoFarm.BleMarron.blockID)
{
if(!world.multiplayerWorld)
{
((BlockCrops)Block.crops).fertilize(world, i, j, k+1);
}
}
boolean flag3 = false;
if(i3 == 104)
{
flag3 = true;
}
else if(i3>=106 && i3<=108)
{
flag3 = true;
}
if(flag3)
{
world.setBlockMetadataWithNotify(i,j,k+1,15);
world.setBlockMetadataWithNotify(i,j+1,k+1,15);
}
break;
case 3:int i4 = world.getBlockId(i, j, k-1);
if(i4 == Block.sapling.blockID)
{
if(!world.multiplayerWorld)
{
((BlockSapling)Block.sapling).growTree(world, i, j, k-1, world.rand);
}
}
if(i4 == Block.crops.blockID || i4 == mod_autoFarm.BleMarron.blockID)
{
if(!world.multiplayerWorld)
{
((BlockCrops)Block.crops).fertilize(world, i, j, k-1);
}
}
boolean flag4 = false;
if(i4 == 104)
{
flag4 = true;
}
else if(i4>=106 && i4<=108)
{
flag4 = true;
}
if(flag4)
{
world.setBlockMetadataWithNotify(i,j,k-1,15);
world.setBlockMetadataWithNotify(i,j+1,k-1,15);
}
break;
}
}
}
public int Texture1;
public int Texture2;
public int Texture3;
public int Texture4;
}