summaryrefslogtreecommitdiff
path: root/ihl/worldgen/ores/DebugScannerBlock.java
blob: a934f60071a0dddc8fa6ea098d13806f75315106 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package ihl.worldgen.ores;

import ihl.IHLCreativeTab;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

public class DebugScannerBlock extends Block implements ITileEntityProvider{
	
		public DebugScannerBlock(Material material) 
		{
			super(material);
	        this.setCreativeTab(IHLCreativeTab.tab);
		}

		@Override
		public TileEntity createNewTileEntity(World world, int var2) {
			return new DebugScannerTileEntity();
		}
		
		@Override
		public boolean hasTileEntity(int metadata)
		{
		    return true;
		}
		
		@Override
		public boolean onBlockActivated(World world,int x,int y,int z,EntityPlayer entityPlayer,int i,float pos_x,float pos_y,float pos_z){
			TileEntity te = world.getTileEntity(x,y,z);
			if(te instanceof DebugScannerTileEntity)
	        	{
				DebugScannerTileEntity bte = (DebugScannerTileEntity)te;
					if (bte == null || entityPlayer.isSneaking()) {
	        			return false;
	        		}
	        		else
	        		{
	        			return bte.getGui(entityPlayer);
	        		}
	        	}
			 return false;
		}
}