Files
Mantle/src/mantle/blocks/MantleBlock.java
T
2014-02-05 08:18:10 -05:00

39 lines
1.3 KiB
Java

package mantle.blocks;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import mantle.debug.DebugHelper;
import mantle.debug.IDebuggable;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
/**
* Root class for inheriting the Minecraft Block.
*
* @author Sunstrike <[email protected]>
*/
public abstract class MantleBlock extends Block {
public MantleBlock(Material material) {
super(material);
}
// IDebuggable support - Uses a stick for debug purposes.
//TODO onBlockClicked
@Override
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER && player.getHeldItem() != null && player.getHeldItem().getItem() == Item.getItemFromBlock(Block.getBlockFromName("Item_Stick")))
{
TileEntity te = world.getTileEntity(x, y, z);
if (te instanceof IDebuggable)
DebugHelper.handleDebugData(((IDebuggable) te).getDebugInfo(player));
}
super.onBlockClicked(world, x, y, z, player);
}
}