2014-06-27 19:43:09 -04:00
|
|
|
package WayofTime.alchemicalWizardry.common.block;
|
|
|
|
|
|
|
|
import net.minecraft.block.BlockContainer;
|
|
|
|
import net.minecraft.block.material.Material;
|
2015-07-29 14:35:00 -04:00
|
|
|
import net.minecraft.block.state.IBlockState;
|
2014-06-27 19:43:09 -04:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2015-07-29 14:35:00 -04:00
|
|
|
import net.minecraft.util.BlockPos;
|
|
|
|
import net.minecraft.util.EnumFacing;
|
2014-06-27 19:43:09 -04:00
|
|
|
import net.minecraft.world.World;
|
2014-12-04 14:31:31 -05:00
|
|
|
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
|
2014-06-27 19:43:09 -04:00
|
|
|
|
|
|
|
public class BlockDemonPortal extends BlockContainer
|
|
|
|
{
|
2014-10-13 22:33:20 +02:00
|
|
|
public BlockDemonPortal()
|
|
|
|
{
|
|
|
|
super(Material.rock);
|
2014-12-29 06:48:01 -05:00
|
|
|
setHardness(1000);
|
|
|
|
setResistance(10000);
|
2014-10-13 22:33:20 +02:00
|
|
|
}
|
2014-12-04 14:31:31 -05:00
|
|
|
|
2014-12-29 06:48:01 -05:00
|
|
|
@Override
|
2015-07-29 14:35:00 -04:00
|
|
|
public void onBlockHarvested(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player)
|
2014-12-29 06:48:01 -05:00
|
|
|
{
|
2015-07-29 14:35:00 -04:00
|
|
|
TileEntity tile = world.getTileEntity(blockPos);
|
2014-12-04 14:31:31 -05:00
|
|
|
if(tile instanceof TEDemonPortal)
|
|
|
|
{
|
|
|
|
((TEDemonPortal) tile).notifyPortalOfBreak();
|
|
|
|
}
|
2014-12-04 19:21:51 -05:00
|
|
|
|
2015-07-29 14:35:00 -04:00
|
|
|
super.onBlockHarvested(world, blockPos, blockState, player);
|
2014-12-04 19:21:51 -05:00
|
|
|
}
|
2014-06-27 19:43:09 -04:00
|
|
|
|
2014-10-13 22:33:20 +02:00
|
|
|
@Override
|
|
|
|
public TileEntity createNewTileEntity(World var1, int var2)
|
|
|
|
{
|
|
|
|
return new TEDemonPortal();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-07-29 14:35:00 -04:00
|
|
|
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
|
2014-06-27 19:43:09 -04:00
|
|
|
{
|
2014-10-13 22:33:20 +02:00
|
|
|
if (world.isRemote)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-07-29 14:35:00 -04:00
|
|
|
TEDemonPortal tileEntity = (TEDemonPortal) world.getTileEntity(blockPos);
|
2014-10-13 22:33:20 +02:00
|
|
|
|
2015-07-29 14:35:00 -04:00
|
|
|
tileEntity.rightClickBlock(player, side.getIndex());
|
2014-10-13 22:33:20 +02:00
|
|
|
|
|
|
|
return false;
|
2014-06-27 19:43:09 -04:00
|
|
|
}
|
|
|
|
}
|