BiomesOPlenty/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMudBrickSlab.java

105 lines
2.9 KiB
Java
Raw Normal View History

2013-03-28 19:03:53 +00:00
package tdwp_ftw.biomesop.blocks;
import java.util.List;
import java.util.Random;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import net.minecraft.block.BlockHalfSlab;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockMudBrickSlab extends BlockHalfSlab
{
/** The type of tree this slab came from. */
public static final String[] woodType = new String[] {"mudBrickBlock"};
public BlockMudBrickSlab(int par1, boolean par2)
{
super(par1, par2, Material.rock);
this.setCreativeTab(mod_BiomesOPlenty.tabBiomesOPlenty);
this.useNeighborBrightness[blockID] = true;
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public int getBlockTextureFromSideAndMetadata(int par1, int par2)
{
switch (par2 & 7)
{
case 1:
return 198;
case 2:
return 214;
case 3:
return 199;
default:
return 52;
}
}
/**
* Returns the block texture based on the side being looked at. Args: side
*/
public int getBlockTextureFromSide(int par1)
{
return this.getBlockTextureFromSideAndMetadata(par1, 0);
}
/**
* Returns the ID of the items to drop on destruction.
*/
public int idDropped(int par1, Random par2Random, int par3)
{
return mod_BiomesOPlenty.mudBrickSingleSlab.blockID;
}
/**
* 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(mod_BiomesOPlenty.mudBrickSingleSlab.blockID, 2, par1 & 7);
}
/**
* Returns the slab block name with step type.
*/
public String getFullSlabName(int par1)
{
if (par1 < 0 || par1 >= woodType.length)
{
par1 = 0;
}
return super.getBlockName() + "." + woodType[par1];
}
/**
* returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
*/
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
if (par1 != mod_BiomesOPlenty.mudBrickDoubleSlab.blockID)
{
par3List.add(new ItemStack(par1, 1, 0));
}
}
/**
* only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative)
*/
public int idPicked(World par1World, int par2, int par3, int par4)
{
return mod_BiomesOPlenty.mudBrickSingleSlab.blockID;
}
}