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