2013-04-16 08:19:59 +00:00
|
|
|
package biomesoplenty.blocks;
|
2013-03-28 19:03:53 +00:00
|
|
|
|
|
|
|
import java.util.Random;
|
|
|
|
|
2013-04-19 09:35:26 +00:00
|
|
|
import biomesoplenty.BiomesOPlenty;
|
2013-04-16 08:19:59 +00:00
|
|
|
import biomesoplenty.configuration.BOPBlocks;
|
2013-04-16 06:43:45 +00:00
|
|
|
|
2013-03-28 19:03:53 +00:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.block.material.Material;
|
2013-03-30 17:14:03 +00:00
|
|
|
import net.minecraft.client.renderer.texture.IconRegister;
|
2013-03-28 19:03:53 +00:00
|
|
|
import net.minecraft.item.ItemStack;
|
2013-03-31 07:44:08 +00:00
|
|
|
import net.minecraft.util.Icon;
|
2013-03-28 19:03:53 +00:00
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
2013-04-14 23:11:00 +00:00
|
|
|
@Deprecated
|
2013-03-28 19:03:53 +00:00
|
|
|
public class BlockDeadLog extends Block
|
|
|
|
{
|
|
|
|
/** The type of tree this log came from. */
|
|
|
|
public static final String[] woodType = new String[] {"dead"};
|
2013-03-31 07:44:08 +00:00
|
|
|
private Icon[] blockIcon = new Icon[2];
|
2013-03-28 19:03:53 +00:00
|
|
|
|
|
|
|
public BlockDeadLog(int par1)
|
|
|
|
{
|
|
|
|
super(par1, Material.wood);
|
|
|
|
this.setBurnProperties(this.blockID, 5, 5);
|
2013-04-19 09:35:26 +00:00
|
|
|
this.setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
|
2013-03-28 19:03:53 +00:00
|
|
|
}
|
|
|
|
|
2013-03-30 17:14:03 +00:00
|
|
|
@Override
|
|
|
|
public void registerIcons(IconRegister par1IconRegister)
|
|
|
|
{
|
2013-03-31 07:44:08 +00:00
|
|
|
this.blockIcon[0] = par1IconRegister.registerIcon("BiomesOPlenty:logTopBottum");
|
|
|
|
this.blockIcon[1] = par1IconRegister.registerIcon("BiomesOPlenty:deadlog");
|
2013-03-30 17:14:03 +00:00
|
|
|
}
|
2013-03-31 07:44:08 +00:00
|
|
|
|
2013-04-17 00:09:59 +00:00
|
|
|
@Override
|
|
|
|
public Icon getIcon(int par1, int par2)
|
2013-03-31 07:44:08 +00:00
|
|
|
{
|
2013-04-06 22:41:24 +00:00
|
|
|
int pos = par2 & 12;
|
|
|
|
if (pos == 0 && (par1 == 1 || par1 == 0) || pos == 4 && (par1 == 5 || par1 == 4) || pos == 8 && (par1 == 2 || par1 == 3))
|
|
|
|
return blockIcon[0];
|
|
|
|
return blockIcon[1];
|
2013-03-31 07:44:08 +00:00
|
|
|
}
|
2013-03-30 17:14:03 +00:00
|
|
|
|
2013-03-28 19:03:53 +00:00
|
|
|
/**
|
|
|
|
* The type of render function that is called for this block
|
|
|
|
*/
|
|
|
|
public int getRenderType()
|
|
|
|
{
|
|
|
|
return 31;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the quantity of items to drop on block destruction.
|
|
|
|
*/
|
|
|
|
public int quantityDropped(Random par1Random)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the ID of the items to drop on destruction.
|
|
|
|
*/
|
|
|
|
public int idDropped(int par1, Random par2Random, int par3)
|
|
|
|
{
|
2013-04-05 03:41:51 +00:00
|
|
|
return BOPBlocks.deadWood.blockID;
|
2013-03-28 19:03:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ejects contained items into the world, and notifies neighbours of an update, as appropriate
|
|
|
|
*/
|
|
|
|
public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6)
|
|
|
|
{
|
|
|
|
byte var7 = 4;
|
|
|
|
int var8 = var7 + 1;
|
|
|
|
|
|
|
|
if (par1World.checkChunksExist(par2 - var8, par3 - var8, par4 - var8, par2 + var8, par3 + var8, par4 + var8))
|
|
|
|
{
|
|
|
|
for (int var9 = -var7; var9 <= var7; ++var9)
|
|
|
|
{
|
|
|
|
for (int var10 = -var7; var10 <= var7; ++var10)
|
|
|
|
{
|
|
|
|
for (int var11 = -var7; var11 <= var7; ++var11)
|
|
|
|
{
|
|
|
|
int var12 = par1World.getBlockId(par2 + var9, par3 + var10, par4 + var11);
|
|
|
|
|
|
|
|
if (var12 == Block.leaves.blockID)
|
|
|
|
{
|
|
|
|
int var13 = par1World.getBlockMetadata(par2 + var9, par3 + var10, par4 + var11);
|
|
|
|
|
|
|
|
if ((var13 & 8) == 0)
|
|
|
|
{
|
2013-03-30 17:14:03 +00:00
|
|
|
par1World.setBlockMetadataWithNotify(par2 + var9, par3 + var10, par4 + var11, var13 | 8, 2);
|
2013-03-28 19:03:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9)
|
|
|
|
{
|
|
|
|
int var10 = par9 & 3;
|
|
|
|
byte var11 = 0;
|
|
|
|
|
|
|
|
switch (par5)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
var11 = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
case 3:
|
|
|
|
var11 = 8;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
case 5:
|
|
|
|
var11 = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
return var10 | var11;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
|
|
|
|
*/
|
2013-03-30 17:14:03 +00:00
|
|
|
/*public int getBlockTextureFromSideAndMetadata(int par1, int par2)
|
2013-03-28 19:03:53 +00:00
|
|
|
{
|
|
|
|
int var3 = par2 & 12;
|
|
|
|
int var4 = par2 & 3;
|
|
|
|
return var3 == 0 && (par1 == 1 || par1 == 0) ? 255 : (var3 == 4 && (par1 == 5 || par1 == 4) ? 255 : (var3 == 8 && (par1 == 2 || par1 == 3) ? 255 : (var4 == 1 ? 116 : (var4 == 2 ? 117 : (var4 == 3 ? 153 : 39)))));
|
2013-03-30 17:14:03 +00:00
|
|
|
}*/
|
2013-03-28 19:03:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Determines the damage on the item the block drops. Used in cloth and wood.
|
|
|
|
*/
|
|
|
|
public int damageDropped(int par1)
|
|
|
|
{
|
|
|
|
return par1 & 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* returns a number between 0 and 3
|
|
|
|
*/
|
|
|
|
public static int limitToValidMetadata(int par0)
|
|
|
|
{
|
|
|
|
return par0 & 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an item stack containing a single instance of the current block type. 'i' is the block's subtype/damage
|
|
|
|
* and is ignored for blocks which do not support subtypes. Blocks which cannot be harvested should return null.
|
|
|
|
*/
|
|
|
|
protected ItemStack createStackedBlock(int par1)
|
|
|
|
{
|
|
|
|
return new ItemStack(this.blockID, 1, limitToValidMetadata(par1));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canSustainLeaves(World world, int x, int y, int z)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isWood(World world, int x, int y, int z)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|