@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
if(worldIn.isRemote)return true;
TileEntity tile = worldIn.getTileEntity(pos);
if(tile == null || !(tile instanceof TileTelePortal)) return false;
ItemStack stack = player.getHeldItem(hand);
if(ItemStackTools.isValid(stack)){
if(stack.getItem() == ModItems.miscCard && stack.getMetadata() == CardType.TELEPORT_PORTAL.getMetadata()){
if(ItemNBTHelper.verifyExistance(stack, "PortalPos")){
BlockPos portalPos = NBTUtil.getPosFromTag(ItemNBTHelper.getCompound(stack).getCompoundTag("PortalPos"));
int dim = ItemNBTHelper.getInteger(stack, "PortalDim", 0);
TileTelePortal portal = (TileTelePortal)tile;
portal.otherPortalPos = portalPos;
portal.otherPortalDim = dim;
ModLogger.info("Set link to "+portalPos);
return true;
}
}
}
return false;
}
BlockTelePortal.java 文件源码
java
阅读 19
收藏 0
点赞 0
评论 0
项目:CrystalMod
作者:
评论列表
文章目录